Skip to content

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

fix[Op#50737]: Switch select caption by provider type

Kabiru Mwenja6c12920deb66
diff --git a/modules/storages/app/components/storages/admin/forms/general_info_form_component.html.erb b/modules/storages/app/components/storages/admin/forms/general_info_form_component.html.erb
index 14d38c47695..dce5a61399d 100644
--- a/modules/storages/app/components/storages/admin/forms/general_info_form_component.html.erb
+++ b/modules/storages/app/components/storages/admin/forms/general_info_form_component.html.erb
@@ -7,7 +7,13 @@
) do |form|
flex_layout do |general_info_row|
general_info_row.with_row(mb: 3) do
- render(Storages::Admin::ProviderTypeSelectForm.new(form, storage:))
+ render(
+ Storages::Admin::ProviderTypeSelectForm.new(
+ form,
+ storage:,
+ select_list_options: { caption: provider_type_select_caption }
+ )
+ )
end
general_info_row.with_row(mb: 3) do
diff --git a/modules/storages/app/components/storages/admin/forms/general_info_form_component.rb b/modules/storages/app/components/storages/admin/forms/general_info_form_component.rb
index 499d2db4386..972bd896b9b 100644
--- a/modules/storages/app/components/storages/admin/forms/general_info_form_component.rb
+++ b/modules/storages/app/components/storages/admin/forms/general_info_form_component.rb
@@ -73,5 +73,29 @@ module Storages::Admin::Forms
end
end
end
+
+ def provider_type_select_caption
+ return if storage.provider_type.blank?
+
+ if storage.provider_type_nextcloud?
+ caption_for_provider_type(:nextcloud, "https://apps.nextcloud.com/apps/integration_openproject")
+ elsif storage.provider_type_one_drive?
+ caption_for_provider_type(:one_drive, "https://docs.microsoft.com/en-us/graph/auth-register-app-v2")
+ end
+ end
+
+ def caption_for_provider_type(provider_type, href)
+ I18n.t(
+ "storages.instructions.#{provider_type}.provider_configuration",
+ application_link_text: application_link_text_for(
+ href,
+ I18n.t("storages.instructions.#{provider_type}.application_link_text")
+ )
+ ).html_safe
+ end
+
+ def application_link_text_for(href, link_text)
+ render(Primer::Beta::Link.new(href:, target: '_blank')) { link_text }
+ end
end
end
diff --git a/modules/storages/app/forms/storages/admin/provider_type_select_form.rb b/modules/storages/app/forms/storages/admin/provider_type_select_form.rb
index 1f9a9f489a9..16713502482 100644
--- a/modules/storages/app/forms/storages/admin/provider_type_select_form.rb
+++ b/modules/storages/app/forms/storages/admin/provider_type_select_form.rb
@@ -58,8 +58,7 @@ module Storages::Admin
{
name: :provider_type,
label: I18n.t('activerecord.attributes.storages/storage.provider_type'),
- caption: I18n.t('storages.instructions.provider_type',
- type_link_text: I18n.t('storages.instructions.type_link_text')),
+ caption: nil,
include_blank: false,
required: true,
disabled: storage.persisted?
diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.yml
index fdad9b5a8e8..3e4309c674f 100644
--- a/modules/storages/config/locales/en.yml
+++ b/modules/storages/config/locales/en.yml
@@ -110,7 +110,6 @@ en:
title: "Members connection status"
subtitle: "Check the connection status for the storage %{storage_name_link} of all project members."
instructions:
- provider_type: "Please make sure you have administration privileges in your Nextcloud instance and the application %{type_link_text} is installed before doing the setup."
type: "Please make sure you have administration privileges in your Nextcloud instance and have the following application installed before doing the setup:"
type_link_text: "“Integration OpenProject”"
name: "Give your storage a name so that users can differentiate between multiple storages."
@@ -136,8 +135,12 @@ en:
oauth_application_details_link_text: "Nextcloud OpenProject Integration settings"
copy_from: "Copy this value from"
nextcloud:
+ provider_configuration: "Please make sure you have administration privileges in your Nextcloud instance and the %{application_link_text} is installed before doing the setup."
+ application_link_text: "application “Integration OpenProject”"
integration: "Nextcloud Administration / OpenProject"
one_drive:
+ provider_configuration: "Please make sure you have administration privileges in the %{application_link_text} before doing the setup."
+ application_link_text: "Azure application"
integration: "OneDrive/SharePoint"
oauth_client_id: >
Copy the client id from the Azure portal. This is needed to generate the redirect URI.