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
Utilize wizard in StorageViewComponent
Jan Sandbrink321646258981
diff --git a/modules/storages/app/common/storages/peripherals/nextcloud_registry.rb b/modules/storages/app/common/storages/peripherals/nextcloud_registry.rbindex a831f1cf9c0..29fd50b82a9 100644--- a/modules/storages/app/common/storages/peripherals/nextcloud_registry.rb+++ b/modules/storages/app/common/storages/peripherals/nextcloud_registry.rb@@ -58,7 +58,19 @@ module Storagesendnamespace("components") do+ namespace("forms") do+ register(:automatically_managed_folders, ::Storages::Admin::Forms::AutomaticallyManagedProjectFoldersFormComponent)+ register(:general_information, ::Storages::Admin::Forms::GeneralInfoFormComponent)+ register(:oauth_application, ::Storages::Admin::OAuthApplicationInfoCopyComponent)+ register(:oauth_client, ::Storages::Admin::Forms::OAuthClientFormComponent)+ end+register(:setup_wizard, NextcloudStorageWizard)++ register(:automatically_managed_folders, ::Storages::Admin::AutomaticallyManagedProjectFoldersInfoComponent)+ register(:general_information, ::Storages::Admin::GeneralInfoComponent)+ register(:oauth_application, ::Storages::Admin::OAuthApplicationInfoComponent)+ register(:oauth_client, ::Storages::Admin::OAuthClientInfoComponent)endnamespace("contracts") dodiff --git a/modules/storages/app/common/storages/peripherals/nextcloud_storage_wizard.rb b/modules/storages/app/common/storages/peripherals/nextcloud_storage_wizard.rbindex 92f598b4f4f..da4dd958725 100644--- a/modules/storages/app/common/storages/peripherals/nextcloud_storage_wizard.rb+++ b/modules/storages/app/common/storages/peripherals/nextcloud_storage_wizard.rb@@ -31,17 +31,19 @@module Storagesmodule Peripheralsclass NextcloudStorageWizard < Wizard- step :general_info, completed_if: ->(storage) { storage.host.present? && storage.name.present? }+ step :general_information, completed_if: ->(storage) { storage.host.present? && storage.name.present? }step :oauth_application,+ section: :oauth_configuration,completed_if: ->(storage) { storage.oauth_application.present? },preparation: :prepare_oauth_applicationstep :oauth_client,+ section: :oauth_configuration,completed_if: ->(storage) { storage.oauth_client.present? },preparation: ->(storage) { storage.build_oauth_client }- step :automatically_managed_project_folders,+ step :automatically_managed_folders,completed_if: ->(storage) { !storage.automatic_management_unspecified? },preparation: :prepare_storage_for_automatic_management_formdiff --git a/modules/storages/app/common/storages/peripherals/one_drive_registry.rb b/modules/storages/app/common/storages/peripherals/one_drive_registry.rbindex 4bc565b1ea0..5b4cd94b1d3 100644--- a/modules/storages/app/common/storages/peripherals/one_drive_registry.rb+++ b/modules/storages/app/common/storages/peripherals/one_drive_registry.rb@@ -52,7 +52,19 @@ module Storagesendnamespace("components") do+ namespace("forms") do+ register(:access_management, ::Storages::Admin::Forms::AccessManagementFormComponent)+ register(:general_information, ::Storages::Admin::Forms::GeneralInfoFormComponent)+ register(:oauth_client, ::Storages::Admin::Forms::OAuthClientFormComponent)+ register(:redirect_uri, ::Storages::Admin::Forms::RedirectUriFormComponent)+ end+register(:setup_wizard, OneDriveStorageWizard)++ register(:access_management, ::Storages::Admin::AccessManagementComponent)+ register(:general_information, ::Storages::Admin::GeneralInfoComponent)+ register(:oauth_client, ::Storages::Admin::OAuthClientInfoComponent)+ register(:redirect_uri, ::Storages::Admin::RedirectUriComponent)endnamespace("contracts") dodiff --git a/modules/storages/app/common/storages/peripherals/one_drive_storage_wizard.rb b/modules/storages/app/common/storages/peripherals/one_drive_storage_wizard.rbindex 72598709360..242aaeb81c0 100644--- a/modules/storages/app/common/storages/peripherals/one_drive_storage_wizard.rb+++ b/modules/storages/app/common/storages/peripherals/one_drive_storage_wizard.rb@@ -31,17 +31,20 @@module Storagesmodule Peripheralsclass OneDriveStorageWizard < Wizard- step :general_info, completed_if: ->(storage) { storage.name.present? }+ step :general_information, completed_if: ->(storage) { storage.name.present? }step :access_management,+ section: :access_management_section,completed_if: ->(storage) { !storage.automatic_management_unspecified? },preparation: :prepare_storage_for_access_management_formstep :oauth_client,+ section: :oauth_configuration,completed_if: ->(storage) { storage.oauth_client.present? },preparation: ->(storage) { storage.build_oauth_client }step :redirect_uri,+ section: :oauth_configuration,completed_if: ->(storage) {# Working around the fact that there is nothing changed on the storage after showing# the redirect url. The redirect URL step only exists to show the oauth client's redirectdiff --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 9ea99d12b2f..01574e16714 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@@ -33,18 +33,12 @@ module Storages::Admin::Formsinclude OpPrimer::ComponentHelpersinclude OpTurbo::Streamable- attr_reader :storage- alias_method :oauth_client, :model+ alias_method :storage, :modeloptions in_wizard: falsedef self.wrapper_key = :storage_oauth_client_section- def initialize(oauth_client:, storage:, **)- super(oauth_client, **)- @storage = storage- end-def form_urlquery = { continue_wizard: storage.id } if in_wizardadmin_settings_storage_oauth_client_path(storage, query)@@ -65,6 +59,10 @@ module Storages::Admin::Formsprivate+ def oauth_client+ options[:oauth_client] || storage.oauth_client+ end+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") }diff --git a/modules/storages/app/components/storages/admin/forms/redirect_uri_form_component.rb b/modules/storages/app/components/storages/admin/forms/redirect_uri_form_component.rbindex 4e2b83c4f43..dbab6ee3504 100644--- a/modules/storages/app/components/storages/admin/forms/redirect_uri_form_component.rb+++ b/modules/storages/app/components/storages/admin/forms/redirect_uri_form_component.rb@@ -33,18 +33,13 @@ module Storages::Admin::Formsinclude OpPrimer::ComponentHelpersinclude OpTurbo::Streamable- attr_reader :storage- alias_method :oauth_client, :model+ alias_method :storage, :model+ delegate :oauth_client, to: :storageoptions in_wizard: falsedef self.wrapper_key = :storage_redirect_uri_section- def initialize(oauth_client:, storage:, **)- super(oauth_client, **)- @storage = storage- end-def form_urlquery = { continue_wizard: storage.id } if in_wizardfinish_setup_admin_settings_storage_oauth_client_path(storage, query)diff --git a/modules/storages/app/components/storages/admin/oauth_application_info_component.rb b/modules/storages/app/components/storages/admin/oauth_application_info_component.rbindex 90070af8630..5942b42fb55 100644--- a/modules/storages/app/components/storages/admin/oauth_application_info_component.rb+++ b/modules/storages/app/components/storages/admin/oauth_application_info_component.rb@@ -34,13 +34,8 @@ module Storages::Admininclude OpTurbo::Streamableinclude StorageViewInformation- attr_reader :storage- alias_method :oauth_application, :model-- def initialize(oauth_application:, storage:, **)- super(oauth_application, **)- @storage = storage- end+ alias_method :storage, :model+ delegate :oauth_application, to: :storagedef self.wrapper_key = :storage_openproject_oauth_sectionenddiff --git a/modules/storages/app/components/storages/admin/oauth_application_info_copy_component.rb b/modules/storages/app/components/storages/admin/oauth_application_info_copy_component.rbindex d2ae8e8e3b0..8a0d6df3b98 100644--- a/modules/storages/app/components/storages/admin/oauth_application_info_copy_component.rb+++ b/modules/storages/app/components/storages/admin/oauth_application_info_copy_component.rb@@ -33,16 +33,11 @@ module Storages::Admininclude OpTurbo::Streamableinclude OpPrimer::ComponentHelpers- attr_reader :storage- alias_method :oauth_application, :model+ alias_method :storage, :model+ delegate :oauth_application, to: :storageoptions in_wizard: false- def initialize(oauth_application:, storage:, **)- super(oauth_application, **)- @storage = storage- end-def self.wrapper_key = :storage_openproject_oauth_sectiondef oauth_application_details_linkdiff --git a/modules/storages/app/components/storages/admin/oauth_client_info_component.rb b/modules/storages/app/components/storages/admin/oauth_client_info_component.rbindex b4379d32cf8..917957b5a1f 100644--- a/modules/storages/app/components/storages/admin/oauth_client_info_component.rb+++ b/modules/storages/app/components/storages/admin/oauth_client_info_component.rb@@ -34,13 +34,8 @@ module Storages::Admininclude OpTurbo::Streamableinclude StorageViewInformation- attr_reader :storage- alias_method :oauth_client, :model-- def initialize(oauth_client:, storage:, **)- super(oauth_client, **)- @storage = storage- end+ alias_method :storage, :model+ delegate :oauth_client, to: :storagedef self.wrapper_key = :storage_oauth_client_sectiondiff --git a/modules/storages/app/components/storages/admin/redirect_uri_component.rb b/modules/storages/app/components/storages/admin/redirect_uri_component.rbindex 525a476158b..56b79da3359 100644--- a/modules/storages/app/components/storages/admin/redirect_uri_component.rb+++ b/modules/storages/app/components/storages/admin/redirect_uri_component.rb@@ -34,13 +34,8 @@ module Storages::Admininclude OpTurbo::Streamableinclude StorageViewInformation- attr_reader :storage- alias_method :oauth_client, :model-- def initialize(oauth_client:, storage:, **)- super(oauth_client, **)- @storage = storage- end+ alias_method :storage, :model+ delegate :oauth_client, to: :storagedef self.wrapper_key = :storage_redirect_uri_sectiondiff --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 0423a7cb750..269abc97890 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@@ -1,97 +1,25 @@<%=render(border_box_container) do |component|- component.with_header(color: :muted) do- render(Primer::Beta::Text.new(font_weight: :semibold)) { I18n.t('storages.file_storage_view.general_information') }- end-- component.with_row(scheme: :default) do- if wizard_step == "general_info"- render(Storages::Admin::Forms::GeneralInfoFormComponent.new(storage, in_wizard: true))- else- render(Storages::Admin::GeneralInfoComponent.new(storage))- end- end-- if storage.provider_type_nextcloud?- component.with_row(scheme: :neutral, color: :muted) do- grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|- grid.with_area(:item, tag: :div, mr: 3) do- render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.oauth_configuration') }- end- end- end-- component.with_row(scheme: :default) do- if wizard_step == "oauth_application"- render(Storages::Admin::OAuthApplicationInfoCopyComponent.new(oauth_application:, storage:, in_wizard: true))- else- render(Storages::Admin::OAuthApplicationInfoComponent.new(oauth_application:, storage:))- end- end-- component.with_row(scheme: :default) do- if wizard_step == "oauth_client"- render(Storages::Admin::Forms::OAuthClientFormComponent.new(oauth_client: storage.oauth_client, storage:, in_wizard: true))- else- render(Storages::Admin::OAuthClientInfoComponent.new(oauth_client: storage.oauth_client, storage:))- end- end-- component.with_row(scheme: :neutral, color: :muted) do- grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|- grid.with_area(:item, tag: :div) do- render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.project_folders') }- end- end- end-- component.with_row(scheme: :default) do- if wizard_step == "automatically_managed_project_folders"- render(Storages::Admin::Forms::AutomaticallyManagedProjectFoldersFormComponent.new(storage, in_wizard: true))- else- render(Storages::Admin::AutomaticallyManagedProjectFoldersInfoComponent.new(storage))- end- end- end-- if storage.provider_type_one_drive?- component.with_row(scheme: :neutral, color: :muted) do- grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|- grid.with_area(:item, tag: :div, mr: 3) do- render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.access_management.title') }+ last_section = nil+ wizard.steps.each do |step_name|+ if wizard.section_name(step_name) != last_section+ section_name = wizard.section_name(step_name)+ component.with_row(scheme: :neutral, color: :muted) do+ grid_layout("op-storage-view--row", tag: :div, align_items: :center) do |grid|+ grid.with_area(:item, tag: :div, mr: 3) do+ render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t("storages.file_storage_view.#{section_name}") }+ endendend- end- component.with_row(scheme: :default) do- if wizard_step == "access_management"- render(Storages::Admin::Forms::AccessManagementFormComponent.new(storage, in_wizard: true))- else- render(Storages::Admin::AccessManagementComponent.new(storage))- end- end-- component.with_row(scheme: :neutral, color: :muted) do- grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|- grid.with_area(:item, tag: :div, mr: 3) do- render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.oauth_configuration') }- end- end- end-- component.with_row(scheme: :default) do- if wizard_step == "oauth_client"- render(Storages::Admin::Forms::OAuthClientFormComponent.new(oauth_client: storage.oauth_client, storage:, in_wizard: true))- else- render(Storages::Admin::OAuthClientInfoComponent.new(oauth_client: storage.oauth_client, storage:))- end+ last_section = section_nameendcomponent.with_row(scheme: :default) do- if wizard_step == "redirect_uri"- render(Storages::Admin::Forms::RedirectUriFormComponent.new(oauth_client: storage.oauth_client, storage:, in_wizard: true))+ if wizard_step == step_name+ render(Storages::Peripherals::Registry.resolve("#{storage}.components.forms.#{step_name}").new(storage, in_wizard: true))else- render(Storages::Admin::RedirectUriComponent.new(oauth_client: storage.oauth_client, storage:))+ render(Storages::Peripherals::Registry.resolve("#{storage}.components.#{step_name}").new(storage))endendenddiff --git a/modules/storages/app/components/storages/admin/storage_view_component.rb b/modules/storages/app/components/storages/admin/storage_view_component.rbindex ac891fab8d7..98f57b89db1 100644--- a/modules/storages/app/components/storages/admin/storage_view_component.rb+++ b/modules/storages/app/components/storages/admin/storage_view_component.rb@@ -33,10 +33,15 @@ module Storages::Admininclude OpPrimer::ComponentHelpersinclude StorageViewInformation- options wizard_step: nil+ options wizard: nil,+ wizard_step: nil- alias_method :storage, :model+ def initialize(*, **)+ super++ raise ArgumentError, "wizard is required" if wizard.nil?+ end- delegate :oauth_application, to: :model+ alias_method :storage, :modelendenddiff --git a/modules/storages/app/controllers/storages/admin/automatically_managed_project_folders_controller.rb b/modules/storages/app/controllers/storages/admin/automatically_managed_project_folders_controller.rbindex b8732de7ed6..c17eff8a72c 100644--- a/modules/storages/app/controllers/storages/admin/automatically_managed_project_folders_controller.rb+++ b/modules/storages/app/controllers/storages/admin/automatically_managed_project_folders_controller.rb@@ -99,6 +99,8 @@ class Storages::Admin::AutomaticallyManagedProjectFoldersController < Applicatioif service_result.success?redirect_to edit_admin_settings_storage_path(@storage)else+ @wizard = ::Storages::Peripherals::Registry.resolve("#{@storage}.components.setup_wizard")+ .new(model: @storage, user: current_user)render :editendend@@ -123,6 +125,8 @@ class Storages::Admin::AutomaticallyManagedProjectFoldersController < Applicatiocomponent: Storages::Admin::Forms::AutomaticallyManagedProjectFoldersFormComponent.new(@storage))+ @wizard = ::Storages::Peripherals::Registry.resolve("#{@storage}.components.setup_wizard")+ .new(model: @storage, user: current_user)respond_with_turbo_streams do |format|format.html { render :edit }enddiff --git a/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb b/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rbindex aa6691d0115..9be0c0cfea9 100644--- a/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb+++ b/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb@@ -47,30 +47,31 @@ class Storages::Admin::OAuthClientsController < ApplicationController# Show the admin page to create a new OAuthClient object.def new- @oauth_client = ::OAuthClients::SetAttributesService+ oauth_client = ::OAuthClients::SetAttributesService.new(user: User.current,model: OAuthClient.new,contract_class: EmptyContract).call.result- update_via_turbo_stream(component: Storages::Admin::Forms::OAuthClientFormComponent.new(oauth_client: @oauth_client,- storage: @storage))+ update_via_turbo_stream(component: Storages::Admin::Forms::OAuthClientFormComponent.new(@storage, oauth_client:))respond_with_turbo_streamsend- def create # rubocop:disable Metrics/AbcSize+ def createcall_oauth_clients_create_serviceservice_result.on_failure do- update_via_turbo_stream(component: Storages::Admin::Forms::OAuthClientFormComponent.new(oauth_client: @oauth_client,- storage: @storage,- in_wizard: true))+ update_via_turbo_stream(component: Storages::Admin::Forms::OAuthClientFormComponent.new(+ @storage,+ oauth_client: @oauth_client,+ in_wizard: in_wizard?+ ))respond_with_turbo_streamsendservice_result.on_success do- redirect_to(new_admin_settings_storage_path(continue_wizard: @storage.id), status: :see_other)+ respond_for_successendend@@ -78,19 +79,16 @@ class Storages::Admin::OAuthClientsController < ApplicationControllercall_oauth_clients_create_serviceservice_result.on_failure do- update_via_turbo_stream(component: Storages::Admin::Forms::OAuthClientFormComponent.new(oauth_client: @oauth_client,- storage: @storage))+ update_via_turbo_stream(component: Storages::Admin::Forms::OAuthClientFormComponent.new(+ @storage,+ oauth_client: @oauth_client+ ))+ respond_with_turbo_streamsendservice_result.on_success do- update_via_turbo_stream(component: Storages::Admin::OAuthClientInfoComponent.new(oauth_client: @oauth_client,- storage: @storage))- update_via_turbo_stream(component: Storages::Admin::RedirectUriComponent.new(- oauth_client: @oauth_client, storage: @storage- ))+ respond_for_successend-- respond_with_turbo_streamsend# Used by: admin layout@@ -150,4 +148,17 @@ class Storages::Admin::OAuthClientsController < ApplicationControllerdef find_storage@storage = ::Storages::Storage.find(params[:storage_id])end++ def respond_for_success+ if in_wizard?+ redirect_to(new_admin_settings_storage_path(continue_wizard: @storage.id), status: :see_other)+ else+ update_via_turbo_stream(component: Storages::Admin::OAuthClientInfoComponent.new(@storage))+ respond_with_turbo_streams+ end+ end++ def in_wizard?+ params[:continue_wizard].present?+ endenddiff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rbindex 1b6718ac7c7..3599b0d72f0 100644--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb@@ -75,7 +75,8 @@ class Storages::Admin::StoragesController < ApplicationController.resultend- @target_step = storage_wizard(@storage).prepare_next_step.to_s+ @wizard = storage_wizard(@storage)+ @target_step = @wizard.prepare_next_stependdef upsale; end@@ -105,7 +106,9 @@ class Storages::Admin::StoragesController < ApplicationControllerendend- def edit; end+ def edit+ @wizard = storage_wizard(@storage)+ enddef edit_hostupdate_via_turbo_stream(@@ -141,6 +144,7 @@ class Storages::Admin::StoragesController < ApplicationController))+ @wizard = storage_wizard(@storage)respond_with_turbo_streams do |format|# FIXME: This should be a partial stream updateformat.html { render :edit }@@ -156,6 +160,7 @@ class Storages::Admin::StoragesController < ApplicationControllerrespond_with_turbo_streamselseflash.now[:error] = I18n.t("storages.health_email_notifications.error_could_not_be_saved")+ @wizard = storage_wizard(@storage)render :editendend@@ -185,20 +190,16 @@ class Storages::Admin::StoragesController < ApplicationControllerdef replace_oauth_application@storage.oauth_application.destroyservice_result = ::Storages::OAuthApplications::CreateService.new(storage: @storage, user: current_user).call- @oauth_application = service_result.resultif service_result.success?- update_via_turbo_stream(component: Storages::Admin::GeneralInfoComponent.new(@storage))+ @storage.oauth_application = service_result.result- update_via_turbo_stream(- component: Storages::Admin::OAuthApplicationInfoCopyComponent.new(- oauth_application: @oauth_application,- storage: @storage- )- )+ update_via_turbo_stream(component: Storages::Admin::GeneralInfoComponent.new(@storage))+ update_via_turbo_stream(component: Storages::Admin::OAuthApplicationInfoCopyComponent.new(@storage))respond_with_turbo_streamselse+ @wizard = storage_wizard(@storage)# FIXME: This should be a partial stream updaterender :editenddiff --git a/modules/storages/app/services/storages/wizard.rb b/modules/storages/app/services/storages/wizard.rbindex 344664966bb..b9aa09cc597 100644--- a/modules/storages/app/services/storages/wizard.rb+++ b/modules/storages/app/services/storages/wizard.rb@@ -30,7 +30,7 @@module Storagesclass Wizard- StepDefinition = Data.define(:name, :if, :completed_if, :preparation) do+ StepDefinition = Data.define(:name, :section, :if, :completed_if, :preparation) dodef use_on?(wizard)call_with_model(self.if, wizard)end@@ -63,9 +63,9 @@ module Storagessteps_by_name.valuesend- def step(name, completed_if:, if: ->(_) { true }, preparation: ->(_) {})+ def step(name, completed_if:, if: ->(_) { true }, preparation: ->(_) {}, section: name)name = name.to_sym- steps_by_name[name] = StepDefinition.new(name:, if:, completed_if:, preparation:)+ steps_by_name[name] = StepDefinition.new(name:, section:, if:, completed_if:, preparation:)endend@@ -85,6 +85,10 @@ module Storagesnext_stepend+ def section_name(name)+ steps_by_name.fetch(name).section+ end+def stepsself.class.steps.select { |s| s.use_on?(self) }.map(&:name)enddiff --git a/modules/storages/app/views/storages/admin/automatically_managed_project_folders/edit.html.erb b/modules/storages/app/views/storages/admin/automatically_managed_project_folders/edit.html.erbindex 533b63de450..dc0f540ac11 100644--- a/modules/storages/app/views/storages/admin/automatically_managed_project_folders/edit.html.erb+++ b/modules/storages/app/views/storages/admin/automatically_managed_project_folders/edit.html.erb@@ -29,4 +29,4 @@ See COPYRIGHT and LICENSE files for more details.<% html_title t(:label_administration), t("project_module_storages"), @storage.name, t("storages.page_titles.managed_project_folders.title") %>-<%= render(Storages::Admin::StorageViewComponent.new(@storage, wizard_step: "automatically_managed_project_folders")) %>+<%= render(Storages::Admin::StorageViewComponent.new(@storage, wizard: @wizard, wizard_step: :automatically_managed_folders)) %>diff --git a/modules/storages/app/views/storages/admin/oauth_clients/show_redirect_uri.html.erb b/modules/storages/app/views/storages/admin/oauth_clients/show_redirect_uri.html.erbindex d02d665398a..099985eedfc 100644--- a/modules/storages/app/views/storages/admin/oauth_clients/show_redirect_uri.html.erb+++ b/modules/storages/app/views/storages/admin/oauth_clients/show_redirect_uri.html.erb@@ -27,4 +27,4 @@ See COPYRIGHT and LICENSE files for more details.++#%>-<%= render(Storages::Admin::Forms::RedirectUriFormComponent.new(oauth_client: @storage.oauth_client, storage: @storage, is_complete: true)) %>+<%= render(Storages::Admin::Forms::RedirectUriFormComponent.new(@storage, is_complete: true)) %>diff --git a/modules/storages/app/views/storages/admin/storages/edit.html.erb b/modules/storages/app/views/storages/admin/storages/edit.html.erbindex 4c349bb1a60..55aea48a593 100644--- a/modules/storages/app/views/storages/admin/storages/edit.html.erb+++ b/modules/storages/app/views/storages/admin/storages/edit.html.erb@@ -29,20 +29,15 @@ See COPYRIGHT and LICENSE files for more details.<% html_title t(:label_administration), t(:project_module_storages), t(:label_edit_x, x: @storage.name) %>-<%= content_tag("turbo-frame", id: "page-content") do %>- <%= render(Storages::Admin::EditFormHeaderComponent.new(- storage: @storage,- selected: :edit- ))- %>+ <%= render(Storages::Admin::EditFormHeaderComponent.new(storage: @storage, selected: :edit)) %><%= render(Primer::Alpha::Layout.new(stacking_breakpoint: :lg)) do |component| %><% component.with_main do %>- <%= render(::Storages::Admin::StorageViewComponent.new(@storage)) %>+ <%= render(Storages::Admin::StorageViewComponent.new(@storage, wizard: @wizard)) %><% end %><% component.with_sidebar(col_placement: :end, row_placement: :end) do %>- <%= render(::Storages::Admin::SidePanelComponent.new(storage: @storage)) %>+ <%= render(Storages::Admin::SidePanelComponent.new(storage: @storage)) %><% end %><% end %><% end %>diff --git a/modules/storages/app/views/storages/admin/storages/new.html.erb b/modules/storages/app/views/storages/admin/storages/new.html.erbindex 0845b7d2c2d..0c1a6243ac7 100644--- a/modules/storages/app/views/storages/admin/storages/new.html.erb+++ b/modules/storages/app/views/storages/admin/storages/new.html.erb@@ -26,5 +26,5 @@<% end %><%= content_tag("turbo-frame", id: "page-content") do %>- <%= render(Storages::Admin::StorageViewComponent.new(@storage, wizard_step: @target_step)) %>+ <%= render(Storages::Admin::StorageViewComponent.new(@storage, wizard: @wizard, wizard_step: @target_step)) %><% end %>diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.ymlindex ac149773170..c26e5ade9f1 100644--- a/modules/storages/config/locales/en.yml+++ b/modules/storages/config/locales/en.yml@@ -200,7 +200,7 @@ en:manual_management_description: Create and manage folders per project manually on your own. You will need to manually ensure relevant users have access.setup_incomplete: Select the type of management of user access and folder creation.subtitle: Access management- title: Access and project folders+ access_management_section: Access and project foldersautomatically_managed_folders: Automatically managed foldersgeneral_information: General informationnextcloud_oauth: Nextcloud OAuthdiff --git a/modules/storages/spec/common/storages/peripherals/nextcloud_storage_wizard_spec.rb b/modules/storages/spec/common/storages/peripherals/nextcloud_storage_wizard_spec.rbindex 830dea365ff..d3f4b0a781e 100644--- a/modules/storages/spec/common/storages/peripherals/nextcloud_storage_wizard_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/nextcloud_storage_wizard_spec.rb@@ -45,10 +45,10 @@ RSpec.describe Storages::Peripherals::NextcloudStorageWizard doendit "has all steps pending in correct order" do- expect(wizard.pending_steps).to eq(%i[general_info+ expect(wizard.pending_steps).to eq(%i[general_informationoauth_applicationoauth_client- automatically_managed_project_folders])+ automatically_managed_folders])endcontext "when name and host were set" do@@ -58,8 +58,8 @@ RSpec.describe Storages::Peripherals::NextcloudStorageWizard domodel.save!end- it "has general_info step completed" do- expect(wizard.completed_steps).to eq(%i[general_info])+ it "has general_information step completed" do+ expect(wizard.completed_steps).to eq(%i[general_information])endit "has no oauth_application yet" do@@ -72,7 +72,7 @@ RSpec.describe Storages::Peripherals::NextcloudStorageWizard doendit "automatically finished the oauth_application step" do- expect(wizard.completed_steps).to eq(%i[general_info+ expect(wizard.completed_steps).to eq(%i[general_informationoauth_application])end@@ -90,7 +90,7 @@ RSpec.describe Storages::Peripherals::NextcloudStorageWizard doendit "finishes the oauth_client step" do- expect(wizard.completed_steps).to eq(%i[general_info+ expect(wizard.completed_steps).to eq(%i[general_informationoauth_applicationoauth_client])end@@ -122,10 +122,10 @@ RSpec.describe Storages::Peripherals::NextcloudStorageWizard doendit "has all steps completed" do- expect(wizard.completed_steps).to eq(%i[general_info+ expect(wizard.completed_steps).to eq(%i[general_informationoauth_applicationoauth_client- automatically_managed_project_folders])+ automatically_managed_folders])endendenddiff --git a/modules/storages/spec/common/storages/peripherals/one_drive_storage_wizard_spec.rb b/modules/storages/spec/common/storages/peripherals/one_drive_storage_wizard_spec.rbindex 5ae76703ed1..d06fcd07847 100644--- a/modules/storages/spec/common/storages/peripherals/one_drive_storage_wizard_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/one_drive_storage_wizard_spec.rb@@ -45,7 +45,7 @@ RSpec.describe Storages::Peripherals::OneDriveStorageWizard doendit "has all steps pending in correct order" do- expect(wizard.pending_steps).to eq(%i[general_info+ expect(wizard.pending_steps).to eq(%i[general_informationaccess_managementoauth_clientredirect_uri])@@ -57,8 +57,8 @@ RSpec.describe Storages::Peripherals::OneDriveStorageWizard domodel.save!end- it "has general_info step completed" do- expect(wizard.completed_steps).to eq(%i[general_info])+ it "has general_information step completed" do+ expect(wizard.completed_steps).to eq(%i[general_information])endit "still didn't specify how to manage folders" do@@ -71,7 +71,7 @@ RSpec.describe Storages::Peripherals::OneDriveStorageWizard doendit "automatically finished the access_management step" do- expect(wizard.completed_steps).to eq(%i[general_info+ expect(wizard.completed_steps).to eq(%i[general_informationaccess_management])end@@ -93,7 +93,7 @@ RSpec.describe Storages::Peripherals::OneDriveStorageWizard doendit "finishes the oauth_client step" do- expect(wizard.completed_steps).to eq(%i[general_info+ expect(wizard.completed_steps).to eq(%i[general_informationaccess_managementoauth_client])end@@ -115,7 +115,7 @@ RSpec.describe Storages::Peripherals::OneDriveStorageWizard doit "after some time, the final step is completed" doTimecop.travel(15.seconds.from_now) do- expect(wizard.completed_steps).to eq(%i[general_info+ expect(wizard.completed_steps).to eq(%i[general_informationaccess_managementoauth_clientredirect_uri])diff --git a/modules/storages/spec/components/storages/admin/oauth_client_info_component_spec.rb b/modules/storages/spec/components/storages/admin/oauth_client_info_component_spec.rbindex e638f208e83..72e39108781 100644--- a/modules/storages/spec/components/storages/admin/oauth_client_info_component_spec.rb+++ b/modules/storages/spec/components/storages/admin/oauth_client_info_component_spec.rb@@ -35,7 +35,7 @@ RSpec.describe Storages::Admin::OAuthClientInfoComponent, type: :component do #it "returns false, does not render view component" dostorage = build_stubbed(:nextcloud_storage,oauth_client: build_stubbed(:oauth_client))- component = described_class.new(storage:, oauth_client: storage.oauth_client)+ component = described_class.new(storage)expect(component.edit_icon_button_options).to include(icon: :sync,data: { turbo_confirm:@@ -49,7 +49,7 @@ RSpec.describe Storages::Admin::OAuthClientInfoComponent, type: :component do #context "without oauth client" doit "returns true, renders view component" dostorage = build_stubbed(:nextcloud_storage)- component = described_class.new(storage:, oauth_client: nil)+ component = described_class.new(storage)edit_icon_button_data_options = component.edit_icon_button_optionsexpect(edit_icon_button_data_options).to include(icon: :pencil, data: { turbo_stream: true })diff --git a/modules/storages/spec/services/storages/wizard_spec.rb b/modules/storages/spec/services/storages/wizard_spec.rbindex eeacb58af5c..228bdf4c4ba 100644--- a/modules/storages/spec/services/storages/wizard_spec.rb+++ b/modules/storages/spec/services/storages/wizard_spec.rb@@ -141,4 +141,21 @@ RSpec.describe Storages::Wizard doendendend++ describe "#section_name" do+ let(:wizard_class) do+ Class.new(described_class) do+ step :a, completed_if: ->(i) { i > 0 }+ step :b, completed_if: ->(i) { i > 10 }, section: :c+ end+ end++ it "defaults to the step name" do+ expect(wizard.section_name(:a)).to eq(:a)+ end++ it "uses the name passed by section parameter if present" do+ expect(wizard.section_name(:b)).to eq(:c)+ end+ endend