Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/58161 global stage administration #17358

Draft
wants to merge 30 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1e40865
[#58161] Global stage administration
toy Dec 4, 2024
10631f8
add menu entry
toy Dec 4, 2024
13fd59c
make life cycle step definitions default to order by position
toy Dec 4, 2024
fcd1ce5
comment out validation that Project::LifeCycleStepDefinition is not i…
toy Dec 9, 2024
a6f2be8
routing
toy Dec 11, 2024
d948c66
index header
toy Dec 4, 2024
4bb9ddc
add form and new/edit actions
toy Dec 11, 2024
241a82f
Project::LifeCycleStepDefinition.with_project_count
toy Dec 11, 2024
25c94be
basic index - list definitions
toy Dec 11, 2024
1a2d87f
show project count in index
toy Dec 12, 2024
dcfcc63
lowercase project.count to use consistent case in custom fields and s…
toy Dec 12, 2024
8256805
cleanup row component
toy Dec 12, 2024
919aede
add menu, handle moving and destroying
toy Dec 12, 2024
ff984e1
{,row-,column-}gap-? classes
toy Dec 12, 2024
0212097
handle drag-n-drop ordering, except for expected turbo stream response
toy Dec 12, 2024
30594a1
simplify ApplicationRecord.most_recently_changed
toy Dec 13, 2024
d046a49
highlight_css_updated_at should depend on Project::LifeCycleStepDefin…
toy Dec 13, 2024
1ec795a
rename border box filter bulkActionContainer target to hideWhenFiltering
toy Dec 13, 2024
6ddeb94
hide movement controls when filtering
toy Dec 13, 2024
7dad52a
require enterprise token
toy Dec 13, 2024
f5edda0
combine subheaders with filter and buttons
toy Dec 16, 2024
4903ac1
fix title for form
toy Dec 16, 2024
0bce455
handle responses for destroy/move/drop using turbo streams
toy Dec 16, 2024
192911d
add missing .html extension to flash_component
toy Dec 16, 2024
51d6c17
remove container of flash message after it is closed, so that it does…
toy Dec 17, 2024
77a7c75
no need for global error messages for life cycle step definition form
toy Dec 17, 2024
42ddae4
move allowed_to_customize_life_cycle? to a module
toy Dec 17, 2024
6351d4a
make both life cycle project settings and definitions list behave whe…
toy Dec 17, 2024
6cfdddf
change heading description
toy Dec 17, 2024
d66c408
add unique constraint for life cycle step definition name
toy Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/components/op_primer/flash_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def initialize(**system_arguments)
system_arguments[:test_selector] ||= "op-primer-flash-message"
system_arguments[:dismiss_scheme] ||= :remove
system_arguments[:dismiss_label] ||= I18n.t(:button_close)
system_arguments[:data] ||= {}
system_arguments[:data]["flash-target"] = "flash"

@autohide = system_arguments[:scheme] == :success && system_arguments[:dismiss_scheme] != :none

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
end
end
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
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'hideWhenFiltering' }) do
render(Primer::Beta::Button.new(
tag: :a,
href: enable_all_project_settings_life_cycle_steps_path(project_id: project),
Expand All @@ -45,7 +45,7 @@
t('projects.settings.actions.label_enable_all')
end
end
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'bulkActionContainer' }) do
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'hideWhenFiltering' }) do
render(Primer::Beta::Button.new(
tag: :a,
href: disable_all_project_settings_life_cycle_steps_path(project_id: project),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<%=
flex_layout(align_items: :center,
justify_content: :space_between) do |step_container|
step_container.with_column(flex_layout: true) do |title_container|
title_container.with_column(pt: 1, mr: 3) do
step_container.with_column(flex_layout: true, mr: 2, classes: "min-width-0") do |title_container|
title_container.with_column(pt: 1, mr: 3, classes: "ellipsis") do
render(Primer::Beta::Text.new(classes: 'filter-target-visible-text')) { definition.name }
end
title_container.with_column(pt: 1) do
title_container.with_column(pt: 1, classes: "no-wrap") do
render(Projects::LifeCycleTypeComponent.new(definition))
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
end
end
section_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
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'hideWhenFiltering' }) do
render(Primer::Beta::Button.new(
tag: :a,
href: enable_all_of_section_project_settings_project_custom_fields_path(
Expand All @@ -32,7 +32,7 @@
t('projects.settings.actions.label_enable_all')
end
end
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'bulkActionContainer' }) do
actions_container.with_column(data: { 'projects--settings--border-box-filter-target': 'hideWhenFiltering' }) do
render(Primer::Beta::Button.new(
tag: :a,
href: disable_all_of_section_project_settings_project_custom_fields_path(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) 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.

++#%>

<%= render Primer::OpenProject::PageHeader.new do |header|
header.with_title { t("settings.project_life_cycle_step_definitions.#{heading_scope}.heading") }
header.with_description { t("settings.project_life_cycle_step_definitions.new.description") }
header.with_breadcrumbs(breadcrumbs_items)
end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 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 Settings
module ProjectLifeCycleStepDefinitions
class FormHeaderComponent < ApplicationComponent
options :heading_scope

def breadcrumbs_items
[
{ href: admin_index_path, text: t("label_administration") },
{ href: admin_settings_project_custom_fields_path, text: t("label_project_plural") },
{ href: admin_settings_project_life_cycle_step_definitions_path, text: t("settings.project_life_cycle_step_definitions.heading") },

Check notice on line 38 in app/components/settings/project_life_cycle_step_definitions/form_header_component.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] app/components/settings/project_life_cycle_step_definitions/form_header_component.rb#L38 <Layout/LineLength>

Line is too long. [141/130]
Raw output
app/components/settings/project_life_cycle_step_definitions/form_header_component.rb:38:131: C: Layout/LineLength: Line is too long. [141/130]
t("settings.project_life_cycle_step_definitions.#{heading_scope}.heading")
]
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) 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.

++#%>

<%=
component_wrapper do
flex_layout(data: wrapper_data_attributes) do |flex|
flex.with_row do
if allowed_to_customize_life_cycle?
render(Primer::OpenProject::SubHeader.new) do |subheader|
subheader.with_filter_input(
name: "border-box-filter",
label: t("settings.project_life_cycle_step_definitions.filter.label"),
visually_hide_label: true,
placeholder: t("settings.project_life_cycle_step_definitions.filter.label"),
leading_visual: {
icon: :search,
size: :small
},
show_clear_button: true,
data: {
action: "input->projects--settings--border-box-filter#filterLists",
"projects--settings--border-box-filter-target": "filter"
}
)
subheader.with_action_component do
render(Primer::Alpha::ActionMenu.new(
anchor_align: :end)
) do |menu|
menu.with_show_button(
scheme: :primary,
aria: { label: I18n.t("settings.project_life_cycle_step_definitions.label_add_description") },
) do |button|
button.with_leading_visual_icon(icon: :plus)
button.with_trailing_action_icon(icon: :"triangle-down")
I18n.t("settings.project_life_cycle_step_definitions.label_add")
end

menu.with_item(
label: I18n.t("settings.project_life_cycle_step_definitions.label_add_stage"),
href: new_stage_admin_settings_project_life_cycle_step_definitions_path
) do |item|
item.with_leading_visual_icon(icon: "git-commit")
end

menu.with_item(
label: I18n.t("settings.project_life_cycle_step_definitions.label_add_gate"),
href: new_gate_admin_settings_project_life_cycle_step_definitions_path
) do |item|
item.with_leading_visual_icon(icon: "diamond")
end
end
end
end
else
render EnterpriseEdition::BannerComponent.new(:customize_life_cycle, mb: 3)
end
end

flex.with_row do
render(border_box_container(mb: 3, data: drop_target_config)) 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 do
render(Primer::Beta::Text.new(font_weight: :bold)) do
I18n.t("settings.project_life_cycle_step_definitions.section_header")
end
end
end
end
if definitions.empty?
component.with_row do
render(Primer::Beta::Text.new(color: :subtle)) do
t("settings.project_life_cycle_step_definitions.non_defined")
end
end
else
definitions.each do |definition|
component.with_row(
data: {
"projects--settings--border-box-filter-target": "searchItem",
**draggable_item_config(definition)
}
) do
render(Settings::ProjectLifeCycleStepDefinitions::RowComponent.new(
definition,
first?: definition == definitions.first,
last?: definition == definitions.last,
))
end
end
end
end
end
flex.with_row(display: :none, data: { "projects--settings--border-box-filter-target": "noResultsText" }) do
render Primer::Beta::Text.new do
I18n.t("js.autocompleter.notFoundText")
end
end
end
end
%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 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 Settings
module ProjectLifeCycleStepDefinitions
class IndexComponent < ApplicationComponent
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable
include Projects::LifeCycleDefinitionHelper

options :definitions

private

def wrapper_data_attributes
{
controller: "projects--settings--border-box-filter generic-drag-and-drop",
"application-target": "dynamic"
}
end

def drop_target_config
{
"is-drag-and-drop-target": true,
"target-container-accessor": "& > ul",
"target-allowed-drag-type": "life-cycle-step-definition"
}
end

def draggable_item_config(definition)
{
"draggable-type": "life-cycle-step-definition",
"drop-url": drop_admin_settings_project_life_cycle_step_definition_path(definition)
}
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) 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.

++#%>

<%=
render Primer::OpenProject::PageHeader.new do |header|
header.with_title { t("settings.project_life_cycle_step_definitions.heading") }
header.with_description { t("settings.project_life_cycle_step_definitions.heading_description") }
header.with_breadcrumbs(breadcrumbs_items)
end
%>
Loading
Loading