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
[#55961] Adapt to new controller and naming
Judith Roth8c9669bfcb14
diff --git a/modules/storages/app/components/storages/admin/edit_form_header_component.html.erb b/modules/storages/app/components/storages/admin/edit_form_header_component.html.erbindex cf3302973f7..d856c0965c2 100644--- a/modules/storages/app/components/storages/admin/edit_form_header_component.html.erb+++ b/modules/storages/app/components/storages/admin/edit_form_header_component.html.erb@@ -55,7 +55,7 @@ See COPYRIGHT and LICENSE files for more details.tab.with_text { t(:label_details) }endtab_nav.with_tab(- selected: tab_selected?(:project_mappings),+ selected: tab_selected?(:project_storages),href: admin_settings_storage_project_storages_path(@storage)) do |tab|tab.with_text { t(:label_project_mappings) }diff --git a/modules/storages/app/components/storages/admin/edit_form_header_component.rb b/modules/storages/app/components/storages/admin/edit_form_header_component.rbindex f6a923e06e4..27101c28935 100644--- a/modules/storages/app/components/storages/admin/edit_form_header_component.rb+++ b/modules/storages/app/components/storages/admin/edit_form_header_component.rb@@ -31,7 +31,7 @@ module Storagesclass EditFormHeaderComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponentTAB_NAVS = %i[edit- project_mappings+ project_storages].freezedef initialize(storage:, selected:)diff --git a/modules/storages/app/components/storages/project_storages/project_mapping/row_component.rb b/modules/storages/app/components/storages/project_storages/projects/row_component.rbsimilarity index 96%rename from modules/storages/app/components/storages/project_storages/project_mapping/row_component.rbrename to modules/storages/app/components/storages/project_storages/projects/row_component.rbindex 7e4f6583013..a06da84d543 100644--- a/modules/storages/app/components/storages/project_storages/project_mapping/row_component.rb+++ b/modules/storages/app/components/storages/project_storages/projects/row_component.rb@@ -28,7 +28,7 @@# Purpose: Defines how to format the components within a table row of Projects# associated with a Storage-module Storages::ProjectStorages::ProjectMapping+module Storages::ProjectStorages::Projectsclass RowComponent < Projects::RowComponent # rubocop:disable OpenProject/AddPreviewForViewComponentendenddiff --git a/modules/storages/app/components/storages/project_storages/project_mapping/table_component.rb b/modules/storages/app/components/storages/project_storages/projects/table_component.rbsimilarity index 97%rename from modules/storages/app/components/storages/project_storages/project_mapping/table_component.rbrename to modules/storages/app/components/storages/project_storages/projects/table_component.rbindex 67273c4e2ae..6e4a3cfa1b7 100644--- a/modules/storages/app/components/storages/project_storages/project_mapping/table_component.rb+++ b/modules/storages/app/components/storages/project_storages/projects/table_component.rb@@ -30,7 +30,7 @@# Projects for a given Storage.# See also: row_component.rb, which contains a method# for every "column" defined below.-module Storages::ProjectStorages::ProjectMapping+module Storages::ProjectStorages::Projectsclass TableComponent < Projects::TableComponent # rubocop:disable OpenProject/AddPreviewForViewComponentinclude OpTurbo::Streamablediff --git a/modules/storages/app/controllers/storages/admin/storages/project_storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages/project_storages_controller.rbindex c666d129a80..5254c801bfa 100644--- a/modules/storages/app/controllers/storages/admin/storages/project_storages_controller.rb+++ b/modules/storages/app/controllers/storages/admin/storages/project_storages_controller.rb@@ -40,7 +40,16 @@ class Storages::Admin::Storages::ProjectStoragesController < ApplicationControllmenu_item :external_file_storages- def index; end+ def index+ @project_query = ProjectQuery.new(+ name: "project-storage-mappings-#{@storage.id}"+ ) do |query|+ query.where(:id, "=", @storage.projects.ids)+ query.select(:name)+ query.order("lft" => "asc")+ end+ end+def new; enddef create; enddef destroy; enddiff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rbindex 2bb3b16d46b..13ec7e2007b 100644--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb@@ -46,7 +46,7 @@ class Storages::Admin::StoragesController < ApplicationControllerbefore_action :require_adminbefore_action :find_model_object,only: %i[show_oauth_application destroy edit edit_host confirm_destroy update- change_health_notifications_enabled replace_oauth_application project_mappings]+ change_health_notifications_enabled replace_oauth_application]before_action :ensure_valid_provider_type_selected, only: %i[select_provider]before_action :require_ee_token_for_one_drive, only: %i[select_provider]@@ -245,16 +245,6 @@ class Storages::Admin::StoragesController < ApplicationControllerendend- def project_mappings- @project_query = ProjectQuery.new(- name: "project-storage-mappings-#{@storage.id}"- ) do |query|- query.where(:id, "=", @storage.projects.ids)- query.select(:name)- query.order("lft" => "asc")- end- end-def default_breadcrumb; enddef show_local_breadcrumbdiff --git a/modules/storages/app/views/storages/admin/storages/project_mappings.html.erb b/modules/storages/app/views/storages/admin/storages/project_mappings.html.erbdeleted file mode 100644index 31201d5abdc..00000000000--- a/modules/storages/app/views/storages/admin/storages/project_mappings.html.erb+++ /dev/null@@ -1,43 +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.--++#%>--<%=- render(Storages::Admin::EditFormHeaderComponent.new(- storage: @storage,- selected: :project_mappings- )- )-%>-<%=- render(Storages::ProjectStorages::ProjectMapping::TableComponent.new(- query: @project_query,- params:- )- )-%>diff --git a/modules/storages/app/views/storages/admin/storages/project_storages/index.html.erb b/modules/storages/app/views/storages/admin/storages/project_storages/index.html.erbindex a9b840abb92..1768dcbe3e8 100644--- a/modules/storages/app/views/storages/admin/storages/project_storages/index.html.erb+++ b/modules/storages/app/views/storages/admin/storages/project_storages/index.html.erb@@ -30,7 +30,7 @@ See COPYRIGHT and LICENSE files for more details.<%=render(Storages::Admin::EditFormHeaderComponent.new(storage: @storage,- selected: :project_mappings+ selected: :project_storages))%>@@ -50,3 +50,11 @@ See COPYRIGHT and LICENSE files for more details.endend%>++<%=+ render(Storages::ProjectStorages::Projects::TableComponent.new(+ query: @project_query,+ params:+ )+ )+%>diff --git a/modules/storages/config/routes.rb b/modules/storages/config/routes.rbindex 90a1fafdb80..963f9eb1482 100644--- a/modules/storages/config/routes.rb+++ b/modules/storages/config/routes.rb@@ -64,7 +64,6 @@ Rails.application.routes.draw dopatch :change_health_notifications_enabledget :confirm_destroydelete :replace_oauth_application- get :project_mappingsendget :upsale, on: :collectiondiff --git a/modules/storages/spec/features/storages/admin/project_mappings_spec.rb b/modules/storages/spec/features/storages/admin/project_storages_spec.rbsimilarity index 96%rename from modules/storages/spec/features/storages/admin/project_mappings_spec.rbrename to modules/storages/spec/features/storages/admin/project_storages_spec.rbindex b46fb0b049c..60b5177900d 100644--- a/modules/storages/spec/features/storages/admin/project_mappings_spec.rb+++ b/modules/storages/spec/features/storages/admin/project_storages_spec.rb@@ -48,7 +48,7 @@ RSpec.describe "Admin lists project mappings for a storage",context "with insufficient permissions" doit "is not accessible" dologin_as(non_admin)- visit project_mappings_admin_settings_storage_path(storage)+ visit admin_settings_storage_project_storages_path(storage)expect(page).to have_text("You are not authorized to access this page.")end@@ -57,7 +57,7 @@ RSpec.describe "Admin lists project mappings for a storage",context "with sufficient permissions" dobefore dologin_as(admin)- visit project_mappings_admin_settings_storage_path(storage)+ visit admin_settings_storage_project_storages_path(storage)endit "renders a list of projects linked to the storage" do