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
chore[#50212]: edit_host_name_configuration blueprint
Kabiru Mwenja010c569cad38
diff --git a/modules/storages/app/components/storages/admin/storage_general_info_form_component.html.erb b/modules/storages/app/components/storages/admin/storage_general_info_form_component.html.erbnew file mode 100644index 00000000000..9e2df3bae6d--- /dev/null+++ b/modules/storages/app/components/storages/admin/storage_general_info_form_component.html.erb@@ -0,0 +1,21 @@+<%=+ primer_form_with(+ model: storage,+ url: admin_settings_storage_path(storage),+ method: :patch+ ) do |form|+ flex_layout do |general_info_row|+ general_info_row.with_column do+ render(Storages::Admin::ProviderTypeSelectForm.new(form))+ end++ general_info_row.with_column do+ render(Primer::Beta::Button.new(scheme: :primary, type: :submit)) { I18n.t('storages.buttons.save_and_continue') }+ end++ general_info_row.with_column do+ render(Primer::Beta::Button.new(scheme: :default, tag: :a, href: edit_admin_settings_storage_path(storage))) { I18n.t('button_cancel') }+ end+ end+ end+%>diff --git a/modules/storages/app/components/storages/admin/storage_general_info_form_component.rb b/modules/storages/app/components/storages/admin/storage_general_info_form_component.rbnew file mode 100644index 00000000000..943755b96b4--- /dev/null+++ b/modules/storages/app/components/storages/admin/storage_general_info_form_component.rb@@ -0,0 +1,43 @@+# 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.+#+++#+module Storages::Admin+ class StorageGeneralInfoFormComponent < ApplicationComponent+ # include OpTurbo::Frameable+ include OpPrimer::ComponentHelpers+ alias_method :storage, :model++ private++ def storage_row_css_id+ helpers.dom_id storage+ end+ end+enddiff --git a/modules/storages/app/components/storages/admin/storage_view_component.html.erb b/modules/storages/app/components/storages/admin/storage_view_component.html.erbindex 4e3ea699f82..342dcc33e0a 100644--- a/modules/storages/app/components/storages/admin/storage_view_component.html.erb+++ b/modules/storages/app/components/storages/admin/storage_view_component.html.erb@@ -9,18 +9,29 @@endcomponent.with_row(scheme: :default) do- grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|- grid.with_area(:item, tag: :div, mr: 3) do- concat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.storage_provider') })- concat(configuration_check_label_for(:host_name_configured))- end+ content_tag('turbo-frame', id: dom_id(storage)) do+ grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|+ grid.with_area(:item, tag: :div, mr: 3) do+ concat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.storage_provider') })+ concat(configuration_check_label_for(:host_name_configured))+ end- grid.with_area(:description, tag: :div, color: :subtle, data: { 'test-selector': 'storage-description' }) do- render(Primer::Beta::Truncate.new(font_weight: :light)) { storage_description }- end+ grid.with_area(:description, tag: :div, color: :subtle, data: { 'test-selector': 'storage-description' }) do+ render(Primer::Beta::Truncate.new(font_weight: :light)) { storage_description }+ end- grid.with_area(:"icon-button", tag: :div, color: :subtle, mr: 3, justify_self: :end) do- render(Primer::Beta::IconButton.new(icon: :pencil, scheme: :invisible, aria: { label: I18n.t('storages.label_edit_storage') } , data: { 'test-selector': 'storage-edit-button' }))+ grid.with_area(:"icon-button", tag: :div, color: :subtle, mr: 3, justify_self: :end) do+ render(+ Primer::Beta::IconButton.new(+ icon: :pencil,+ tag: :a,+ scheme: :invisible,+ href: edit_host_name_configuration_admin_settings_storage_path(storage),+ aria: { label: I18n.t('storages.label_edit_storage') } ,+ data: { 'test-selector': 'storage-edit-button' }+ )+ )+ endendendenddiff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rbindex 9ba2273853f..2d52df93f34 100644--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb@@ -41,7 +41,7 @@ class Storages::Admin::StoragesController < ApplicationController# Before executing any action below: Make sure the current user is an admin# and set the @<controller_name> variable to the object referenced in the URL.before_action :require_admin- before_action :find_model_object, only: %i[show destroy edit update replace_oauth_application]+ before_action :find_model_object, only: %i[show destroy edit edit_host_name_configuration update replace_oauth_application]# menu_item is defined in the Redmine::MenuManager::MenuController# module, included from ApplicationController.@@ -107,6 +107,8 @@ class Storages::Admin::StoragesController < ApplicationController# Called by: Global app/config/routes.rb to serve Web pagedef edit; end+ def edit_host_name_configuration; end+# Update is similar to create above# See also: create above# Called by: Global app/config/routes.rb to serve Web pagediff --git a/modules/storages/app/forms/storages/admin/provider_type_select_form.rb b/modules/storages/app/forms/storages/admin/provider_type_select_form.rbnew file mode 100644index 00000000000..2520f09b9d3--- /dev/null+++ b/modules/storages/app/forms/storages/admin/provider_type_select_form.rb@@ -0,0 +1,48 @@+#-- 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 Storages::Admin+ class ProviderTypeSelectForm < ApplicationForm+ form do |select_form|+ select_form.select_list(+ name: :provider_type,+ label: I18n.t('activerecord.attributes.storages/storage.provider_type'),+ caption: I18n.t('storages.forms.general_information.provider_type_select_form.nextcloud_caption'),+ include_blank: false,+ required: true+ ) do |storage_provider_list|+ ::Storages::Storage::PROVIDER_TYPES.each do |provider_type|+ storage_provider_list.option(+ label: I18n.t("storages.provider_types.#{::Storages::Storage.shorten_provider_type(provider_type)}.name"),+ value: provider_type+ )+ end+ end+ end+ end+enddiff --git a/modules/storages/app/views/storages/admin/storages/edit_host_name_configuration.html.erb b/modules/storages/app/views/storages/admin/storages/edit_host_name_configuration.html.erbnew file mode 100644index 00000000000..3e3fac85837--- /dev/null+++ b/modules/storages/app/views/storages/admin/storages/edit_host_name_configuration.html.erb@@ -0,0 +1,7 @@+<div>+ <h1>Edit Host Name Configuration</h1>++ <turbo-frame id="<%= dom_id(@storage) %>">+ <%= render(Storages::Admin::StorageGeneralInfoFormComponent.new(@storage)) %>+ </turbo-frame>+</div>diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.ymlindex bfe7d1128f0..8ce77ffbad9 100644--- a/modules/storages/config/locales/en.yml+++ b/modules/storages/config/locales/en.yml@@ -71,10 +71,16 @@ en:replace_openproject_oauth: "Replace OpenProject OAuth"replace_provider_type_oauth: "Replace %{provider_type} OAuth"save: "Save"+ save_and_continue: "Save and continue"save_and_continue_setup: "Save and continue setup"save_and_complete_setup: "Save and complete setup"select_folder: "Select folder"configure: "Configure"+ forms:+ general_information:+ provider_type_select_form:+ nextcloud_caption: >+ Please make sure you have administration privileges in your Nextcloud instance and the application “Integration OpenProject” is installed before doing the setup.file_storage_view:general_information: "General information"oauth_applications: "OAuth applications"diff --git a/modules/storages/config/routes.rb b/modules/storages/config/routes.rbindex b7d9c073e19..f53a49ec2f6 100644--- a/modules/storages/config/routes.rb+++ b/modules/storages/config/routes.rb@@ -37,6 +37,7 @@ OpenProject::Application.routes.draw doonly: %i[new edit update]member do+ get '/edit_host_name_configuration' => '/storages/admin/storages#edit_host_name_configuration'delete '/replace_oauth_application' => '/storages/admin/storages#replace_oauth_application'endend