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

[51372] Disabled form submit for redirect URI when complete

Andreas Pfohl61fe39bc1a47
diff --git a/modules/storages/app/components/storages/admin/forms/redirect_uri_form_component.html.erb b/modules/storages/app/components/storages/admin/forms/redirect_uri_form_component.html.erb
index 231d77444ef..4c98e07c6f0 100644
--- a/modules/storages/app/components/storages/admin/forms/redirect_uri_form_component.html.erb
+++ b/modules/storages/app/components/storages/admin/forms/redirect_uri_form_component.html.erb
@@ -12,6 +12,8 @@
) do |form|
flex_layout do |oauth_client_row|
oauth_client_row.with_row(mb: 3) do
+ # concat(render(Storages::Admin::StorageIsCompleteHiddenInputForm.new(form)))
+
concat(render(Primer::OpenProject::InputGroup.new(input_width: :large)) do |input_group|
input_group.with_text_input(
name: :oauth_client_redirect_uri,
@@ -48,7 +50,7 @@
form,
storage:,
submit_button_options: {
- disabled: submit_button_disabled?,
+ disabled: submit_button_disabled? || @options[:is_complete],
label: I18n.t('storages.buttons.done_complete_setup'),
data: {
'storages--oauth-client-form-target': 'submitButton',
diff --git a/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb b/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb
index 69a4d56b45c..7550f9c24d9 100644
--- a/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb
+++ b/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb
@@ -119,6 +119,7 @@ class Storages::Admin::OAuthClientsController < ApplicationController
def finish_setup
flash[:primer_banner] = { message: I18n.t(:'storages.notice_successful_storage_connection'), scheme: :success }
+
redirect_to admin_settings_storages_path
end
diff --git a/modules/storages/app/forms/storages/admin/provider_type_hidden_input_form.rb b/modules/storages/app/forms/storages/admin/provider_type_hidden_input_form.rb
index 1a03e7c7ccd..6abdf03bb95 100644
--- a/modules/storages/app/forms/storages/admin/provider_type_hidden_input_form.rb
+++ b/modules/storages/app/forms/storages/admin/provider_type_hidden_input_form.rb
@@ -29,10 +29,9 @@
module Storages::Admin
class ProviderTypeHiddenInputForm < ApplicationForm
form do |storage_form|
- storage_form.text_field(
+ storage_form.hidden(
name: :provider_type,
label: I18n.t('activerecord.attributes.storages/storage.provider_type'),
- hidden: true,
required: true,
value: @storage.provider_type
)
diff --git a/modules/storages/app/views/storages/admin/oauth_clients/create.turbo_stream.erb b/modules/storages/app/views/storages/admin/oauth_clients/create.turbo_stream.erb
index 03e1101d3ff..be86f49d6ed 100644
--- a/modules/storages/app/views/storages/admin/oauth_clients/create.turbo_stream.erb
+++ b/modules/storages/app/views/storages/admin/oauth_clients/create.turbo_stream.erb
@@ -32,7 +32,7 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
<%= turbo_stream.update :storage_redirect_uri_section do %>
- <%= render(Storages::Admin::Forms::RedirectUriFormComponent.new(oauth_client: @oauth_client, storage: @storage)) %>
+ <%= render(Storages::Admin::Forms::RedirectUriFormComponent.new(oauth_client: @oauth_client, storage: @storage, is_complete: false)) %>
<% end %>
<% if @storage.provider_type_nextcloud? && @storage.automatic_management_new_record? %>
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.erb
index 211607dd3a4..c003d49d24b 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
@@ -28,5 +28,5 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<%= render(OpTurbo::FrameComponent.new(id: :storage_redirect_uri_section)) do %>
- <%= render(Storages::Admin::Forms::RedirectUriFormComponent.new(oauth_client: @storage.oauth_client, storage: @storage)) %>
+ <%= render(Storages::Admin::Forms::RedirectUriFormComponent.new(oauth_client: @storage.oauth_client, storage: @storage, is_complete: true)) %>
<% end %>