Skip to content

Commit 09b10aa

Browse files
authored
Merge pull request #17358 from opf/feature/58161-global-stage-administration
Feature/58161 global stage administration
2 parents 3ca7847 + 63ecbe0 commit 09b10aa

File tree

45 files changed

+1400
-71
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1400
-71
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ group :test do
278278
gem "capybara_accessible_selectors", git: "https://github.com/citizensadvice/capybara_accessible_selectors", tag: "v0.12.0"
279279
gem "capybara-screenshot", "~> 1.0.17"
280280
gem "cuprite", "~> 0.15.0"
281+
gem "ferrum", github: "toy/ferrum", ref: "mouse-events-buttons-property-0.15"
281282
gem "rspec-wait"
282283
gem "selenium-devtools"
283284
gem "selenium-webdriver", "~> 4.20"

Gemfile.lock

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ GIT
5858
parallel_tests (>= 3.3.0, < 5)
5959
rspec (>= 3.10)
6060

61+
GIT
62+
remote: https://github.com/toy/ferrum.git
63+
revision: 889b29926f017530a0e087b1db0bc02747e437b1
64+
ref: mouse-events-buttons-property-0.15
65+
specs:
66+
ferrum (0.15)
67+
addressable (~> 2.5)
68+
concurrent-ruby (~> 1.1)
69+
webrick (~> 1.7)
70+
websocket-driver (~> 0.7)
71+
6172
PATH
6273
remote: modules/auth_plugins
6374
specs:
@@ -558,11 +569,6 @@ GEM
558569
faraday-net_http (3.4.0)
559570
net-http (>= 0.5.0)
560571
fastimage (2.3.1)
561-
ferrum (0.15)
562-
addressable (~> 2.5)
563-
concurrent-ruby (~> 1.1)
564-
webrick (~> 1.7)
565-
websocket-driver (~> 0.7)
566572
ffi (1.17.1)
567573
flamegraph (0.9.5)
568574
fog-aws (3.30.0)
@@ -1255,6 +1261,7 @@ DEPENDENCIES
12551261
escape_utils (~> 1.3)
12561262
factory_bot (~> 6.5.0)
12571263
factory_bot_rails (~> 6.4.4)
1264+
ferrum!
12581265
ffi (~> 1.15)
12591266
flamegraph
12601267
fog-aws

app/components/projects/settings/life_cycle_steps/index_component.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
end
3232
end
3333
header_container.with_column(flex_layout: true, justify_content: :flex_end) do |actions_container|
34-
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'bulkActionContainer' }) do
34+
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'hideWhenFiltering' }) do
3535
render(Primer::Beta::Button.new(
3636
tag: :a,
3737
href: enable_all_project_settings_life_cycle_steps_path(project_id: project),
@@ -45,7 +45,7 @@
4545
t('projects.settings.actions.label_enable_all')
4646
end
4747
end
48-
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'bulkActionContainer' }) do
48+
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'hideWhenFiltering' }) do
4949
render(Primer::Beta::Button.new(
5050
tag: :a,
5151
href: disable_all_project_settings_life_cycle_steps_path(project_id: project),

app/components/projects/settings/life_cycle_steps/step_component.html.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<%=
22
flex_layout(align_items: :center,
33
justify_content: :space_between) do |step_container|
4-
step_container.with_column(flex_layout: true) do |title_container|
5-
title_container.with_column(pt: 1, mr: 3) do
4+
step_container.with_column(flex_layout: true, mr: 2, classes: "min-width-0") do |title_container|
5+
title_container.with_column(pt: 1, mr: 3, classes: "ellipsis") do
66
render(Primer::Beta::Text.new(classes: 'filter-target-visible-text')) { definition.name }
77
end
8-
title_container.with_column(pt: 1) do
8+
title_container.with_column(pt: 1, classes: "no-wrap") do
99
render(Projects::LifeCycleTypeComponent.new(definition))
1010
end
1111
end

app/components/projects/settings/project_custom_field_sections/show_component.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
end
1414
end
1515
section_header_container.with_column(flex_layout: true, justify_content: :flex_end) do |actions_container|
16-
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'bulkActionContainer' }) do
16+
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'hideWhenFiltering' }) do
1717
render(Primer::Beta::Button.new(
1818
tag: :a,
1919
href: enable_all_of_section_project_settings_project_custom_fields_path(
@@ -32,7 +32,7 @@
3232
t('projects.settings.actions.label_enable_all')
3333
end
3434
end
35-
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'bulkActionContainer' }) do
35+
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'hideWhenFiltering' }) do
3636
render(Primer::Beta::Button.new(
3737
tag: :a,
3838
href: disable_all_of_section_project_settings_project_custom_fields_path(
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<%#-- copyright
2+
OpenProject is an open source project management software.
3+
Copyright (C) the OpenProject GmbH
4+
5+
This program is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU General Public License version 3.
7+
8+
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
9+
Copyright (C) 2006-2013 Jean-Philippe Lang
10+
Copyright (C) 2010-2013 the ChiliProject Team
11+
12+
This program is free software; you can redistribute it and/or
13+
modify it under the terms of the GNU General Public License
14+
as published by the Free Software Foundation; either version 2
15+
of the License, or (at your option) any later version.
16+
17+
This program is distributed in the hope that it will be useful,
18+
but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
GNU General Public License for more details.
21+
22+
You should have received a copy of the GNU General Public License
23+
along with this program; if not, write to the Free Software
24+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25+
26+
See COPYRIGHT and LICENSE files for more details.
27+
28+
++#%>
29+
30+
<%= render Primer::OpenProject::PageHeader.new do |header|
31+
header.with_title { t("settings.project_life_cycle_step_definitions.#{heading_scope}.heading") }
32+
header.with_description { t("settings.project_life_cycle_step_definitions.new.description") }
33+
header.with_breadcrumbs(breadcrumbs_items)
34+
end %>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# frozen_string_literal: true
2+
3+
#-- copyright
4+
# OpenProject is an open source project management software.
5+
# Copyright (C) the OpenProject GmbH
6+
#
7+
# This program is free software; you can redistribute it and/or
8+
# modify it under the terms of the GNU General Public License version 3.
9+
#
10+
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
11+
# Copyright (C) 2006-2013 Jean-Philippe Lang
12+
# Copyright (C) 2010-2013 the ChiliProject Team
13+
#
14+
# This program is free software; you can redistribute it and/or
15+
# modify it under the terms of the GNU General Public License
16+
# as published by the Free Software Foundation; either version 2
17+
# of the License, or (at your option) any later version.
18+
#
19+
# This program is distributed in the hope that it will be useful,
20+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
# GNU General Public License for more details.
23+
#
24+
# You should have received a copy of the GNU General Public License
25+
# along with this program; if not, write to the Free Software
26+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27+
#
28+
# See COPYRIGHT and LICENSE files for more details.
29+
#++
30+
31+
module Settings
32+
module ProjectLifeCycleStepDefinitions
33+
class FormHeaderComponent < ApplicationComponent
34+
options :heading_scope
35+
36+
def breadcrumbs_items
37+
[
38+
{
39+
href: admin_index_path,
40+
text: t("label_administration")
41+
},
42+
{
43+
href: admin_settings_project_custom_fields_path,
44+
text: t("label_project_plural")
45+
},
46+
{
47+
href: admin_settings_project_life_cycle_step_definitions_path,
48+
text: t("settings.project_life_cycle_step_definitions.heading")
49+
},
50+
t("settings.project_life_cycle_step_definitions.#{heading_scope}.heading")
51+
]
52+
end
53+
end
54+
end
55+
end
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<%#-- copyright
2+
OpenProject is an open source project management software.
3+
Copyright (C) the OpenProject GmbH
4+
5+
This program is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU General Public License version 3.
7+
8+
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
9+
Copyright (C) 2006-2013 Jean-Philippe Lang
10+
Copyright (C) 2010-2013 the ChiliProject Team
11+
12+
This program is free software; you can redistribute it and/or
13+
modify it under the terms of the GNU General Public License
14+
as published by the Free Software Foundation; either version 2
15+
of the License, or (at your option) any later version.
16+
17+
This program is distributed in the hope that it will be useful,
18+
but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
GNU General Public License for more details.
21+
22+
You should have received a copy of the GNU General Public License
23+
along with this program; if not, write to the Free Software
24+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25+
26+
See COPYRIGHT and LICENSE files for more details.
27+
28+
++#%>
29+
30+
<%=
31+
component_wrapper do
32+
flex_layout(data: wrapper_data_attributes) do |flex|
33+
flex.with_row do
34+
if allowed_to_customize_life_cycle?
35+
render(Primer::OpenProject::SubHeader.new) do |subheader|
36+
subheader.with_filter_input(
37+
name: "border-box-filter",
38+
label: t("settings.project_life_cycle_step_definitions.filter.label"),
39+
visually_hide_label: true,
40+
placeholder: t("settings.project_life_cycle_step_definitions.filter.label"),
41+
leading_visual: {
42+
icon: :search,
43+
size: :small
44+
},
45+
show_clear_button: true,
46+
data: {
47+
action: "input->projects--settings--border-box-filter#filterLists",
48+
"projects--settings--border-box-filter-target": "filter"
49+
}
50+
)
51+
subheader.with_action_component do
52+
render(Primer::Alpha::ActionMenu.new(
53+
anchor_align: :end)
54+
) do |menu|
55+
menu.with_show_button(
56+
scheme: :primary,
57+
aria: { label: I18n.t("settings.project_life_cycle_step_definitions.label_add_description") },
58+
) do |button|
59+
button.with_leading_visual_icon(icon: :plus)
60+
button.with_trailing_action_icon(icon: :"triangle-down")
61+
I18n.t("settings.project_life_cycle_step_definitions.label_add")
62+
end
63+
64+
menu.with_item(
65+
label: I18n.t("settings.project_life_cycle_step_definitions.label_add_stage"),
66+
href: new_stage_admin_settings_project_life_cycle_step_definitions_path
67+
) do |item|
68+
item.with_leading_visual_icon(icon: "git-commit")
69+
end
70+
71+
menu.with_item(
72+
label: I18n.t("settings.project_life_cycle_step_definitions.label_add_gate"),
73+
href: new_gate_admin_settings_project_life_cycle_step_definitions_path
74+
) do |item|
75+
item.with_leading_visual_icon(icon: "diamond")
76+
end
77+
end
78+
end
79+
end
80+
else
81+
render EnterpriseEdition::BannerComponent.new(:customize_life_cycle, mb: 3)
82+
end
83+
end
84+
85+
flex.with_row do
86+
render(border_box_container(mb: 3, data: drop_target_config)) do |component|
87+
component.with_header(font_weight: :bold, py: 2) do
88+
flex_layout(justify_content: :space_between, align_items: :center) do |header_container|
89+
header_container.with_column do
90+
render(Primer::Beta::Text.new(font_weight: :bold)) do
91+
I18n.t("settings.project_life_cycle_step_definitions.section_header")
92+
end
93+
end
94+
end
95+
end
96+
if definitions.empty?
97+
component.with_row do
98+
render(Primer::Beta::Text.new(color: :subtle)) do
99+
t("settings.project_life_cycle_step_definitions.non_defined")
100+
end
101+
end
102+
else
103+
definitions.each do |definition|
104+
component.with_row(
105+
data: {
106+
"projects--settings--border-box-filter-target": "searchItem",
107+
test_selector: "project-life-cycle-step-definition",
108+
**draggable_item_config(definition)
109+
}
110+
) do
111+
render(Settings::ProjectLifeCycleStepDefinitions::RowComponent.new(
112+
definition,
113+
first?: definition == definitions.first,
114+
last?: definition == definitions.last,
115+
))
116+
end
117+
end
118+
end
119+
end
120+
end
121+
flex.with_row(display: :none, data: { "projects--settings--border-box-filter-target": "noResultsText" }) do
122+
render Primer::Beta::Text.new do
123+
I18n.t("js.autocompleter.notFoundText")
124+
end
125+
end
126+
end
127+
end
128+
%>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# frozen_string_literal: true
2+
3+
#-- copyright
4+
# OpenProject is an open source project management software.
5+
# Copyright (C) the OpenProject GmbH
6+
#
7+
# This program is free software; you can redistribute it and/or
8+
# modify it under the terms of the GNU General Public License version 3.
9+
#
10+
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
11+
# Copyright (C) 2006-2013 Jean-Philippe Lang
12+
# Copyright (C) 2010-2013 the ChiliProject Team
13+
#
14+
# This program is free software; you can redistribute it and/or
15+
# modify it under the terms of the GNU General Public License
16+
# as published by the Free Software Foundation; either version 2
17+
# of the License, or (at your option) any later version.
18+
#
19+
# This program is distributed in the hope that it will be useful,
20+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
# GNU General Public License for more details.
23+
#
24+
# You should have received a copy of the GNU General Public License
25+
# along with this program; if not, write to the Free Software
26+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27+
#
28+
# See COPYRIGHT and LICENSE files for more details.
29+
#++
30+
31+
module Settings
32+
module ProjectLifeCycleStepDefinitions
33+
class IndexComponent < ApplicationComponent
34+
include OpPrimer::ComponentHelpers
35+
include OpTurbo::Streamable
36+
include Projects::LifeCycleDefinitionHelper
37+
38+
options :definitions
39+
40+
private
41+
42+
def wrapper_data_attributes
43+
{
44+
controller: "projects--settings--border-box-filter generic-drag-and-drop",
45+
"application-target": "dynamic"
46+
}
47+
end
48+
49+
def drop_target_config
50+
{
51+
"is-drag-and-drop-target": true,
52+
"target-container-accessor": "& > ul",
53+
"target-allowed-drag-type": "life-cycle-step-definition"
54+
}
55+
end
56+
57+
def draggable_item_config(definition)
58+
{
59+
"draggable-type": "life-cycle-step-definition",
60+
"drop-url": drop_admin_settings_project_life_cycle_step_definition_path(definition)
61+
}
62+
end
63+
end
64+
end
65+
end

0 commit comments

Comments
 (0)