Skip to content

Commit

Permalink
feat[Op#50985]: Use Primer Flash for Administration settings with Primer
Browse files Browse the repository at this point in the history
  • Loading branch information
akabiru committed Nov 22, 2023
1 parent b60360a commit c878c0e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ def create
service_result = call_update_service

if service_result.success?
flash[:notice] = I18n.t(:'storages.notice_successful_storage_connection')
flash[:primer_flash] = {
message: I18n.t(:'storages.notice_successful_storage_connection'),
scheme: :success,
dismissible: true,
full: true
}
redirect_to admin_settings_storages_path
else
respond_to do |format|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ def create # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
format.turbo_stream { render :create }
end
elsif @storage.provider_type_one_drive?
flash[:notice] = I18n.t(:'storages.notice_successful_storage_connection')
flash[:primer_flash] = {
message: I18n.t(:'storages.notice_successful_storage_connection'),
scheme: :success,
dismissible: true,
full: true
}
redirect_to admin_settings_storages_path
else
raise "Unsupported provider type: #{@storage.short_provider_type}"
Expand Down
10 changes: 6 additions & 4 deletions modules/storages/spec/features/admin_storages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,9 @@
end

expect(page).to have_current_path(admin_settings_storages_path)
expect(page).to have_text("Storage connected successfully! Remember to activate the module and the specific " \
"storage in the project settings of each desired project to use it.")
expect(page.find_by_id('flash-message-component'))
.to have_text("Storage connected successfully! Remember to activate the module and the specific " \
"storage in the project settings of each desired project to use it.")
end
end
end
Expand Down Expand Up @@ -283,8 +284,9 @@
end

expect(page).to have_current_path(admin_settings_storages_path)
wait_for(page).to have_text("Storage connected successfully! Remember to activate the module and the specific " \
"storage in the project settings of each desired project to use it.")
wait_for(page.find_by_id('flash-message-component'))
.to have_text("Storage connected successfully! Remember to activate the module and the specific " \
"storage in the project settings of each desired project to use it.")
end
end
end
Expand Down

0 comments on commit c878c0e

Please sign in to comment.