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
fix[Op#50737]: configuration check inclusive of one drive
Kabiru Mwenja111d68bf4344
diff --git a/modules/storages/app/components/storages/admin/general_info_component.html.erb b/modules/storages/app/components/storages/admin/general_info_component.html.erbindex 0b3752c92ce..5fbcd3219dc 100644--- a/modules/storages/app/components/storages/admin/general_info_component.html.erb+++ b/modules/storages/app/components/storages/admin/general_info_component.html.erb@@ -2,7 +2,7 @@grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|grid.with_area(:item, tag: :div, mr: 3) doconcat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1, test_selector: 'storage-provider-label')) { I18n.t('storages.file_storage_view.storage_provider') })- concat(configuration_check_label_for(:host_name_configured))+ concat(configuration_check_label)endgrid.with_area(:description, tag: :div, color: :subtle, test_selector: 'storage-description') dodiff --git a/modules/storages/app/components/storages/admin/storage_view_information.rb b/modules/storages/app/components/storages/admin/storage_view_information.rbindex 2b2669d0f4d..fefbd2365c9 100644--- a/modules/storages/app/components/storages/admin/storage_view_information.rb+++ b/modules/storages/app/components/storages/admin/storage_view_information.rb@@ -14,9 +14,17 @@ module Storages::Adminstorage.host].compact.join(' - ')end- def configuration_check_label_for(config)- if storage.configuration_checks[config.to_sym]- status_label(I18n.t('storages.label_connected'), scheme: :success, test_selector: "label-#{config}-status")+ def configuration_check_label+ if storage.provider_type_nextcloud?+ configuration_check_label_for(:host_name_configured)+ elsif storage.provider_type_one_drive?+ configuration_check_label_for(:host_name_configured, :storage_tenant_drive_configured)+ end+ end++ def configuration_check_label_for(*configs)+ if storage.configuration_checks.slice(configs.map(&:to_sym)).values.all?+ status_label(I18n.t('storages.label_completed'), scheme: :success, test_selector: "label-#{config}-status")elsestatus_label(I18n.t('storages.label_incomplete'), scheme: :attention, test_selector: "label-#{config}-status")enddiff --git a/modules/storages/app/models/storages/one_drive_storage.rb b/modules/storages/app/models/storages/one_drive_storage.rbindex 1d2e116cc32..d6c6e0ccc6b 100644--- a/modules/storages/app/models/storages/one_drive_storage.rb+++ b/modules/storages/app/models/storages/one_drive_storage.rb@@ -36,7 +36,11 @@ module Storagesusing ::Storages::Peripherals::ServiceResultRefinementsdef configuration_checks- { storage_oauth_client_configured: oauth_client.present? }+ {+ storage_oauth_client_configured: oauth_client.present?,+ storage_tenant_drive_configured: tenant_id.present? && drive_id.present?,+ host_name_configured: name.present?+ }enddef oauth_configurationdiff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.ymlindex 51af55ffb94..fdad9b5a8e8 100644--- a/modules/storages/config/locales/en.yml+++ b/modules/storages/config/locales/en.yml@@ -182,7 +182,7 @@ en:label_file_links: "File links"label_file_storage: "File storage"label_creation_time: "Creation time"- label_connected: "Connected"+ label_completed: "Completed"label_incomplete: "Incomplete"label_name: "Name"label_host: "Host URL"diff --git a/modules/storages/spec/factories/storage_factory.rb b/modules/storages/spec/factories/storage_factory.rbindex 7f10d56c559..7e1b1e445a8 100644--- a/modules/storages/spec/factories/storage_factory.rb+++ b/modules/storages/spec/factories/storage_factory.rb@@ -38,6 +38,7 @@ FactoryBot.define dotrait :with_oauth_client dooauth_client { build(:oauth_client) }end+ # rubocop:enable FactoryBot/FactoryAssociationWithStrategytrait :as_generic doprovider_type { 'Storages::Storage' }@@ -109,6 +110,8 @@ FactoryBot.define doparent: :storage,class: '::Storages::OneDriveStorage' dohost { nil }+ tenant_id { SecureRandom.uuid }+ drive_id { SecureRandom.uuid }endfactory :sharepoint_dev_drive_storage,diff --git a/modules/storages/spec/models/one_drive_storage_spec.rb b/modules/storages/spec/models/one_drive_storage_spec.rbindex 47d4f45980b..417994ff1df 100644--- a/modules/storages/spec/models/one_drive_storage_spec.rb+++ b/modules/storages/spec/models/one_drive_storage_spec.rb@@ -50,7 +50,9 @@ RSpec.describe Storages::OneDriveStorage doaggregate_failures 'configuration_checks' doexpect(storage.configuration_checks)- .to eq(storage_oauth_client_configured: true)+ .to eq(host_name_configured: true,+ storage_oauth_client_configured: true,+ storage_tenant_drive_configured: true)endendend