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

chore[#47147]: render provider type as text in edit mode for consistency

Kabiru Mwenja7c43f7b089d8
diff --git a/modules/storages/app/views/storages/admin/storages/_form.html.erb b/modules/storages/app/views/storages/admin/storages/_form.html.erb
index 47d8fa1c825..19a86bc9c08 100644
--- a/modules/storages/app/views/storages/admin/storages/_form.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/_form.html.erb
@@ -33,17 +33,25 @@ See COPYRIGHT and LICENSE files for more details.
<fieldset class="form--fieldset">
<legend class="form--fieldset-legend"><%= I18n.t(:label_general) %></legend>
<div class="form--field -required">
- <%= f.hidden_field :provider_type %>
- <%= f.select :provider_type,
- ::Storages::Storage::PROVIDER_TYPES.map { |provider_type| [I18n.t("storages.provider_types.#{provider_type}.name"), provider_type] },
- {
- selected: ::Storages::Storage::PROVIDER_TYPE_NEXTCLOUD,
- container_class: '-slim'
- },
- {
- disabled: @object.persisted? || ::Storages::Storage::PROVIDER_TYPES.count == 1
- } %>
- <span class="form--field-instructions"><%= t('storages.instructions.type') %> <%= t('storages.instructions.type_link_text') %></span>
+ <% case action_name %>
+ <% when 'new' %>
+ <%= f.hidden_field :provider_type %>
+ <%= f.select :provider_type,
+ ::Storages::Storage::PROVIDER_TYPES.map { |provider_type| [I18n.t("storages.provider_types.#{provider_type}.name"), provider_type] },
+ {
+ selected: ::Storages::Storage::PROVIDER_TYPE_NEXTCLOUD,
+ container_class: '-slim'
+ }
+ %>
+ <span class="form--field-instructions"><%= t('storages.instructions.type') %> <%= t('storages.instructions.type_link_text') %></span>
+ <% when 'edit' %>
+ <%= f.label :provider_type, class: "form--label" do %>
+ <%= t(:"storages.label_provider_type") %>
+ <% end %>
+ <div class="form--field-container -horizontal">
+ <span><%= @object.name %></span>
+ </div>
+ <% end %>
</div>
<div class="form--field -required">
<%= f.text_field :name,
diff --git a/modules/storages/spec/features/admin_storages_spec.rb b/modules/storages/spec/features/admin_storages_spec.rb
index 4466f961202..53fc7394130 100644
--- a/modules/storages/spec/features/admin_storages_spec.rb
+++ b/modules/storages/spec/features/admin_storages_spec.rb
@@ -47,7 +47,7 @@ describe 'Admin storages', :storage_server_helpers, js: true do
# Create a storage - happy path
expect(page).to have_title('New storage')
expect(page.find('.title-container')).to have_text('New storage')
- expect(page).to have_select 'storages_storage[provider_type]', selected: 'Nextcloud', disabled: true
+ expect(page).to have_select('storages_storage[provider_type]', selected: 'Nextcloud')
expect(page).to have_field('storages_storage[name]', with: 'My Nextcloud')
# Test the happy path for a valid storage server (host).
@@ -102,6 +102,8 @@ describe 'Admin storages', :storage_server_helpers, js: true do
# Edit storage again
page.find('.button--icon.icon-edit').click
expect(page).to have_title("Edit: NC 1")
+ expect(page).not_to have_select("storages_storage[provider_type]")
+ expect(page).to have_text("NC 1")
expect(page.find('.title-container')).to have_text('Edit: NC 1')
# Edit page - With option to replace the OAuth2 client