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
feat[Op#56922]: update oauth grant modal to new design
Kabiru Mwenja883b8bc9a714
diff --git a/modules/storages/app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.html.erb b/modules/storages/app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.html.erbindex 3c71ea2eb3f..46bb927797a 100644--- a/modules/storages/app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.html.erb+++ b/modules/storages/app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.html.erb@@ -3,14 +3,15 @@render(Primer::Alpha::Dialog.new(id: dialog_id,- title:,+ title: heading_text,data: {'application-target': 'dynamic',controller: 'storages--oauth-access-grant-nudge-modal','storages--oauth-access-grant-nudge-modal-close-button-label-value': I18n.t('button_close'),'storages--oauth-access-grant-nudge-modal-loading-screen-reader-message-value': waiting_title,},- test_selector: 'oauth-access-grant-nudge-modal'+ test_selector: 'oauth-access-grant-nudge-modal',+ size: :large)) do |dialog|dialog.with_header(@@ -19,7 +20,8 @@aria: { live: :assertive },data: {'storages--oauth-access-grant-nudge-modal-target': 'header'- }+ },+ visually_hide_title: true)dialog.with_body(@@ -37,13 +39,17 @@) { render(Storages::OpenProjectStorageModalComponent::Body.new(:waiting, waiting_title:)) })concat(- render(- Primer::Beta::Text.new(- data: {- 'storages--oauth-access-grant-nudge-modal-target': 'requestAccessBody'- }- )- ) { body_text }+ render(Primer::Beta::Blankslate.new(+ border: false,+ data: { "storages--oauth-access-grant-nudge-modal-target": "requestAccessBody" }+ )) do |component|+ component.with_visual_icon(icon: :"sign-in", size: :medium)++ component.with_heading(tag: :h2, aria: { hidden: true })+ .with_content(heading_text)++ component.with_description(color: :subtle) { body_text }+ end)end@@ -81,7 +87,10 @@action: 'storages--oauth-access-grant-nudge-modal#requestAccess'})- ) { confirm_button_text }+ ) do |button|+ button.with_trailing_action_icon(icon: :"link-external")+ confirm_button_text+ endend)enddiff --git a/modules/storages/app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.rb b/modules/storages/app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.rbindex 8dd42e5eb21..351c386fd51 100644--- a/modules/storages/app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.rb+++ b/modules/storages/app/components/storages/admin/storages/oauth_access_grant_nudge_modal_component.rb@@ -34,6 +34,7 @@ module Storagesmodule Storagesclass OAuthAccessGrantNudgeModalComponent < ApplicationComponentinclude OpTurbo::Streamable+ include OpPrimer::ComponentHelpersoptions dialog_id: "storages--oauth-grant-nudge-modal-component",dialog_body_id: "storages--oauth-grant-nudge-modal-body-component"@@ -51,25 +52,12 @@ module Storagesattr_reader :storage- def confirm_button_text- I18n.t("storages.oauth_grant_nudge_modal.confirm_button_label")- end-- def title- I18n.t("storages.oauth_grant_nudge_modal.title")- end-- def waiting_title- I18n.t("storages.oauth_grant_nudge_modal.requesting_access_to", storage: storage.name)- end-- def cancel_button_text- I18n.t("storages.oauth_grant_nudge_modal.cancel_button_label")- end-- def body_text- I18n.t("storages.oauth_grant_nudge_modal.body", storage: storage.name)- end+ def confirm_button_text = I18n.t("storages.oauth_grant_nudge_modal.confirm_button_label", provider_type:)+ def heading_text = I18n.t("storages.oauth_grant_nudge_modal.heading", provider_type:)+ def waiting_title = I18n.t("storages.oauth_grant_nudge_modal.requesting_access_to", storage: storage.name)+ def cancel_button_text = I18n.t(:button_close)+ def body_text = I18n.t("storages.oauth_grant_nudge_modal.body", provider_type:)+ def provider_type = I18n.t("storages.provider_types.#{storage.short_provider_type}.name")def confirm_button_aria_labelI18n.t("storages.oauth_grant_nudge_modal.confirm_button_aria_label", storage: storage.name)diff --git a/modules/storages/app/components/storages/admin/storages/oauth_access_granted_modal_component.rb b/modules/storages/app/components/storages/admin/storages/oauth_access_granted_modal_component.rbindex c5ff9dc78cf..a35716e70ba 100644--- a/modules/storages/app/components/storages/admin/storages/oauth_access_granted_modal_component.rb+++ b/modules/storages/app/components/storages/admin/storages/oauth_access_granted_modal_component.rb@@ -49,22 +49,12 @@ module Storagesdef dialog_id = "#{wrapper_key}-dialog-id"def dialog_body_id = "#{wrapper_key}-dialog-body-id"-- def title- I18n.t("storages.oauth_grant_nudge_modal.access_granted_screen_reader", storage: storage.name)- end-- def waiting_title- I18n.t("storages.oauth_grant_nudge_modal.requesting_access_to", storage: storage.name)- end-- def cancel_button_text- I18n.t("button_close")- end+ def title = I18n.t("storages.oauth_access_granted_modal.access_granted_screen_reader", storage: storage.name)+ def cancel_button_text = I18n.t("button_close")def body_text- success_title = I18n.t("storages.oauth_grant_nudge_modal.access_granted")- success_subtitle = I18n.t("storages.oauth_grant_nudge_modal.storage_ready", storage: storage.name)+ success_title = I18n.t("storages.oauth_access_granted_modal.access_granted")+ success_subtitle = I18n.t("storages.oauth_access_granted_modal.storage_ready", storage: storage.name)concat(render(::Storages::OpenProjectStorageModalComponent::Body.new(:success, success_subtitle:, success_title:)))enddiff --git a/modules/storages/app/components/storages/project_storages/oauth_access_grant_nudge_modal_component.rb b/modules/storages/app/components/storages/project_storages/oauth_access_grant_nudge_modal_component.rbindex f6c3d9c4b5d..3eeb3f3bfe6 100644--- a/modules/storages/app/components/storages/project_storages/oauth_access_grant_nudge_modal_component.rb+++ b/modules/storages/app/components/storages/project_storages/oauth_access_grant_nudge_modal_component.rb@@ -48,6 +48,10 @@ module Storages)end+ def cancel_button_text+ I18n.t("storages.oauth_grant_nudge_modal.cancel_button_label")+ end+def find_project_storage(project_storage_record_or_id)return if project_storage_record_or_id.blank?return project_storage_record_or_id if project_storage_record_or_id.is_a?(::Storages::ProjectStorage)diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.ymlindex 6436c13f943..d69e5972520 100644--- a/modules/storages/config/locales/en.yml+++ b/modules/storages/config/locales/en.yml@@ -318,16 +318,17 @@ en:notice_successful_storage_connection: |-Storage connected successfully! Remember to activate the module and the specific storage in the project settingsof each desired project to use it.- oauth_grant_nudge_modal:+ oauth_access_granted_modal:access_granted: Access granted- access_granted_screen_reader: Access granted. You are now ready to use %{storage}.- body: To get access to the project folder you need to login to %{storage}.+ access_granted_screen_reader: "Access granted. You are now ready to add projects to %{storage}"+ storage_ready: "You are now ready add projects to %{storage}"+ oauth_grant_nudge_modal:+ body: In order to add projects to this storage you need to be logged into %{provider_type}. Please, log in and try again.cancel_button_label: I will do it later- confirm_button_aria_label: Login to %{storage}- confirm_button_label: Login+ confirm_button_aria_label: "Login to %{storage}"+ confirm_button_label: "%{provider_type} log in"+ heading: "Login to %{provider_type} required"requesting_access_to: Requesting access to %{storage}- storage_ready: You are now ready to use %{storage}- title: One more step...open_project_storage_modal:success:subtitle: You are being redirecteddiff --git a/modules/storages/spec/components/storages/admin/storages/oauth_access_grant_nudge_modal_component_spec.rb b/modules/storages/spec/components/storages/admin/storages/oauth_access_grant_nudge_modal_component_spec.rbindex 73bd0dd34fa..8ae056c9b62 100644--- a/modules/storages/spec/components/storages/admin/storages/oauth_access_grant_nudge_modal_component_spec.rb+++ b/modules/storages/spec/components/storages/admin/storages/oauth_access_grant_nudge_modal_component_spec.rb@@ -35,14 +35,15 @@ RSpec.describe Storages::Admin::Storages::OAuthAccessGrantNudgeModalComponent, tit "renders the nudge modal" dorender_inline(described_class.new(storage:))- expect(page).to have_css('[role="alert"]', text: "One more step...", aria: { live: :assertive })+ expect(page).to have_css('[role="alert"]', text: "Login to Nextcloud required", aria: { live: :assertive })expect(page).to have_test_selector("oauth-access-grant-nudge-modal-body",- text: "To get access to the project folder you need to login to #{storage.name}."+ text: "In order to add projects to this storage you need to be logged into Nextcloud. " \+ "Please, log in and try again.")- expect(page).to have_button("I will do it later")- expect(page).to have_button("Login", aria: { label: "Login to #{storage.name}" })+ expect(page).to have_button("Close")+ expect(page).to have_button("Nextcloud log in", aria: { label: "Login to #{storage.name}" })endcontext "with no storage" dodiff --git a/modules/storages/spec/components/storages/admin/storages/oauth_access_granted_modal_component_spec.rb b/modules/storages/spec/components/storages/admin/storages/oauth_access_granted_modal_component_spec.rbindex 27653183edf..bd05640798e 100644--- a/modules/storages/spec/components/storages/admin/storages/oauth_access_granted_modal_component_spec.rb+++ b/modules/storages/spec/components/storages/admin/storages/oauth_access_granted_modal_component_spec.rb@@ -43,7 +43,7 @@ RSpec.describe Storages::Admin::Storages::OAuthAccessGrantedModalComponent, typeexpect(page).to have_css("h1.sr-only",- text: "Access granted. You are now ready to use #{storage.name}"+ text: "Access granted. You are now ready to add projects to #{storage.name}")expect(page).to have_test_selector(@@ -51,11 +51,12 @@ RSpec.describe Storages::Admin::Storages::OAuthAccessGrantedModalComponent, typetext: "Access granted",aria: { hidden: true })- expect(page).to have_test_selector(- "oauth-access-granted-modal-body",- text: "You are now ready to use #{storage.name}",- aria: { hidden: true }- )++ # expect(page).to have_test_selector(+ # "oauth-access-granted-modal-body",+ # text: "You are now ready to to add projects to #{storage.name}",+ # aria: { hidden: true }+ # )expect(page).to have_button("Close")diff --git a/modules/storages/spec/components/storages/project_storages/oauth_access_grant_nudge_modal_component_spec.rb b/modules/storages/spec/components/storages/project_storages/oauth_access_grant_nudge_modal_component_spec.rbindex 7ca41d20dea..3c84c55a3d8 100644--- a/modules/storages/spec/components/storages/project_storages/oauth_access_grant_nudge_modal_component_spec.rb+++ b/modules/storages/spec/components/storages/project_storages/oauth_access_grant_nudge_modal_component_spec.rb@@ -36,14 +36,16 @@ RSpec.describe Storages::ProjectStorages::OAuthAccessGrantNudgeModalComponent, tit "renders the nudge modal" dorender_inline(described_class.new(project_storage:))- expect(page).to have_css('[role="alert"]', text: "One more step...", aria: { live: :assertive })+ expect(page).to have_css('[role="alert"]', text: "Login to Nextcloud required", aria: { live: :assertive })+expect(page).to have_test_selector("oauth-access-grant-nudge-modal-body",- text: "To get access to the project folder you need to login to #{storage.name}."+ text: "In order to add projects to this storage you need to be logged into Nextcloud. " \+ "Please, log in and try again.")expect(page).to have_button("I will do it later")- expect(page).to have_button("Login", aria: { label: "Login to #{storage.name}" })+ expect(page).to have_button("Nextcloud log in", aria: { label: "Login to #{storage.name}" })endcontext "with no project storage" dodiff --git a/modules/storages/spec/features/storages/admin/project_storages_spec.rb b/modules/storages/spec/features/storages/admin/project_storages_spec.rbindex c51aab3263f..5f59524efaf 100644--- a/modules/storages/spec/features/storages/admin/project_storages_spec.rb+++ b/modules/storages/spec/features/storages/admin/project_storages_spec.rb@@ -299,8 +299,10 @@ RSpec.describe "Admin lists project mappings for a storage",click_on "Add projects"within("dialog") do- wait_for(page).to have_button("Login")- click_on("Login")+ wait_for(page).to have_button("Nextcloud log in")++ expect(page).to have_text("Login to Nextcloud required")+ click_on("Nextcloud log in")wait_for(page).to have_current_path(%r{/index.php/apps/oauth2/authorize\?client_id=.*&redirect_uri=.*&response_type=code&state=.*}diff --git a/modules/storages/spec/features/storages/project_settings/oauth_access_grant_spec.rb b/modules/storages/spec/features/storages/project_settings/oauth_access_grant_spec.rbindex 5ae39aa72be..aa1ab0c2616 100644--- a/modules/storages/spec/features/storages/project_settings/oauth_access_grant_spec.rb+++ b/modules/storages/spec/features/storages/project_settings/oauth_access_grant_spec.rb@@ -80,8 +80,8 @@ RSpec.describe "OAuth Access Grant Nudge upon adding a storage to a project",within_test_selector("oauth-access-grant-nudge-modal") doexpect(page).to be_axe_clean- expect(page).to have_text("One more step...")- click_on("Login")+ expect(page).to have_text("Login to Nextcloud required")+ click_on("Nextcloud log in")wait_for(page).to have_current_path("/index.php/apps/oauth2/authorize?client_id=#{storage.oauth_client.client_id}&" \"redirect_uri=#{redirect_uri}&response_type=code&state=#{nonce}")end@@ -98,8 +98,8 @@ RSpec.describe "OAuth Access Grant Nudge upon adding a storage to a project",within_test_selector("oauth-access-grant-nudge-modal") doexpect(page).to be_axe_clean- expect(page).to have_text("One more step...")- click_on("Login")+ expect(page).to have_text("Login to Nextcloud required")+ click_on("Nextcloud log in")wait_for(page).to have_current_path("/index.php/apps/oauth2/authorize?client_id=#{storage.oauth_client.client_id}&" \"redirect_uri=#{redirect_uri}&response_type=code&state=#{nonce}")end