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[Op#50737]: render oauth clients instructions by provider
Kabiru Mwenja46562362cc3d
diff --git a/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.html.erb b/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.html.erbindex d929d467b1f..0f23cfbd8dd 100644--- a/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.html.erb+++ b/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.html.erb@@ -16,7 +16,7 @@endoauth_client_row.with_row(mb: 3) do- render(Primer::Beta::Text.new(font_weight: :light)) { storage_provider_credentials_copy_instructions }+ render(Primer::Beta::Text.new(font_weight: :light, test_selector: 'storage-provider-credentials-instructions')) { storage_provider_credentials_instructions }endoauth_client_row.with_row(mb: 3) dodiff --git a/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.rb b/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.rbindex 65634cd99f0..1a5e0db536d 100644--- a/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.rb+++ b/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.rb@@ -67,21 +67,23 @@ module Storages::Admin::Formsendend- def storage_provider_credentials_copy_instructions- "#{I18n.t('storages.instructions.copy_from')}: #{provider_credentials_instructions_link}".html_safe+ def storage_provider_credentials_instructions+ I18n.t("storages.instructions.#{storage.short_provider_type}.oauth_configuration",+ application_link_text: send(:"#{storage.short_provider_type}_integration_link")).html_safeend- def provider_credentials_instructions_link- render(- Primer::Beta::Link.new(- href: Storages::Peripherals::StorageInteraction::Nextcloud::Util.join_uri_path(storage.host,- 'settings/admin/openproject'),- target: '_blank'- )- ) { I18n.t("storages.instructions.#{@storage.short_provider_type}.integration") }+ private++ def one_drive_integration_link(target: '_blank')+ href = ::OpenProject::Static::Links[:storage_docs][:one_drive_oauth_application][:href]+ render(Primer::Beta::Link.new(href:, target:)) { I18n.t('storages.instructions.one_drive.application_link_text') }end- private+ def nextcloud_integration_link(target: '_blank')+ href = Storages::Peripherals::StorageInteraction::Nextcloud::Util+ .join_uri_path(storage.host, 'settings/admin/openproject')+ render(Primer::Beta::Link.new(href:, target:)) { I18n.t('storages.instructions.nextcloud.integration') }+ enddef one_drive_first_time_configuration?storage.provider_type_one_drive? && first_time_configuration?diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.ymlindex cd1eb3e8ed7..c621e73e665 100644--- a/modules/storages/config/locales/en.yml+++ b/modules/storages/config/locales/en.yml@@ -137,10 +137,12 @@ en: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."+ oauth_configuration: "Copy these values from %{application_link_text}."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."+ oauth_configuration: "Copy these values from the %{application_link_text}. After that, copy the redirect URI back to the %{application_link_text}."application_link_text: "Azure application"integration: "OneDrive/SharePoint"oauth_client_id: >diff --git a/modules/storages/spec/features/admin_storages_spec.rb b/modules/storages/spec/features/admin_storages_spec.rbindex 679e6f8cba2..47d4c5a9646 100644--- a/modules/storages/spec/features/admin_storages_spec.rb+++ b/modules/storages/spec/features/admin_storages_spec.rb@@ -161,6 +161,9 @@ RSpec.describe 'Admin storages',aggregate_failures 'OAuth Client' dowithin_test_selector('storage-oauth-client-form') do+ expect(page).to have_test_selector('storage-provider-credentials-instructions',+ text: 'Copy these values from Nextcloud Administration / OpenProject.')+# With null values, submit button should be disabledexpect(page).to have_css('#oauth_client_client_id', value: '')expect(page).to have_css('#oauth_client_client_secret', value: '')@@ -250,13 +253,17 @@ RSpec.describe 'Admin storages',click_button 'Save and continue'end- expect(page).to have_test_selector('label-host_name_configured-storage_tenant_drive_configured-status',- text: 'Completed')+ wait_for(page).to have_test_selector('label-host_name_configured-storage_tenant_drive_configured-status',+ text: 'Completed')expect(page).to have_test_selector('storage-description', text: 'OneDrive/SharePoint - My OneDrive')endaggregate_failures 'OAuth Client' dowithin_test_selector('storage-oauth-client-form') do+ expect(page).to have_test_selector('storage-provider-credentials-instructions',+ text: 'Copy these values from the Azure application. ' \+ 'After that, copy the redirect URI back to the Azure application.')+# With null values, submit button should be disabledexpect(page).to have_css('#oauth_client_client_id', value: '')expect(page).to have_css('#oauth_client_client_secret', value: '')