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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
enable filtering on the life cycle page
ulfertsec5e6b562584
diff --git a/app/components/projects/settings/life_cycles/index_component.html.erb b/app/components/projects/settings/life_cycles/index_component.html.erbindex 60feef7d20e..d53638d5554 100644--- a/app/components/projects/settings/life_cycles/index_component.html.erb+++ b/app/components/projects/settings/life_cycles/index_component.html.erb@@ -1,56 +1,77 @@<%=- component_wrapper do- render(border_box_container(mb: 3, data: { test_selector: "project-life-cycle-administration" })) do |component|- component.with_header(font_weight: :bold, py: 2) do- flex_layout(justify_content: :space_between, align_items: :center) do |header_container|- header_container.with_column(py: 2) do- # adding py: 2 here to match the padding of the actions_container- # otherwise the header height changes when the actions gets hidden when filtering- render(Primer::Beta::Text.new(font_weight: :bold)) do- I18n.t('projects.settings.life_cycle.section_header')- end- end- header_container.with_column(flex_layout: true, justify_content: :flex_end) do |actions_container|- actions_container.with_column(data: { 'projects--settings--project-custom-fields-mapping-filter-target': 'bulkActionContainer' }) do- render(Primer::Beta::Button.new(- tag: :a,- href: enable_all_project_settings_life_cycle_path(project_id: project),- scheme: :invisible,- font_weight: :bold,- color: :subtle,- 'aria-label': t('projects.settings.actions.label_enable_all'),- data: { 'turbo-method': :post, 'turbo': true, test_selector: "enable-all-life-cycle-steps" }- )) do |button|- button.with_leading_visual_icon(icon: 'check-circle', color: :subtle)- t('projects.settings.actions.label_enable_all')+ flex_layout(data: wrapper_data_attributes) do |flex|+ flex.with_row do+ render(Primer::OpenProject::SubHeader.new) do |subheader|+ subheader.with_filter_input(name: "border-box-filter",+ label: t('projects.settings.life_cycle.filter.label'),+ visually_hide_label: true,+ placeholder: t('projects.settings.life_cycle.filter.label'),+ leading_visual: {+ icon: :search,+ size: :small+ },+ show_clear_button: true,+ clear_button_id: clear_button_id,+ data: {+ action: "input->projects--settings--border-box-filter#filterLists",+ "projects--settings--border-box-filter-target": "filter"+ })+ end+ end++ flex.with_row do+ render(border_box_container(mb: 3, data: { test_selector: "project-life-cycle-administration" })) do |component|+ component.with_header(font_weight: :bold, py: 2) do+ flex_layout(justify_content: :space_between, align_items: :center) do |header_container|+ header_container.with_column(py: 2) do+ # adding py: 2 here to match the padding of the actions_container+ # otherwise the header height changes when the actions gets hidden when filtering+ render(Primer::Beta::Text.new(font_weight: :bold)) do+ I18n.t('projects.settings.life_cycle.section_header')endend- actions_container.with_column(data: { 'projects--settings--project-custom-fields-mapping-filter-target': 'bulkActionContainer' }) do- render(Primer::Beta::Button.new(- tag: :a,- href: disable_all_project_settings_life_cycle_path(project_id: project),- scheme: :invisible,- font_weight: :bold,- color: :subtle,- 'aria-label': t('projects.settings.actions.label_disable_all'),- data: { 'turbo-method': :post, 'turbo': true, test_selector: "disable-all-life-cycle-steps" }- )) do |button|- button.with_leading_visual_icon(icon: 'x-circle', color: :subtle)- t('projects.settings.actions.label_disable_all')+ header_container.with_column(flex_layout: true, justify_content: :flex_end) do |actions_container|+ actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'bulkActionContainer' }) do+ render(Primer::Beta::Button.new(+ tag: :a,+ href: enable_all_project_settings_life_cycle_path(project_id: project),+ scheme: :invisible,+ font_weight: :bold,+ color: :subtle,+ 'aria-label': t('projects.settings.actions.label_enable_all'),+ data: { 'turbo-method': :post, 'turbo': true, test_selector: "enable-all-life-cycle-steps" }+ )) do |button|+ button.with_leading_visual_icon(icon: 'check-circle', color: :subtle)+ t('projects.settings.actions.label_enable_all')+ end+ end+ actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'bulkActionContainer' }) do+ render(Primer::Beta::Button.new(+ tag: :a,+ href: disable_all_project_settings_life_cycle_path(project_id: project),+ scheme: :invisible,+ font_weight: :bold,+ color: :subtle,+ 'aria-label': t('projects.settings.actions.label_disable_all'),+ data: { 'turbo-method': :post, 'turbo': true, test_selector: "disable-all-life-cycle-steps" }+ )) do |button|+ button.with_leading_visual_icon(icon: 'x-circle', color: :subtle)+ t('projects.settings.actions.label_disable_all')+ endendendendend- end- if life_cycle_definitions.empty?- component.with_row do- render(Primer::Beta::Text.new(color: :subtle)) { t("projects.settings.life_cycle.non_defined") }- end- else- life_cycle_definitions.each do |definition|- component.with_row(data: { 'projects--settings--project-custom-fields-mapping-filter-target': 'searchItem' },- test_selector: "project-life-cycle-step-#{definition.id}") do- render(Projects::Settings::LifeCycles::StepComponent.new(project:, definition:))+ if life_cycle_definitions.empty?+ component.with_row do+ render(Primer::Beta::Text.new(color: :subtle)) { t("projects.settings.life_cycle.non_defined") }+ end+ else+ life_cycle_definitions.each do |definition|+ component.with_row(data: { 'projects--settings--border-box-filter-target': 'searchItem' },+ test_selector: "project-life-cycle-step-#{definition.id}") do+ render(Projects::Settings::LifeCycles::StepComponent.new(project:, definition:))+ endendendenddiff --git a/app/components/projects/settings/life_cycles/index_component.rb b/app/components/projects/settings/life_cycles/index_component.rbindex 059b750e167..654f1b70f65 100644--- a/app/components/projects/settings/life_cycles/index_component.rb+++ b/app/components/projects/settings/life_cycles/index_component.rb@@ -46,9 +46,16 @@ module Projectsprivate- # TODO: Check if this is necessary- def wrapper_uniq_by- @project.id+ def wrapper_data_attributes+ {+ controller: "projects--settings--border-box-filter",+ "application-target": "dynamic",+ "projects--settings--border-box-filter-clear-button-id-value": clear_button_id+ }+ end++ def clear_button_id+ "border-box-filter-clear-button"endendenddiff --git a/app/components/projects/settings/project_custom_field_sections/index_component.html.erb b/app/components/projects/settings/project_custom_field_sections/index_component.html.erbindex b4044ee9966..f54e78c9f20 100644--- a/app/components/projects/settings/project_custom_field_sections/index_component.html.erb+++ b/app/components/projects/settings/project_custom_field_sections/index_component.html.erb@@ -3,7 +3,7 @@flex_layout do |flex|flex.with_row dorender(Primer::OpenProject::SubHeader.new) do |subheader|- subheader.with_filter_input(name: "project-custom-fields-mapping-filter",+ subheader.with_filter_input(name: "border-box-filter",label: t('projects.settings.project_custom_fields.filter.label'),visually_hide_label: true,placeholder: t('projects.settings.project_custom_fields.filter.label'),@@ -14,8 +14,8 @@show_clear_button: true,clear_button_id: clear_button_id,data: {- action: "input->projects--settings--project-custom-fields-mapping-filter#filterLists",- "projects--settings--project-custom-fields-mapping-filter-target": "filter"+ action: "input->projects--settings--border-box-filter#filterLists",+ "projects--settings--border-box-filter-target": "filter"})endenddiff --git a/app/components/projects/settings/project_custom_field_sections/index_component.rb b/app/components/projects/settings/project_custom_field_sections/index_component.rbindex 25b8a86e8b7..b405aa381d3 100644--- a/app/components/projects/settings/project_custom_field_sections/index_component.rb+++ b/app/components/projects/settings/project_custom_field_sections/index_component.rb@@ -45,14 +45,14 @@ module Projectsdef wrapper_data_attributes{- controller: "projects--settings--project-custom-fields-mapping-filter",+ controller: "projects--settings--border-box-filter","application-target": "dynamic",- "projects--settings--project-custom-fields-mapping-filter-clear-button-id-value": clear_button_id+ "projects--settings--border-box-filter-clear-button-id-value": clear_button_id}enddef clear_button_id- "project-custom-fields-mapping-filter-clear-button"+ "border-box-filter-clear-button"endendenddiff --git a/app/components/projects/settings/project_custom_field_sections/show_component.html.erb b/app/components/projects/settings/project_custom_field_sections/show_component.html.erbindex 66b42dfbcbb..f2c5ee4e3a7 100644--- a/app/components/projects/settings/project_custom_field_sections/show_component.html.erb+++ b/app/components/projects/settings/project_custom_field_sections/show_component.html.erb@@ -13,7 +13,7 @@endendsection_header_container.with_column(flex_layout: true, justify_content: :flex_end) do |actions_container|- actions_container.with_column(data: { 'projects--settings--project-custom-fields-mapping-filter-target': 'bulkActionContainer' }) do+ actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'bulkActionContainer' }) dorender(Primer::Beta::Button.new(tag: :a,href: enable_all_of_section_project_settings_project_custom_fields_path(@@ -32,7 +32,7 @@t('projects.settings.actions.label_enable_all')endend- actions_container.with_column(data: { 'projects--settings--project-custom-fields-mapping-filter-target': 'bulkActionContainer' }) do+ actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'bulkActionContainer' }) dorender(Primer::Beta::Button.new(tag: :a,href: disable_all_of_section_project_settings_project_custom_fields_path(@@ -60,7 +60,7 @@endelse@project_custom_fields.each do |project_custom_field|- component.with_row(data: { 'projects--settings--project-custom-fields-mapping-filter-target': 'searchItem' }) do+ component.with_row(data: { 'projects--settings--border-box-filter-target': 'searchItem' }) dorender(Projects::Settings::ProjectCustomFieldSections::CustomFieldRowComponent.new(project: @project,project_custom_field:,diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 0f5983e71bc..d661b1f94c4 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -399,6 +399,8 @@ en:section_header: "Stages and gates"step:use_in_project: "Use %{step} in this project"+ filter:+ label: "Search project stage or gate"project_custom_fields:header:title: "Project attributes"diff --git a/frontend/src/stimulus/controllers/dynamic/projects/settings/project-custom-fields-mapping-filter.controller.ts b/frontend/src/stimulus/controllers/dynamic/projects/settings/border-box-filter.controller.tssimilarity index 100%rename from frontend/src/stimulus/controllers/dynamic/projects/settings/project-custom-fields-mapping-filter.controller.tsrename to frontend/src/stimulus/controllers/dynamic/projects/settings/border-box-filter.controller.tsdiff --git a/spec/features/projects/life_cycle/active_in_project_spec.rb b/spec/features/projects/life_cycle/active_in_project_spec.rbindex a098d75e520..ac1b59d45df 100644--- a/spec/features/projects/life_cycle/active_in_project_spec.rb+++ b/spec/features/projects/life_cycle/active_in_project_spec.rb@@ -51,7 +51,7 @@ RSpec.describe "Projects life cycle settings", :js, :with_cuprite, with_flag: {context "with sufficient permissions" docurrent_user { user_with_permission }- it "allows toggling the active/inactive state of lifecycle steps" do+ it "allows toggling the active/inactive state of lifecycle steps and filtering them" doproject_life_cycle_page.visit!project_life_cycle_page.expect_listed(initiating_stage => false,@@ -106,6 +106,12 @@ RSpec.describe "Projects life cycle settings", :js, :with_cuprite, with_flag: {executing_stage => true,ready_to_close_gate => true,closing_stage => true)++ # The user can filter the life cycle steps+ project_life_cycle_page.filter_by("Clo")++ project_life_cycle_page.expect_listed(ready_to_close_gate => true,+ closing_stage => true)endendenddiff --git a/spec/features/projects/project_custom_fields/settings/mapping_spec.rb b/spec/features/projects/project_custom_fields/settings/mapping_spec.rbindex f94c13871ee..3cc245f6fb6 100644--- a/spec/features/projects/project_custom_fields/settings/mapping_spec.rb+++ b/spec/features/projects/project_custom_fields/settings/mapping_spec.rb@@ -260,7 +260,7 @@ RSpec.describe "Projects custom fields mapping via project settings", :js, :withit "filters the project custom fields by name with given user input" dovisit project_settings_project_custom_fields_path(project)- fill_in "project-custom-fields-mapping-filter", with: "Boolean"+ fill_in "border-box-filter", with: "Boolean"within_custom_field_section_container(section_for_input_fields) doexpect(page).to have_content("Boolean field")diff --git a/spec/support/pages/projects/settings/life_cycle.rb b/spec/support/pages/projects/settings/life_cycle.rbindex 3f6572c123f..cb325e64bdf 100644--- a/spec/support/pages/projects/settings/life_cycle.rb+++ b/spec/support/pages/projects/settings/life_cycle.rb@@ -87,6 +87,10 @@ module Pagesfind_test_selector("toggle-project-life-cycle-#{definition.id}")end+ def filter_by(filter)+ fill_in I18n.t("projects.settings.life_cycle.filter.label"), with: filter+ end+def expected_toggle_status(active)active ? "On" : "Off"end