Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Move types, colors, and workflows into seed files

Christophe Bliard9eacfdc255f0
diff --git a/app/seeders/basic_data/color_scheme_seeder.rb b/app/seeders/basic_data/color_scheme_seeder.rb
index ed8591a16e6..3f1d065fef9 100644
--- a/app/seeders/basic_data/color_scheme_seeder.rb
+++ b/app/seeders/basic_data/color_scheme_seeder.rb
@@ -26,159 +26,21 @@
# See COPYRIGHT and LICENSE files for more details.
#++
module BasicData
- class ColorSchemeSeeder < Seeder
- def seed_data!
- Color.transaction do
- data.each do |attributes|
- Color.create(attributes)
- end
- end
- end
+ class ColorSchemeSeeder < ModelSeeder
+ self.model_class = Color
+ self.seed_data_model_key = 'open_color_palette'
def applicable?
- Color.where(name: %w(grape-0 grape-1)).empty?
+ Color.where(name: %w(grape-0 grape-1)).none?
end
- def not_applicable_message
- 'Skipping flat colors as there are already some configured'
- end
-
- ##
- # Palette by open-color
- # https://yeun.github.io/open-color/
- def data
- [
- { name: 'gray-0', hexcode: '#f8f9fa' },
- { name: 'gray-1', hexcode: '#f1f3f5' },
- { name: 'gray-2', hexcode: '#e9ecef' },
- { name: 'gray-3', hexcode: '#dee2e6' },
- { name: 'gray-4', hexcode: '#ced4da' },
- { name: 'gray-5', hexcode: '#adb5bd' },
- { name: 'gray-6', hexcode: '#868e96' },
- { name: 'gray-7', hexcode: '#495057' },
- { name: 'gray-8', hexcode: '#343a40' },
- { name: 'gray-9', hexcode: '#212529' },
- { name: 'red-0', hexcode: '#fff5f5' },
- { name: 'red-1', hexcode: '#ffe3e3' },
- { name: 'red-2', hexcode: '#ffc9c9' },
- { name: 'red-3', hexcode: '#ffa8a8' },
- { name: 'red-4', hexcode: '#ff8787' },
- { name: 'red-5', hexcode: '#ff6b6b' },
- { name: 'red-6', hexcode: '#fa5252' },
- { name: 'red-7', hexcode: '#f03e3e' },
- { name: 'red-8', hexcode: '#e03131' },
- { name: 'red-9', hexcode: '#c92a2a' },
- { name: 'pink-0', hexcode: '#fff0f6' },
- { name: 'pink-1', hexcode: '#ffdeeb' },
- { name: 'pink-2', hexcode: '#fcc2d7' },
- { name: 'pink-3', hexcode: '#faa2c1' },
- { name: 'pink-4', hexcode: '#f783ac' },
- { name: 'pink-5', hexcode: '#f06595' },
- { name: 'pink-6', hexcode: '#e64980' },
- { name: 'pink-7', hexcode: '#d6336c' },
- { name: 'pink-8', hexcode: '#c2255c' },
- { name: 'pink-9', hexcode: '#a61e4d' },
- { name: 'grape-0', hexcode: '#f8f0fc' },
- { name: 'grape-1', hexcode: '#f3d9fa' },
- { name: 'grape-2', hexcode: '#eebefa' },
- { name: 'grape-3', hexcode: '#e599f7' },
- { name: 'grape-4', hexcode: '#da77f2' },
- { name: 'grape-5', hexcode: '#cc5de8' },
- { name: 'grape-6', hexcode: '#be4bdb' },
- { name: 'grape-7', hexcode: '#ae3ec9' },
- { name: 'grape-8', hexcode: '#9c36b5' },
- { name: 'grape-9', hexcode: '#862e9c' },
- { name: 'violet-0', hexcode: '#f3f0ff' },
- { name: 'violet-1', hexcode: '#e5dbff' },
- { name: 'violet-2', hexcode: '#d0bfff' },
- { name: 'violet-3', hexcode: '#b197fc' },
- { name: 'violet-4', hexcode: '#9775fa' },
- { name: 'violet-5', hexcode: '#845ef7' },
- { name: 'violet-6', hexcode: '#7950f2' },
- { name: 'violet-7', hexcode: '#7048e8' },
- { name: 'violet-8', hexcode: '#6741d9' },
- { name: 'violet-9', hexcode: '#5f3dc4' },
- { name: 'indigo-0', hexcode: '#edf2ff' },
- { name: 'indigo-1', hexcode: '#dbe4ff' },
- { name: 'indigo-2', hexcode: '#bac8ff' },
- { name: 'indigo-3', hexcode: '#91a7ff' },
- { name: 'indigo-4', hexcode: '#748ffc' },
- { name: 'indigo-5', hexcode: '#5c7cfa' },
- { name: 'indigo-6', hexcode: '#4c6ef5' },
- { name: 'indigo-7', hexcode: '#4263eb' },
- { name: 'indigo-8', hexcode: '#3b5bdb' },
- { name: 'indigo-9', hexcode: '#364fc7' },
- { name: 'blue-0', hexcode: '#e7f5ff' },
- { name: 'blue-1', hexcode: '#d0ebff' },
- { name: 'blue-2', hexcode: '#a5d8ff' },
- { name: 'blue-3', hexcode: '#74c0fc' },
- { name: 'blue-4', hexcode: '#4dabf7' },
- { name: 'blue-5', hexcode: '#339af0' },
- { name: 'blue-6', hexcode: '#228be6' },
- { name: 'blue-7', hexcode: '#1c7ed6' },
- { name: 'blue-8', hexcode: '#1971c2' },
- { name: 'blue-9', hexcode: '#1864ab' },
- { name: 'cyan-0', hexcode: '#e3fafc' },
- { name: 'cyan-1', hexcode: '#c5f6fa' },
- { name: 'cyan-2', hexcode: '#99e9f2' },
- { name: 'cyan-3', hexcode: '#66d9e8' },
- { name: 'cyan-4', hexcode: '#3bc9db' },
- { name: 'cyan-5', hexcode: '#22b8cf' },
- { name: 'cyan-6', hexcode: '#15aabf' },
- { name: 'cyan-7', hexcode: '#1098ad' },
- { name: 'cyan-8', hexcode: '#0c8599' },
- { name: 'cyan-9', hexcode: '#0b7285' },
- { name: 'teal-0', hexcode: '#e6fcf5' },
- { name: 'teal-1', hexcode: '#c3fae8' },
- { name: 'teal-2', hexcode: '#96f2d7' },
- { name: 'teal-3', hexcode: '#63e6be' },
- { name: 'teal-4', hexcode: '#38d9a9' },
- { name: 'teal-5', hexcode: '#20c997' },
- { name: 'teal-6', hexcode: '#12b886' },
- { name: 'teal-7', hexcode: '#0ca678' },
- { name: 'teal-8', hexcode: '#099268' },
- { name: 'teal-9', hexcode: '#087f5b' },
- { name: 'green-0', hexcode: '#ebfbee' },
- { name: 'green-1', hexcode: '#d3f9d8' },
- { name: 'green-2', hexcode: '#b2f2bb' },
- { name: 'green-3', hexcode: '#8ce99a' },
- { name: 'green-4', hexcode: '#69db7c' },
- { name: 'green-5', hexcode: '#51cf66' },
- { name: 'green-6', hexcode: '#40c057' },
- { name: 'green-7', hexcode: '#37b24d' },
- { name: 'green-8', hexcode: '#2f9e44' },
- { name: 'green-9', hexcode: '#2b8a3e' },
- { name: 'lime-0', hexcode: '#f4fce3' },
- { name: 'lime-1', hexcode: '#e9fac8' },
- { name: 'lime-2', hexcode: '#d8f5a2' },
- { name: 'lime-3', hexcode: '#c0eb75' },
- { name: 'lime-4', hexcode: '#a9e34b' },
- { name: 'lime-5', hexcode: '#94d82d' },
- { name: 'lime-6', hexcode: '#82c91e' },
- { name: 'lime-7', hexcode: '#74b816' },
- { name: 'lime-8', hexcode: '#66a80f' },
- { name: 'lime-9', hexcode: '#5c940d' },
- { name: 'yellow-0', hexcode: '#fff9db' },
- { name: 'yellow-1', hexcode: '#fff3bf' },
- { name: 'yellow-2', hexcode: '#ffec99' },
- { name: 'yellow-3', hexcode: '#ffe066' },
- { name: 'yellow-4', hexcode: '#ffd43b' },
- { name: 'yellow-5', hexcode: '#fcc419' },
- { name: 'yellow-6', hexcode: '#fab005' },
- { name: 'yellow-7', hexcode: '#f59f00' },
- { name: 'yellow-8', hexcode: '#f08c00' },
- { name: 'yellow-9', hexcode: '#e67700' },
- { name: 'orange-0', hexcode: '#fff4e6' },
- { name: 'orange-1', hexcode: '#ffe8cc' },
- { name: 'orange-2', hexcode: '#ffd8a8' },
- { name: 'orange-3', hexcode: '#ffc078' },
- { name: 'orange-4', hexcode: '#ffa94d' },
- { name: 'orange-5', hexcode: '#ff922b' },
- { name: 'orange-6', hexcode: '#fd7e14' },
- { name: 'orange-7', hexcode: '#f76707' },
- { name: 'orange-8', hexcode: '#e8590c' },
- { name: 'orange-9', hexcode: '#d9480f' }
- ]
+ def model_attributes(color_scheme_data)
+ color_scheme_data['hexcodes'].map.with_index do |hexcode, i|
+ {
+ name: "#{color_scheme_data['color']}-#{i}",
+ hexcode:
+ }
+ end
end
end
end
diff --git a/app/seeders/basic_data/color_seeder.rb b/app/seeders/basic_data/color_seeder.rb
index d566f48f57b..ec223251b35 100644
--- a/app/seeders/basic_data/color_seeder.rb
+++ b/app/seeders/basic_data/color_seeder.rb
@@ -26,40 +26,15 @@
# See COPYRIGHT and LICENSE files for more details.
#++
module BasicData
- class ColorSeeder < Seeder
- def seed_data!
- Color.transaction do
- data.each do |attributes|
- Color.create(attributes)
- end
- end
- end
-
- def applicable?
- Color.all.empty?
- end
-
- def not_applicable_message
- 'Skipping colors as there are already some configured'
- end
+ class ColorSeeder < ModelSeeder
+ self.model_class = Color
+ self.seed_data_model_key = 'colors'
- def data
- [
- { name: I18n.t(:default_color_blue_dark), hexcode: '#175A8E' },
- { name: I18n.t(:default_color_blue), hexcode: '#1A67A3' },
- { name: I18n.t(:default_color_blue_light), hexcode: '#00B0F0' },
- { name: I18n.t(:default_color_green_light), hexcode: '#35C53F' },
- { name: I18n.t(:default_color_green_dark), hexcode: '#339933' },
- { name: I18n.t(:default_color_yellow), hexcode: '#FFFF00' },
- { name: I18n.t(:default_color_orange), hexcode: '#FFCC00' },
- { name: I18n.t(:default_color_red), hexcode: '#FF3300' },
- { name: I18n.t(:default_color_magenta), hexcode: '#E20074' },
- { name: I18n.t(:default_color_white), hexcode: '#FFFFFF' },
- { name: I18n.t(:default_color_grey_light), hexcode: '#F8F8F8' },
- { name: I18n.t(:default_color_grey), hexcode: '#EAEAEA' },
- { name: I18n.t(:default_color_grey_dark), hexcode: '#878787' },
- { name: I18n.t(:default_color_black), hexcode: '#000000' }
- ]
+ def model_attributes(color_data)
+ {
+ name: color_data['name'],
+ hexcode: color_data['hexcode']
+ }
end
end
end
diff --git a/app/seeders/basic_data/model_seeder.rb b/app/seeders/basic_data/model_seeder.rb
index 88ae5f1cc0a..6a4439f28ef 100644
--- a/app/seeders/basic_data/model_seeder.rb
+++ b/app/seeders/basic_data/model_seeder.rb
@@ -61,7 +61,12 @@ module BasicData
def color_id(name)
@color_ids_by_name ||= Color.pluck(:name, :id).to_h
- @color_ids_by_name[name] or raise "Cannot find color #{name}"
+ case name
+ when Symbol
+ seed_data.find_reference(name).id
+ else
+ @color_ids_by_name[name] or raise "Cannot find color #{name}"
+ end
end
end
end
diff --git a/modules/bim/app/seeders/bim/basic_data/type_seeder.rb b/app/seeders/basic_data/type_configuration_seeder.rb
similarity index 59%
rename from modules/bim/app/seeders/bim/basic_data/type_seeder.rb
rename to app/seeders/basic_data/type_configuration_seeder.rb
index cbdf1ed08ff..5f620b83017 100644
--- a/modules/bim/app/seeders/bim/basic_data/type_seeder.rb
+++ b/app/seeders/basic_data/type_configuration_seeder.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
@@ -25,23 +27,29 @@
#
# See COPYRIGHT and LICENSE files for more details.
#++
-module Bim
- module BasicData
- class TypeSeeder < ::BasicData::TypeSeeder
- def type_names
- %i[task milestone phase clash issue remark request]
+module BasicData
+ class TypeConfigurationSeeder < Seeder
+ self.needs = [
+ BasicData::TypeSeeder
+ ]
+
+ def seed!
+ seed_data.each('type_configuration') do |type_configuration_data|
+ type = seed_data.find_reference(type_configuration_data['type'])
+ query_groups = query_groups(type_configuration_data)
+ type.update(
+ attribute_groups: query_groups + type.default_attribute_groups
+ )
end
+ end
+
+ private
- def type_table
- { # position is_default color_name is_in_roadmap is_milestone type_name
- task: [1, true, 'blue-6', true, false, :default_type_task],
- milestone: [2, true, 'orange-6', false, true, :default_type_milestone],
- phase: [3, true, I18n.t(:default_color_grey), false, false, :default_type_phase],
- issue: [4, true, 'indigo-7', true, false, 'bim.default_type_issue'],
- remark: [5, true, I18n.t(:default_color_green_dark), true, false, 'bim.default_type_remark'],
- request: [6, true, 'cyan-7', true, false, 'bim.default_type_request'],
- clash: [7, true, 'red-8', true, false, 'bim.default_type_clash']
- }
+ def query_groups(type_configuration_data)
+ type_configuration_data['form_configuration'].map do |form_config_attr|
+ query = seed_data.find_reference(form_config_attr['query'])
+ query_association = "query_#{query.id}"
+ [form_config_attr['group_name'], [query_association.to_sym]]
end
end
end
diff --git a/app/seeders/basic_data/type_seeder.rb b/app/seeders/basic_data/type_seeder.rb
index 0c3e715e41d..88e4ad73574 100644
--- a/app/seeders/basic_data/type_seeder.rb
+++ b/app/seeders/basic_data/type_seeder.rb
@@ -26,77 +26,24 @@
# See COPYRIGHT and LICENSE files for more details.
#++
module BasicData
- class TypeSeeder < Seeder
+ class TypeSeeder < ModelSeeder
+ self.model_class = Type
+ self.seed_data_model_key = 'types'
self.needs = [
BasicData::ColorSeeder,
BasicData::ColorSchemeSeeder
]
- def seed_data!
- Type.transaction do
- data.each do |attributes|
- Type.create!(attributes)
- end
- end
- end
-
- def applicable
- Type.all.any?
- end
-
- def not_applicable_message
- 'Skipping types - already exists/configured'
- end
-
- ##
- # Returns the data of all types to seed.
- #
- # @return [Array<Hash>] List of attributes for each type.
- def data
- colors = Color.pluck(:name, :id).to_h
-
- type_table.map do |_name, (position, is_default, color_name, is_in_roadmap, is_milestone, type_name)|
- {
- name: I18n.t(type_name),
- position:,
- is_default:,
- color_id: colors.fetch(color_name),
- is_in_roadmap:,
- is_milestone:,
- description: ''
- }
- end
- end
-
- def type_names
- raise NotImplementedError
- end
-
- def type_table
- raise NotImplementedError
- end
-
- def set_attribute_groups_for_type(type)
- type_data = type_data_for(type)
- return unless type_data && type_data['form_configuration']
-
- type_data['form_configuration'].each do |form_config_attr|
- groups = type.default_attribute_groups
- query = seed_data.find_reference(form_config_attr['query'])
- query_association = "query_#{query.id}"
- groups.unshift([form_config_attr['group_name'], [query_association.to_sym]])
-
- type.attribute_groups = groups
- end
-
- type.save!
- end
-
- private
-
- def type_data_for(type)
- types_data = seed_data.lookup('type_configuration') || []
- types_data.find { |entry| I18n.t(entry['type']) == type.name }
+ def model_attributes(type_data)
+ {
+ name: type_data['name'],
+ description: '',
+ is_default: true?(type_data['is_default']),
+ color_id: color_id(type_data['color_name']),
+ is_in_roadmap: true?(type_data['is_in_roadmap']),
+ is_milestone: true?(type_data['is_milestone']),
+ position: type_data['position']
+ }
end
end
end
diff --git a/app/seeders/basic_data/workflow_seeder.rb b/app/seeders/basic_data/workflow_seeder.rb
index 6e200a5100a..ef298d0ec10 100644
--- a/app/seeders/basic_data/workflow_seeder.rb
+++ b/app/seeders/basic_data/workflow_seeder.rb
@@ -27,6 +27,12 @@
#++
module BasicData
class WorkflowSeeder < Seeder
+ self.needs = [
+ BasicData::RoleSeeder,
+ BasicData::StatusSeeder,
+ BasicData::TypeSeeder
+ ]
+
def seed_data!
if any_types_or_statuses_or_workflows_already_configured?
print_status ' *** Skipping types, statuses and workflows as there are already some configured'
@@ -39,14 +45,6 @@ module BasicData
end
end
- def workflows
- raise NotImplementedError
- end
-
- def type_seeder_class
- raise NotImplementedError
- end
-
private
def any_types_or_statuses_or_workflows_already_configured?
@@ -65,7 +63,7 @@ module BasicData
def seed_types
print_status ' ↳ Types'
- type_seeder_class.new(seed_data).seed!
+ BasicData::TypeSeeder.new(seed_data).seed!
end
def seed_workflows
@@ -73,11 +71,11 @@ module BasicData
manager = Role.find_by(name: I18n.t(:default_role_project_admin))
# Workflow - Each type has its own workflow
- workflows.each do |type_id, statuses_for_type|
- statuses_for_type.each do |old_status|
- statuses_for_type.each do |new_status|
+ workflows.each do |type, statuses|
+ statuses.each do |old_status|
+ statuses.each do |new_status|
[manager, member].each do |role|
- Workflow.create type_id:,
+ Workflow.create type:,
role:,
old_status:,
new_status:
@@ -86,5 +84,13 @@ module BasicData
end
end
end
+
+ def workflows
+ seed_data.lookup(:workflows).map do |workflow_data|
+ type = seed_data.find_reference(workflow_data['type'])
+ statuses = seed_data.find_references(workflow_data['statuses'])
+ [type, statuses]
+ end
+ end
end
end
diff --git a/app/seeders/common.yml b/app/seeders/common.yml
index 0b8b9588260..d6bb8f18e56 100644
--- a/app/seeders/common.yml
+++ b/app/seeders/common.yml
@@ -26,6 +26,50 @@
# See COPYRIGHT and LICENSE files for more details.
#++
+colors:
+- reference: :default_color_blue_dark
+ t_name: Blue (dark)
+ hexcode: '#175A8E'
+- reference: :default_color_blue
+ t_name: Blue
+ hexcode: '#1A67A3'
+- reference: :default_color_blue_light
+ t_name: Blue (light)
+ hexcode: '#00B0F0'
+- reference: :default_color_green_light
+ t_name: Green (light)
+ hexcode: '#35C53F'
+- reference: :default_color_green_dark
+ t_name: Green (dark)
+ hexcode: '#339933'
+- reference: :default_color_yellow
+ t_name: Yellow
+ hexcode: '#FFFF00'
+- reference: :default_color_orange
+ t_name: Orange
+ hexcode: '#FFCC00'
+- reference: :default_color_red
+ t_name: Red
+ hexcode: '#FF3300'
+- reference: :default_color_magenta
+ t_name: Magenta
+ hexcode: '#E20074'
+- reference: :default_color_white
+ t_name: White
+ hexcode: '#FFFFFF'
+- reference: :default_color_grey_light
+ t_name: Grey (light)
+ hexcode: '#F8F8F8'
+- reference: :default_color_grey
+ t_name: Grey
+ hexcode: '#EAEAEA'
+- reference: :default_color_grey_dark
+ t_name: Grey (dark)
+ hexcode: '#878787'
+- reference: :default_color_black
+ t_name: Black
+ hexcode: '#000000'
+
document_categories:
- t_name: Management
position: 1
@@ -33,3 +77,164 @@ document_categories:
position: 2
- t_name: Accessibility
position: 3
+
+# Palette by open-color
+# https://yeun.github.io/open-color/
+# TODO: should the color name be translated?
+open_color_palette:
+- color: gray
+ hexcodes:
+ - '#f8f9fa'
+ - '#f1f3f5'
+ - '#e9ecef'
+ - '#dee2e6'
+ - '#ced4da'
+ - '#adb5bd'
+ - '#868e96'
+ - '#495057'
+ - '#343a40'
+ - '#212529'
+- color: red
+ hexcodes:
+ - '#fff5f5'
+ - '#ffe3e3'
+ - '#ffc9c9'
+ - '#ffa8a8'
+ - '#ff8787'
+ - '#ff6b6b'
+ - '#fa5252'
+ - '#f03e3e'
+ - '#e03131'
+ - '#c92a2a'
+- color: pink
+ hexcodes:
+ - '#fff0f6'
+ - '#ffdeeb'
+ - '#fcc2d7'
+ - '#faa2c1'
+ - '#f783ac'
+ - '#f06595'
+ - '#e64980'
+ - '#d6336c'
+ - '#c2255c'
+ - '#a61e4d'
+- color: grape
+ hexcodes:
+ - '#f8f0fc'
+ - '#f3d9fa'
+ - '#eebefa'
+ - '#e599f7'
+ - '#da77f2'
+ - '#cc5de8'
+ - '#be4bdb'
+ - '#ae3ec9'
+ - '#9c36b5'
+ - '#862e9c'
+- color: violet
+ hexcodes:
+ - '#f3f0ff'
+ - '#e5dbff'
+ - '#d0bfff'
+ - '#b197fc'
+ - '#9775fa'
+ - '#845ef7'
+ - '#7950f2'
+ - '#7048e8'
+ - '#6741d9'
+ - '#5f3dc4'
+- color: indigo
+ hexcodes:
+ - '#edf2ff'
+ - '#dbe4ff'
+ - '#bac8ff'
+ - '#91a7ff'
+ - '#748ffc'
+ - '#5c7cfa'
+ - '#4c6ef5'
+ - '#4263eb'
+ - '#3b5bdb'
+ - '#364fc7'
+- color: blue
+ hexcodes:
+ - '#e7f5ff'
+ - '#d0ebff'
+ - '#a5d8ff'
+ - '#74c0fc'
+ - '#4dabf7'
+ - '#339af0'
+ - '#228be6'
+ - '#1c7ed6'
+ - '#1971c2'
+ - '#1864ab'
+- color: cyan
+ hexcodes:
+ - '#e3fafc'
+ - '#c5f6fa'
+ - '#99e9f2'
+ - '#66d9e8'
+ - '#3bc9db'
+ - '#22b8cf'
+ - '#15aabf'
+ - '#1098ad'
+ - '#0c8599'
+ - '#0b7285'
+- color: teal
+ hexcodes:
+ - '#e6fcf5'
+ - '#c3fae8'
+ - '#96f2d7'
+ - '#63e6be'
+ - '#38d9a9'
+ - '#20c997'
+ - '#12b886'
+ - '#0ca678'
+ - '#099268'
+ - '#087f5b'
+- color: green
+ hexcodes:
+ - '#ebfbee'
+ - '#d3f9d8'
+ - '#b2f2bb'
+ - '#8ce99a'
+ - '#69db7c'
+ - '#51cf66'
+ - '#40c057'
+ - '#37b24d'
+ - '#2f9e44'
+ - '#2b8a3e'
+- color: lime
+ hexcodes:
+ - '#f4fce3'
+ - '#e9fac8'
+ - '#d8f5a2'
+ - '#c0eb75'
+ - '#a9e34b'
+ - '#94d82d'
+ - '#82c91e'
+ - '#74b816'
+ - '#66a80f'
+ - '#5c940d'
+- color: yellow
+ hexcodes:
+ - '#fff9db'
+ - '#fff3bf'
+ - '#ffec99'
+ - '#ffe066'
+ - '#ffd43b'
+ - '#fcc419'
+ - '#fab005'
+ - '#f59f00'
+ - '#f08c00'
+ - '#e67700'
+- color: orange
+ hexcodes:
+ - '#fff4e6'
+ - '#ffe8cc'
+ - '#ffd8a8'
+ - '#ffc078'
+ - '#ffa94d'
+ - '#ff922b'
+ - '#fd7e14'
+ - '#f76707'
+ - '#e8590c'
+ - '#d9480f'
diff --git a/app/seeders/demo_data/project_seeder.rb b/app/seeders/demo_data/project_seeder.rb
index 31eb73d6c8e..d4a790d315f 100644
--- a/app/seeders/demo_data/project_seeder.rb
+++ b/app/seeders/demo_data/project_seeder.rb
@@ -92,11 +92,7 @@ module DemoData
def set_types
print_status ' -Assigning types.'
- project.types.clear
- Array(project_data.lookup('types')).each do |type_name|
- type = Type.find_by(name: I18n.t(type_name))
- project.types << type
- end
+ project.types = seed_data.find_references(project_data.lookup('types'))
end
def seed_categories
diff --git a/app/seeders/demo_data/projects_seeder.rb b/app/seeders/demo_data/projects_seeder.rb
index 3bd5a4e3f45..bc42a3dcbbd 100644
--- a/app/seeders/demo_data/projects_seeder.rb
+++ b/app/seeders/demo_data/projects_seeder.rb
@@ -40,7 +40,7 @@ module DemoData
end
print_status ' ↳ Update form configuration with global queries'
- set_form_configuration
+ seed_form_configuration
end
def applicable?
@@ -60,10 +60,8 @@ module DemoData
project_seeder.seed!
end
- def set_form_configuration
- Type.all.each do |type|
- BasicData::TypeSeeder.new(seed_data).set_attribute_groups_for_type(type)
- end
+ def seed_form_configuration
+ BasicData::TypeConfigurationSeeder.new(seed_data).seed!
end
def seedable_welcome_settings
diff --git a/app/seeders/demo_data/work_package_board_seeder.rb b/app/seeders/demo_data/work_package_board_seeder.rb
index fb0dc5026bb..ac09152a3be 100644
--- a/app/seeders/demo_data/work_package_board_seeder.rb
+++ b/app/seeders/demo_data/work_package_board_seeder.rb
@@ -94,7 +94,7 @@ module DemoData
board.options[:filters] = []
filters_conf.each do |filter|
if filter['type']
- type = Type.find_by(name: I18n.t(filter['type']))
+ type = seed_data.find_reference(filter['type'])
board.options[:filters] << { type: { operator: '=', values: [type.id.to_s] } }
end
end
@@ -124,7 +124,7 @@ module DemoData
end
def statuses(*status_references)
- statuses = status_references.map { seed_data.find_reference(_1) }
+ statuses = seed_data.find_references(status_references)
if statuses.size < status_references.size
raise StandardError, "Not all statuses needed for seeding a board are present. Check that they got seeded."
diff --git a/app/seeders/demo_data/work_package_seeder.rb b/app/seeders/demo_data/work_package_seeder.rb
index 238ea324cdb..3e72e9d5403 100644
--- a/app/seeders/demo_data/work_package_seeder.rb
+++ b/app/seeders/demo_data/work_package_seeder.rb
@@ -31,7 +31,7 @@ module DemoData
self.needs = [
BasicData::StatusSeeder,
- Standard::BasicData::TypeSeeder,
+ BasicData::TypeSeeder,
BasicData::PrioritySeeder,
AdminUserSeeder
]
@@ -102,7 +102,7 @@ module DemoData
description: attributes['description'],
status: find_status(attributes),
type: find_type(attributes),
- priority: find_priority(attributes) || IssuePriority.default,
+ priority: IssuePriority.default,
parent: find_work_package(attributes['parent'])
}
end
@@ -143,16 +143,12 @@ module DemoData
seed_data.find_reference(reference) || user
end
- def find_priority(attributes)
- IssuePriority.find_by(name: I18n.t(attributes['priority']))
- end
-
def find_status(attributes)
seed_data.find_reference(attributes['status'].to_sym)
end
def find_type(attributes)
- Type.find_by!(name: I18n.t(attributes['type']))
+ seed_data.find_reference(attributes['type'].to_sym)
end
def set_version!(wp_attr, attributes)
diff --git a/app/seeders/source/seed_data.rb b/app/seeders/source/seed_data.rb
index 4f47c592bd2..3710c35d2fa 100644
--- a/app/seeders/source/seed_data.rb
+++ b/app/seeders/source/seed_data.rb
@@ -55,6 +55,10 @@ class Source::SeedData
end
end
+ def find_references(references, default: :__unset__)
+ Array(references).map { |reference| find_reference(reference, default:) }
+ end
+
# Get a `SeedData` instance with only the given top level keys.
#
# Used in tests to get the real statuses, types and other data.
diff --git a/app/seeders/standard.yml b/app/seeders/standard.yml
index b8c722df12d..58e6ccedad8 100644
--- a/app/seeders/standard.yml
+++ b/app/seeders/standard.yml
@@ -117,6 +117,123 @@ time_entry_activities:
- t_name: Other
position: 6
+types:
+- reference: :default_type_task
+ t_name: Task
+ is_default: true
+ color_name: :default_color_blue
+ is_in_roadmap: true
+ position: 1
+- reference: :default_type_milestone
+ t_name: Milestone
+ is_default: true
+ color_name: :default_color_green_light
+ is_milestone: true
+ position: 2
+- reference: :default_type_phase
+ t_name: Phase
+ is_default: true
+ color_name: 'orange-5'
+ position: 3
+- reference: :default_type_feature
+ t_name: Feature
+ color_name: 'indigo-5'
+ is_in_roadmap: true
+ position: 4
+- reference: :default_type_epic
+ t_name: Epic
+ color_name: 'violet-5'
+ is_in_roadmap: true
+ position: 5
+- reference: :default_type_user_story
+ t_name: User story
+ color_name: :default_color_blue_light
+ is_in_roadmap: true
+ position: 6
+- reference: :default_type_bug
+ t_name: Bug
+ color_name: 'red-7'
+ is_in_roadmap: true
+ position: 7
+
+workflows:
+- type: :default_type_task
+ statuses:
+ - :default_status_new
+ - :default_status_in_progress
+ - :default_status_on_hold
+ - :default_status_rejected
+ - :default_status_closed
+- type: :default_type_milestone
+ statuses:
+ - :default_status_new
+ - :default_status_to_be_scheduled
+ - :default_status_scheduled
+ - :default_status_in_progress
+ - :default_status_on_hold
+ - :default_status_rejected
+ - :default_status_closed
+- type: :default_type_phase
+ statuses:
+ - :default_status_new
+ - :default_status_to_be_scheduled
+ - :default_status_scheduled
+ - :default_status_in_progress
+ - :default_status_on_hold
+ - :default_status_rejected
+ - :default_status_closed
+- type: :default_type_feature
+ statuses:
+ - :default_status_new
+ - :default_status_in_specification
+ - :default_status_specified
+ - :default_status_in_progress
+ - :default_status_developed
+ - :default_status_in_testing
+ - :default_status_tested
+ - :default_status_test_failed
+ - :default_status_on_hold
+ - :default_status_rejected
+ - :default_status_closed
+- type: :default_type_epic
+ statuses:
+ - :default_status_new
+ - :default_status_in_specification
+ - :default_status_specified
+ - :default_status_in_progress
+ - :default_status_developed
+ - :default_status_in_testing
+ - :default_status_tested
+ - :default_status_test_failed
+ - :default_status_on_hold
+ - :default_status_rejected
+ - :default_status_closed
+- type: :default_type_user_story
+ statuses:
+ - :default_status_new
+ - :default_status_in_specification
+ - :default_status_specified
+ - :default_status_in_progress
+ - :default_status_developed
+ - :default_status_in_testing
+ - :default_status_tested
+ - :default_status_test_failed
+ - :default_status_on_hold
+ - :default_status_rejected
+ - :default_status_closed
+- type: :default_type_bug
+ statuses:
+ - :default_status_new
+ - :default_status_confirmed
+ - :default_status_in_progress
+ - :default_status_developed
+ - :default_status_in_testing
+ - :default_status_tested
+ - :default_status_test_failed
+ - :default_status_on_hold
+ - :default_status_rejected
+ - :default_status_closed
+
welcome:
t_title: "Welcome to OpenProject!"
t_text: |
@@ -203,7 +320,7 @@ projects:
kanban:
t_name: 'Kanban board'
filters:
- - type: default_type_task
+ - type: :default_type_task
basic:
t_name: 'Basic board'
lists:
@@ -300,7 +417,7 @@ projects:
t_subject: Start of project
description:
status: :default_status_closed
- type: default_type_milestone
+ type: :default_type_milestone
duration: 1
schedule_manually: false
- start: 0
@@ -308,32 +425,32 @@ projects:
reference: :organize_open_source_conference
description: ''
status: :default_status_in_progress
- type: default_type_phase
+ type: :default_type_phase
children:
- start: 0
t_subject: Set date and location of conference
reference: :set_date_and_location_of_conference
description: ''
status: :default_status_in_progress
- type: default_type_task
+ type: :default_type_task
children:
- start: 0
t_subject: Send invitation to speakers
description: ''
status: :default_status_in_progress
- type: default_type_task
+ type: :default_type_task
duration: 1
- start: 0
t_subject: Contact sponsoring partners
description: ''
status: :default_status_new
- type: default_type_task
+ type: :default_type_task
duration: 2
- start: 0
t_subject: Create sponsorship brochure and hand-outs
description: ''
status: :default_status_new
- type: default_type_task
+ type: :default_type_task
duration: 4
duration: 4
schedule_manually: false
@@ -342,7 +459,7 @@ projects:
reference: :invite_attendees_to_conference
description: ''
status: :default_status_new
- type: default_type_task
+ type: :default_type_task
duration: 1
relations:
- to: :set_date_and_location_of_conference
@@ -353,7 +470,7 @@ projects:
reference: :setup_conference_website
description: ''
status: :default_status_new
- type: default_type_task
+ type: :default_type_task
duration: 11
relations:
- to: :set_date_and_location_of_conference
@@ -365,7 +482,7 @@ projects:
t_subject: Conference
description: ''
status: :default_status_scheduled
- type: default_type_milestone
+ type: :default_type_milestone
duration: 1
relations:
- to: :organize_open_source_conference
@@ -376,14 +493,14 @@ projects:
reference: :follow_up_tasks
description: ''
status: :default_status_to_be_scheduled
- type: default_type_phase
+ type: :default_type_phase
children:
- start: 21
t_subject: Upload presentations to website
reference: :upload_presentations_to_website
description: ''
status: :default_status_new
- type: default_type_task
+ type: :default_type_task
duration: 10
schedule_manually: false
- start: 31
@@ -394,7 +511,7 @@ projects:
* [ ] Music
* [ ] Even more beer
status: :default_status_new
- type: default_type_task
+ type: :default_type_task
duration: 1
schedule_manually: false
duration: 11
@@ -403,7 +520,7 @@ projects:
t_subject: End of project
description:
status: :default_status_new
- type: default_type_milestone
+ type: :default_type_milestone
duration: 1
relations:
- to: :follow_up_tasks
diff --git a/app/seeders/standard/basic_data/type_seeder.rb b/app/seeders/standard/basic_data/type_seeder.rb
deleted file mode 100644
index 9dbd5cdf31e..00000000000
--- a/app/seeders/standard/basic_data/type_seeder.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2023 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-module Standard
- module BasicData
- class TypeSeeder < ::BasicData::TypeSeeder
- def type_names
- %i[task milestone phase feature epic user_story bug]
- end
-
- def type_table
- { # position is_default color_name is_in_roadmap is_milestone type_name
- task: [1, true, I18n.t(:default_color_blue), true, false, :default_type_task],
- milestone: [2, true, I18n.t(:default_color_green_light), false, true, :default_type_milestone],
- phase: [3, true, 'orange-5', false, false, :default_type_phase],
- feature: [4, false, 'indigo-5', true, false, :default_type_feature],
- epic: [5, false, 'violet-5', true, false, :default_type_epic],
- user_story: [6, false, I18n.t(:default_color_blue_light), true, false, :default_type_user_story],
- bug: [7, false, 'red-7', true, false, :default_type_bug]
- }
- end
- end
- end
-end
diff --git a/app/seeders/standard/basic_data/workflow_seeder.rb b/app/seeders/standard/basic_data/workflow_seeder.rb
deleted file mode 100644
index 20c95d431b8..00000000000
--- a/app/seeders/standard/basic_data/workflow_seeder.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2023 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-module Standard
- module BasicData
- class WorkflowSeeder < ::BasicData::WorkflowSeeder
- def workflows
- types = Type.all
- types = types.map { |t| { t.name => t.id } }.reduce({}, :merge)
-
- new = seed_data.find_reference(:default_status_new)
- in_specification = seed_data.find_reference(:default_status_in_specification)
- specified = seed_data.find_reference(:default_status_specified)
- confirmed = seed_data.find_reference(:default_status_confirmed)
- to_be_scheduled = seed_data.find_reference(:default_status_to_be_scheduled)
- scheduled = seed_data.find_reference(:default_status_scheduled)
- in_progress = seed_data.find_reference(:default_status_in_progress)
- developed = seed_data.find_reference(:default_status_developed)
- in_testing = seed_data.find_reference(:default_status_in_testing)
- tested = seed_data.find_reference(:default_status_tested)
- test_failed = seed_data.find_reference(:default_status_test_failed)
- closed = seed_data.find_reference(:default_status_closed)
- on_hold = seed_data.find_reference(:default_status_on_hold)
- rejected = seed_data.find_reference(:default_status_rejected)
-
- {
- types[I18n.t(:default_type_task)] => [new, in_progress, on_hold, rejected, closed],
- types[I18n.t(:default_type_milestone)] => [new, to_be_scheduled, scheduled, in_progress, on_hold, rejected, closed],
- types[I18n.t(:default_type_phase)] => [new, to_be_scheduled, scheduled, in_progress, on_hold, rejected, closed],
- types[I18n.t(:default_type_feature)] => [new, in_specification, specified, in_progress, developed, in_testing,
- tested, test_failed, on_hold, rejected, closed],
- types[I18n.t(:default_type_epic)] => [new, in_specification, specified, in_progress, developed, in_testing,
- tested, test_failed, on_hold, rejected, closed],
- types[I18n.t(:default_type_user_story)] => [new, in_specification, specified, in_progress, developed, in_testing,
- tested, test_failed, on_hold, rejected, closed],
- types[I18n.t(:default_type_bug)] => [new, confirmed, in_progress, developed, in_testing, tested, test_failed,
- on_hold, rejected, closed]
- }
- end
-
- def type_seeder_class
- ::Standard::BasicData::TypeSeeder
- end
- end
- end
-end
diff --git a/app/seeders/standard/basic_data_seeder.rb b/app/seeders/standard/basic_data_seeder.rb
index 3cfafb695d1..261e6981a58 100644
--- a/app/seeders/standard/basic_data_seeder.rb
+++ b/app/seeders/standard/basic_data_seeder.rb
@@ -35,7 +35,7 @@ module Standard
::BasicData::ActivitySeeder,
::BasicData::ColorSeeder,
::BasicData::ColorSchemeSeeder,
- ::Standard::BasicData::WorkflowSeeder,
+ ::BasicData::WorkflowSeeder,
::BasicData::PrioritySeeder,
::BasicData::SettingSeeder
]
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 11ecc07b1ab..51ad30c8d17 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1270,20 +1270,6 @@ en:
one: "hour"
other: "hours"
- default_color_black: "Black"
- default_color_blue: "Blue"
- default_color_blue_dark: "Blue (dark)"
- default_color_blue_light: "Blue (light)"
- default_color_green_dark: "Green (dark)"
- default_color_green_light: "Green (light)"
- default_color_grey_dark: "Grey (dark)"
- default_color_grey_light: "Grey (light)"
- default_color_grey: "Grey"
- default_color_magenta: "Magenta"
- default_color_orange: "Orange"
- default_color_red: "Red"
- default_color_white: "White"
- default_color_yellow: "Yellow"
default_role_anonymous: "Anonymous"
default_role_developer: "Developer"
default_role_project_admin: "Project admin"
@@ -1291,14 +1277,6 @@ en:
default_role_non_member: "Non member"
default_role_reader: "Reader"
default_role_member: "Member"
- default_type_bug: "Bug"
- default_type_deliverable: "Deliverable"
- default_type_epic: "Epic"
- default_type_feature: "Feature"
- default_type_milestone: "Milestone"
- default_type_phase: "Phase"
- default_type_task: "Task"
- default_type_user_story: "User story"
description_active: "Active?"
description_attachment_toggle: "Show/Hide attachments"
diff --git a/modules/backlogs/app/seeders/basic_data/backlogs/setting_seeder.rb b/modules/backlogs/app/seeders/basic_data/backlogs/setting_seeder.rb
index 2d39fd30e9b..f3f4e795b06 100644
--- a/modules/backlogs/app/seeders/basic_data/backlogs/setting_seeder.rb
+++ b/modules/backlogs/app/seeders/basic_data/backlogs/setting_seeder.rb
@@ -29,6 +29,10 @@
module BasicData
module Backlogs
class SettingSeeder < ::Seeder
+ self.needs = [
+ BasicData::TypeSeeder
+ ]
+
def seed_data!
backlogs_init_setting!
end
@@ -37,50 +41,37 @@ module BasicData
not backlogs_configured?
end
- module Functions
- module_function
-
- def backlogs_init_setting!
- Setting[backlogs_setting_name] = backlogs_setting_value
- end
-
- def backlogs_configured?
- setting = Hash(Setting[backlogs_setting_name])
- setting['story_types'].present? && setting['task_type'].present?
- end
-
- def backlogs_setting_name
- 'plugin_openproject_backlogs'
- end
-
- def backlogs_setting_value
- {
- "story_types" => backlogs_types.map(&:id),
- "task_type" => backlogs_task_type.try(:id),
- "points_burn_direction" => "up",
- "wiki_template" => ""
- }
- end
-
- def backlogs_types
- Type.where(name: backlogs_type_names)
- end
+ def backlogs_init_setting!
+ Setting.plugin_openproject_backlogs = backlogs_setting_value
+ end
- def backlogs_type_names
- %i[default_type_feature default_type_epic default_type_user_story default_type_bug]
- .map { |code| I18n.t(code) }
- end
+ def backlogs_configured?
+ backlogs_setting = Hash(Setting.plugin_openproject_backlogs)
+ backlogs_setting['story_types'].present? && backlogs_setting['task_type'].present?
+ end
- def backlogs_task_type
- Type.find_by(name: backlogs_task_type_name)
- end
+ def backlogs_setting_value
+ {
+ "story_types" => backlogs_types.map(&:id),
+ "task_type" => backlogs_task_type.try(:id),
+ "points_burn_direction" => "up",
+ "wiki_template" => ""
+ }
+ end
- def backlogs_task_type_name
- I18n.t(:default_type_task)
- end
+ def backlogs_types
+ type_references = %i[
+ default_type_feature
+ default_type_epic
+ default_type_user_story
+ default_type_bug
+ ]
+ seed_data.find_references(type_references, default: nil).compact
end
- include Functions
+ def backlogs_task_type
+ seed_data.find_reference(:default_type_task)
+ end
end
end
end
diff --git a/modules/bim/app/seeders/bim.yml b/modules/bim/app/seeders/bim.yml
index 4f76fddb4a7..571a215a1cb 100644
--- a/modules/bim/app/seeders/bim.yml
+++ b/modules/bim/app/seeders/bim.yml
@@ -70,6 +70,90 @@ time_entry_activities:
- t_name: Other
position: 3
+types:
+- reference: :default_type_task
+ t_name: Task
+ is_default: true
+ color_name: 'blue-6'
+ is_in_roadmap: true
+ position: 1
+- reference: :default_type_milestone
+ t_name: Milestone
+ is_default: true
+ color_name: 'orange-6'
+ is_milestone: true
+ position: 2
+- reference: :default_type_phase
+ t_name: Phase
+ is_default: true
+ color_name: :default_color_grey
+ position: 3
+- reference: :default_type_issue
+ t_name: Issue
+ is_default: true
+ color_name: 'indigo-7'
+ is_in_roadmap: true
+ position: 4
+- reference: :default_type_remark
+ t_name: Remark
+ is_default: true
+ color_name: :default_color_green_dark
+ is_in_roadmap: true
+ position: 5
+- reference: :default_type_request
+ t_name: Request
+ is_default: true
+ color_name: 'cyan-7'
+ is_in_roadmap: true
+ position: 6
+- reference: :default_type_clash
+ t_name: Clash
+ is_default: true
+ color_name: 'red-8'
+ is_in_roadmap: true
+ position: 7
+
+workflows:
+- type: :default_type_task
+ statuses:
+ - :default_status_new
+ - :default_status_in_progress
+ - :default_status_closed
+- type: :default_type_milestone
+ statuses:
+ - :default_status_new
+ - :default_status_in_progress
+ - :default_status_closed
+- type: :default_type_phase
+ statuses:
+ - :default_status_new
+ - :default_status_in_progress
+ - :default_status_closed
+- type: :default_type_clash
+ statuses:
+ - :default_status_new
+ - :default_status_in_progress
+ - :default_status_resolved
+ - :default_status_closed
+- type: :default_type_issue
+ statuses:
+ - :default_status_new
+ - :default_status_in_progress
+ - :default_status_resolved
+ - :default_status_closed
+- type: :default_type_remark
+ statuses:
+ - :default_status_new
+ - :default_status_in_progress
+ - :default_status_resolved
+ - :default_status_closed
+- type: :default_type_request
+ statuses:
+ - :default_status_new
+ - :default_status_in_progress
+ - :default_status_resolved
+ - :default_status_closed
+
global_queries:
- t_name: "Embedded table: Children"
reference: :global_query__children
@@ -413,7 +497,7 @@ projects:
The next step could be checking out the timetable and adjusting the appointments, by looking at the [Gantt chart]({{opSetting:base_url}}/projects/demo-construction-project/work_packages?query_props=%7B%22c%22%3A%5B%22id%22%2C%22subject%22%2C%22startDate%22%2C%22dueDate%22%5D%2C%22tv%22%3Atrue%2C%22tzl%22%3A%22weeks%22%2C%22hi%22%3Atrue%2C%22g%22%3A%22%22%2C%22t%22%3A%22startDate%3Aasc%22%2C%22f%22%3A%5B%7B%22n%22%3A%22status%22%2C%22o%22%3A%22o%22%2C%22v%22%3A%5B%5D%7D%5D%2C%22pa%22%3A1%2C%22pp%22%3A100%7D).
:status: :default_status_new
- :type: default_type_milestone
+ :type: :default_type_milestone
:assigned_to: :group__planners
:duration: 1
- :start: 7
@@ -421,7 +505,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:children:
- :start: 7
:t_subject: Gathering first project information
@@ -438,7 +522,7 @@ projects:
* Each need shall represent a task with its corresponding work packages
* Derive the cost estimation and time frame
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__planners
:duration: 4
- :start: 14
@@ -458,7 +542,7 @@ projects:
* This overview informs all participants about the decisions made
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__planners
:duration: 4
:relations:
@@ -470,7 +554,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_milestone
+ :type: :default_type_milestone
:assigned_to: :group__planners
:duration: 1
:relations:
@@ -486,7 +570,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:children:
- :start: 22
:t_subject: Developing first draft
@@ -505,7 +589,7 @@ projects:
* This overview informs all participants about the decisions made
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__planners
:duration: 10
:relations:
@@ -528,7 +612,7 @@ projects:
* This overview informs all participants about the decisions made
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__planners
:duration: 4
:relations:
@@ -542,7 +626,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_milestone
+ :type: :default_type_milestone
:assigned_to: :group__planners
:duration: 1
:relations:
@@ -553,7 +637,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:children:
- :start: 44
:t_subject: Finishing design
@@ -571,7 +655,7 @@ projects:
* The owner is happy with the results
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__planners
:duration: 45
:relations:
@@ -583,7 +667,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_milestone
+ :type: :default_type_milestone
:assigned_to: :group__planners
:duration: 1
:relations:
@@ -595,7 +679,7 @@ projects:
:t_subject: Construction phase
:description: ''
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:children:
- :start: 98
:t_subject: Start constructing
@@ -613,7 +697,7 @@ projects:
* Get the team together
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__planners
:duration: 31
- :start: 130
@@ -630,7 +714,7 @@ projects:
* Setting up the supply chain for the concrete
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__planners
:duration: 25
:relations:
@@ -652,7 +736,7 @@ projects:
* Finishing the roof structure
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__planners
:duration: 46
- :start: 164
@@ -670,7 +754,7 @@ projects:
* Finish the roof
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__planners
:duration: 32
- :start: 178
@@ -687,7 +771,7 @@ projects:
* Electrical installation
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__planners
:duration: 25
- :start: 189
@@ -707,7 +791,7 @@ projects:
* Finishing the facade
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__planners
:duration: 18
- :start: 208
@@ -723,7 +807,7 @@ projects:
* Invite your friends
* Bring some drinks, snacks and your smile
:status: :default_status_new
- :type: default_type_milestone
+ :type: :default_type_milestone
:duration: 1
:relations:
- :to: :final_touches
@@ -882,7 +966,7 @@ projects:
The next step could be to check out the timetable and adjusting the appointments, by looking at the [Gantt chart]({{opSetting:base_url}}/projects/demo-bim-project/work_packages?query_props=%7B%22c%22%3A%5B%22id%22%2C%22subject%22%2C%22startDate%22%2C%22dueDate%22%5D%2C%22tv%22%3Atrue%2C%22tzl%22%3A%22weeks%22%2C%22hi%22%3Atrue%2C%22g%22%3A%22%22%2C%22t%22%3A%22startDate%3Aasc%22%2C%22f%22%3A%5B%7B%22n%22%3A%22status%22%2C%22o%22%3A%22o%22%2C%22v%22%3A%5B%5D%7D%5D%2C%22pa%22%3A1%2C%22pp%22%3A100%7D).
:status: :default_status_new
- :type: default_type_milestone
+ :type: :default_type_milestone
:assigned_to: :group__bim_managers
:duration: 1
- :start: 15
@@ -891,7 +975,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:children:
- :start: 15
:t_subject: Gathering the project specific data and information for the BIM model
@@ -911,7 +995,7 @@ projects:
* A strategy for the delivery phase
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__planners
:duration: 14
:relations:
@@ -932,7 +1016,7 @@ projects:
* To handle the technological interfaces, a software topology will be defined and analyzed and verified
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__lead_bim_coordinators
:duration: 18
:relations:
@@ -944,7 +1028,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_resolved
- :type: default_type_milestone
+ :type: :default_type_milestone
:assigned_to: :group__bim_coordinators
:duration: 1
:relations:
@@ -958,7 +1042,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_milestone
+ :type: :default_type_milestone
:assigned_to: :group__bim_managers
:duration: 1
:relations:
@@ -969,7 +1053,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:children:
- :start: 54
:t_subject: Modelling initial BIM model
@@ -986,7 +1070,7 @@ projects:
* The model shall be modelled according to the LOD Matrices and contain the information needed
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__bim_modellers
:duration: 7
:relations:
@@ -1005,7 +1089,7 @@ projects:
* The model shall be checked, according to the defined standards (conventions, LOD, ...) and revised
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__lead_bim_coordinators
:duration: 2
:relations:
@@ -1017,7 +1101,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_milestone
+ :type: :default_type_milestone
:assigned_to: :group__bim_modellers
:duration: 1
:relations:
@@ -1033,7 +1117,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:children:
- :start: 66
:t_subject: Referencing external BIM models
@@ -1049,7 +1133,7 @@ projects:
* The external model will be referenced in the BIM platform, thus used for modelling the internal model
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__bim_modellers
:duration: 1
:relations:
@@ -1069,7 +1153,7 @@ projects:
* The model will be created according to the BIM execution plan
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__bim_modellers
:duration: 6
:relations:
@@ -1088,7 +1172,7 @@ projects:
* The model shall be checked, according to the defined standards (conventions, LOD, ...) and revised.
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__bim_coordinators
:duration: 1
:relations:
@@ -1100,7 +1184,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_milestone
+ :type: :default_type_milestone
:assigned_to: :group__bim_modellers
:duration: 1
:relations:
@@ -1116,7 +1200,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:children:
- :start: 77
:t_subject: Coordinate the different BIM models
@@ -1132,7 +1216,7 @@ projects:
* The identified model specific issues will be communicated via BCF files
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__bim_coordinators
:duration: 3
- :start: 77
@@ -1140,7 +1224,7 @@ projects:
:reference: :issue_management_first_cycle
:description: ''
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:assigned_to: :group__bim_coordinators
:duration: 4
- :start: 82
@@ -1149,7 +1233,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_milestone
+ :type: :default_type_milestone
:assigned_to: :group__lead_bim_coordinators
:duration: 1
:relations:
@@ -1165,7 +1249,7 @@ projects:
:reference: :modelling_and_coordinating_second_cycle
:t_description: "## Goal\r\n\r\n* ...\r\n\r\n## Description\r\n\r\n* ..."
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:assigned_to: :group__lead_bim_coordinators
:duration: 1
:relations:
@@ -1177,7 +1261,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:assigned_to: :group__lead_bim_coordinators
:duration: 1
:relations:
@@ -1188,7 +1272,7 @@ projects:
:reference: :modelling_and_coordinating_penultimate_cycle
:t_description: "## Goal\r\n\r\n* ...\r\n\r\n## Description\r\n\r\n* ..."
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:assigned_to: :group__lead_bim_coordinators
:duration: 1
:relations:
@@ -1200,7 +1284,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:assigned_to: :group__bim_coordinators
:duration: 1
:relations:
@@ -1212,7 +1296,7 @@ projects:
:t_description: This type is hierarchically a parent of the types &quot;Clash&quot;
and &quot;Request&quot;, thus represents a general note.
:status: :default_status_new
- :type: default_type_milestone
+ :type: :default_type_milestone
:assigned_to: :group__bim_coordinators
:duration: 1
:relations:
@@ -1222,7 +1306,7 @@ projects:
:t_subject: Use model for construction phase
:description: ''
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:children:
- :start: 88
:t_subject: Handover model for construction crew
@@ -1239,7 +1323,7 @@ projects:
* All the objects should have the information needed for the assigned tasks. If not, data enrichment of the model needs to be done
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__bim_coordinators
:duration: 5
- :start: 98
@@ -1257,7 +1341,7 @@ projects:
* The BCF files will be used to assign, track and correct issues
* ...
:status: :default_status_new
- :type: default_type_task
+ :type: :default_type_task
:assigned_to: :group__bim_coordinators
:duration: 101
- :start: 200
@@ -1265,7 +1349,7 @@ projects:
:reference: :finish_construction
:description: ''
:status: :default_status_new
- :type: default_type_milestone
+ :type: :default_type_milestone
:assigned_to: :group__bim_coordinators
:duration: 1
:relations:
@@ -1281,7 +1365,7 @@ projects:
:reference: :issue_management_construction_phase
:description: ''
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:assigned_to: :group__planners
:duration: 88
- :start: 210
@@ -1300,7 +1384,7 @@ projects:
* The model can be used for the operating system of the building
* ...
:status: :default_status_new
- :type: default_type_milestone
+ :type: :default_type_milestone
:assigned_to: :group__lead_bim_coordinators
:duration: 1
:relations:
@@ -1310,7 +1394,7 @@ projects:
:t_subject: Asset Management
:t_description: Enjoy your building :)
:status: :default_status_new
- :type: default_type_phase
+ :type: :default_type_phase
:duration: 1
:relations:
- :to: :handover_for_facility_management
@@ -1341,28 +1425,28 @@ projects:
- :default_type_task
- :default_type_milestone
- :default_type_phase
- - 'bim.default_type_clash'
- - 'bim.default_type_request'
- - 'bim.default_type_issue'
- - 'bim.default_type_remark'
+ - :default_type_clash
+ - :default_type_request
+ - :default_type_issue
+ - :default_type_remark
t_categories:
- Category 1 (to be changed in Project settings)
queries:
- t_name: Issues
status: open
- type: 'bim.default_type_issue'
+ type: :default_type_issue
display_representation: card
- t_name: Clashes
status: open
- type: 'bim.default_type_clash'
+ type: :default_type_clash
display_representation: card
- t_name: Requests
status: open
- type: 'bim.default_type_request'
+ type: :default_type_request
display_representation: card
- t_name: Remarks
status: open
- type: 'bim.default_type_remark'
+ type: :default_type_remark
display_representation: card
- t_name: Project plan
status: open
diff --git a/modules/bim/app/seeders/bim/basic_data/workflow_seeder.rb b/modules/bim/app/seeders/bim/basic_data/workflow_seeder.rb
deleted file mode 100644
index c0a750ef8d6..00000000000
--- a/modules/bim/app/seeders/bim/basic_data/workflow_seeder.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2023 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-module Bim
- module BasicData
- class WorkflowSeeder < ::BasicData::WorkflowSeeder
- def workflows
- types = Type.all
- types = types.map { |t| { t.name => t.id } }.reduce({}, :merge)
-
- new = seed_data.find_reference(:default_status_new)
- in_progress = seed_data.find_reference(:default_status_in_progress)
- closed = seed_data.find_reference(:default_status_closed)
- resolved = seed_data.find_reference(:default_status_resolved)
-
- {
- types[I18n.t(:default_type_task)] => [new, in_progress, closed],
- types[I18n.t(:default_type_milestone)] => [new, in_progress, closed],
- types[I18n.t(:default_type_phase)] => [new, in_progress, closed],
- types[I18n.t('bim.default_type_clash')] => [new, in_progress, resolved, closed],
- types[I18n.t('bim.default_type_issue')] => [new, in_progress, resolved, closed],
- types[I18n.t('bim.default_type_remark')] => [new, in_progress, resolved, closed],
- types[I18n.t('bim.default_type_request')] => [new, in_progress, resolved, closed]
- }
- end
-
- def type_seeder_class
- ::Bim::BasicData::TypeSeeder
- end
- end
- end
-end
diff --git a/modules/bim/app/seeders/bim/basic_data_seeder.rb b/modules/bim/app/seeders/bim/basic_data_seeder.rb
index 8cfd43024c4..f891554242a 100644
--- a/modules/bim/app/seeders/bim/basic_data_seeder.rb
+++ b/modules/bim/app/seeders/bim/basic_data_seeder.rb
@@ -35,7 +35,7 @@ module Bim
::BasicData::ActivitySeeder,
::BasicData::ColorSeeder,
::BasicData::ColorSchemeSeeder,
- ::Bim::BasicData::WorkflowSeeder,
+ ::BasicData::WorkflowSeeder,
::BasicData::PrioritySeeder,
::Bim::BasicData::SettingSeeder,
::Bim::BasicData::ThemeSeeder
diff --git a/modules/bim/config/locales/en.yml b/modules/bim/config/locales/en.yml
index 3157b82cf53..122c880b1a0 100644
--- a/modules/bim/config/locales/en.yml
+++ b/modules/bim/config/locales/en.yml
@@ -3,11 +3,6 @@ en:
bim:
label_bim: 'BIM'
- default_type_clash: Clash
- default_type_issue: Issue
- default_type_remark: Remark
- default_type_request: Request
-
bcf:
label_bcf: 'BCF'
label_imported_failed: 'Failed imports of BCF topics'
diff --git a/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb b/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb
index 20fbc387975..ae689b1c916 100644
--- a/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb
+++ b/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb
@@ -78,6 +78,7 @@ describe RootSeeder,
)
end
+ include_examples 'it creates records', model: Color, expected_count: 144
include_examples 'it creates records', model: DocumentCategory, expected_count: 3
include_examples 'it creates records', model: IssuePriority, expected_count: 4
include_examples 'it creates records', model: Status, expected_count: 4
diff --git a/spec/modules/backlogs/app/seeders/basic_data/backlogs/setting_seeder_spec.rb b/spec/modules/backlogs/app/seeders/basic_data/backlogs/setting_seeder_spec.rb
new file mode 100644
index 00000000000..fdd92247a27
--- /dev/null
+++ b/spec/modules/backlogs/app/seeders/basic_data/backlogs/setting_seeder_spec.rb
@@ -0,0 +1,73 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+require 'spec_helper'
+
+describe BasicData::Backlogs::SettingSeeder do
+ subject(:setting_seeder) { described_class.new(basic_seed_data) }
+
+ context 'with standard edition' do
+ include_context 'with basic seed data', edition: 'standard'
+
+ it 'configures Setting.plugin_openproject_backlogs' do
+ setting_seeder.seed!
+
+ type_feature = basic_seed_data.find_reference(:default_type_feature)
+ type_epic = basic_seed_data.find_reference(:default_type_epic)
+ type_user_story = basic_seed_data.find_reference(:default_type_user_story)
+ type_bug = basic_seed_data.find_reference(:default_type_bug)
+ type_task = basic_seed_data.find_reference(:default_type_task)
+
+ expect(Setting.plugin_openproject_backlogs).to match(
+ "points_burn_direction" => "up",
+ "story_types" => contain_exactly(type_feature.id, type_epic.id, type_user_story.id, type_bug.id),
+ "task_type" => type_task.id,
+ "wiki_template" => ""
+ )
+ end
+ end
+
+ context 'with BIM edition' do
+ include_context 'with basic seed data', edition: 'bim'
+
+ it 'configures Setting.plugin_openproject_backlogs' do
+ setting_seeder.seed!
+
+ type_task = basic_seed_data.find_reference(:default_type_task)
+
+ expect(Setting.plugin_openproject_backlogs).to match(
+ "points_burn_direction" => "up",
+ "story_types" => [],
+ "task_type" => type_task.id,
+ "wiki_template" => ""
+ )
+ end
+ end
+end
diff --git a/spec/seeders/basic_data/type_configuration_seeder_spec.rb b/spec/seeders/basic_data/type_configuration_seeder_spec.rb
new file mode 100644
index 00000000000..7ac2a930c49
--- /dev/null
+++ b/spec/seeders/basic_data/type_configuration_seeder_spec.rb
@@ -0,0 +1,82 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+require 'spec_helper'
+
+RSpec.describe BasicData::TypeConfigurationSeeder do
+ include_context 'with basic seed data', edition: 'bim'
+
+ subject(:seeder) { described_class.new(seed_data) }
+
+ let(:seed_data) { basic_seed_data.merge(Source::SeedData.new(data_hash)) }
+ let(:phase_type) { seed_data.find_reference(:default_type_phase).reload }
+ let(:data_hash) { {} }
+
+ context 'without any form_configuration for the given type' do
+ it 'does not change attribute_groups' do
+ attribute_groups_before = phase_type.attribute_groups.dup
+ seeder.seed!
+ attribute_groups_now = phase_type.attribute_groups
+ expect(attribute_groups_now).to eq(attribute_groups_before)
+ end
+ end
+
+ context 'with a form_configuration entry in type_configuration in seed data' do
+ let(:data_hash) do
+ YAML.load <<~SEEDING_DATA_YAML
+ type_configuration:
+ - type: :default_type_phase
+ form_configuration:
+ - group_name: "Children"
+ query: :query__children
+ - group_name: "Bugs of the week"
+ query: :query__bugs_of_the_week
+ SEEDING_DATA_YAML
+ end
+ let(:query) { create(:query, name: 'Children') }
+ let(:bugs_of_the_week_query) { create(:query, name: 'Bugs of the week') }
+
+ before do
+ seed_data.store_reference(:query__children, query)
+ seed_data.store_reference(:query__bugs_of_the_week, bugs_of_the_week_query)
+ end
+
+ it 'adds the given query groups in the form configuration of the type' do
+ attribute_groups_before = phase_type.attribute_groups.dup
+ seeder.seed!
+ attribute_groups_now = phase_type.attribute_groups
+ expect(attribute_groups_now).not_to eq(attribute_groups_before)
+ expect(attribute_groups_now)
+ .to include(an_instance_of(Type::QueryGroup).and(having_attributes(attributes: query)))
+ expect(attribute_groups_now)
+ .to include(an_instance_of(Type::QueryGroup).and(having_attributes(attributes: bugs_of_the_week_query)))
+ end
+ end
+end
diff --git a/spec/seeders/basic_data/type_seeder_spec.rb b/spec/seeders/basic_data/type_seeder_spec.rb
deleted file mode 100644
index b91d9878d75..00000000000
--- a/spec/seeders/basic_data/type_seeder_spec.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-# frozen_string_literal: true
-
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2023 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-
-require 'spec_helper'
-
-RSpec.describe BasicData::TypeSeeder do
- subject(:seeder) { described_class.new(seed_data) }
-
- let(:phase_type) { create(:type, name: I18n.t(:default_type_phase)) }
- let(:seed_data) { Source::SeedData.new(data_hash) }
-
- before do
- phase_type # create the Phase type
- end
-
- describe '#set_attribute_groups_for_type' do
- let(:data_hash) { {} }
-
- context 'without any form_configuration for the given type' do
- it 'does not change attribute_groups' do
- attribute_groups_before = phase_type.attribute_groups.dup
- seeder.set_attribute_groups_for_type(phase_type)
- attribute_groups_now = phase_type.attribute_groups
- expect(attribute_groups_now).to eq(attribute_groups_before)
- end
- end
-
- context 'with a form_configuration entry in type_configuration in seed data' do
- let(:data_hash) do
- YAML.load <<~SEEDING_DATA_YAML
- type_configuration:
- - type: :default_type_phase
- form_configuration:
- - group_name: "Children"
- query: :query__children
- SEEDING_DATA_YAML
- end
- let(:query) { create(:query) }
-
- before do
- seed_data.store_reference(:query__children, query)
- end
-
- it 'adds a query group in the form configuration of the type' do
- attribute_groups_before = phase_type.attribute_groups.dup
- seeder.set_attribute_groups_for_type(phase_type)
- attribute_groups_now = phase_type.attribute_groups
- expect(attribute_groups_now).not_to eq(attribute_groups_before)
- expect(attribute_groups_now)
- .to include(an_instance_of(Type::QueryGroup).and(having_attributes(attributes: query)))
- end
- end
- end
-end
diff --git a/spec/seeders/demo_data/project_seeder_spec.rb b/spec/seeders/demo_data/project_seeder_spec.rb
index 22a234ebb15..ba7b32ab3b2 100644
--- a/spec/seeders/demo_data/project_seeder_spec.rb
+++ b/spec/seeders/demo_data/project_seeder_spec.rb
@@ -33,9 +33,15 @@ require 'spec_helper'
RSpec.describe DemoData::ProjectSeeder do
include_context 'with basic seed data'
- subject(:project_seeder) { described_class.new(seed_data) }
+ subject(:project_seeder) { described_class.new(seed_data.lookup('projects.my-project')) }
- let(:seed_data) { basic_seed_data.merge(Source::SeedData.new(project_data)) }
+ let(:seed_data) do
+ basic_seed_data.merge(Source::SeedData.new(
+ 'projects' => {
+ 'my-project' => project_data
+ }
+ ))
+ end
let(:project_data) { project_data_with_a_version }
let(:project_data_with_a_version) do
{
@@ -92,7 +98,7 @@ RSpec.describe DemoData::ProjectSeeder do
{
'subject' => 'Some work package',
'status' => :default_status_new,
- 'type' => 'default_type_task',
+ 'type' => :default_type_task,
'version' => :product_backlog
}
]
diff --git a/spec/seeders/demo_data/work_package_seeder_spec.rb b/spec/seeders/demo_data/work_package_seeder_spec.rb
index 5020d36b665..16f4cd74c98 100644
--- a/spec/seeders/demo_data/work_package_seeder_spec.rb
+++ b/spec/seeders/demo_data/work_package_seeder_spec.rb
@@ -44,7 +44,7 @@ describe DemoData::WorkPackageSeeder do
start: 0,
subject: "Some subject",
status: :default_status_new,
- type: "default_type_task"
+ type: :default_type_task
}.merge(attributes).deep_stringify_keys
end
diff --git a/spec/seeders/root_seeder_standard_edition_spec.rb b/spec/seeders/root_seeder_standard_edition_spec.rb
index 42dc46d1587..7ab8cbe9e32 100644
--- a/spec/seeders/root_seeder_standard_edition_spec.rb
+++ b/spec/seeders/root_seeder_standard_edition_spec.rb
@@ -78,6 +78,7 @@ describe RootSeeder,
)
end
+ include_examples 'it creates records', model: Color, expected_count: 144
include_examples 'it creates records', model: DocumentCategory, expected_count: 3
include_examples 'it creates records', model: IssuePriority, expected_count: 4
include_examples 'it creates records', model: Status, expected_count: 14