Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Move oAuth admin UI to legacy_api_v2 gem
Damian Legawieca2bf45b64073
diff --git a/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erbindex 88dc4fab3d..298347ecdf 100644--- a/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erb@@ -65,7 +65,7 @@<% end %><% end %>- <% if can?(:manage, Spree::OauthApplication) %>+ <% if defined?(Spree::OauthApplication) && can?(:manage, Spree::OauthApplication) %><%= nav_item(Spree.t(:developers), spree.admin_oauth_applications_path, icon: 'terminal', active: %w[oauth_applications webhooks_subscribers].include?(controller_name)) %><% end %>diff --git a/admin/config/routes.rb b/admin/config/routes.rbindex f00c3ba7a1..48b63e502c 100644--- a/admin/config/routes.rb+++ b/admin/config/routes.rb@@ -266,7 +266,6 @@ Spree::Core::Engine.add_routes doend# developer tools- resources :oauth_applicationsresources :api_keys, except: :destroy domember doput :revokediff --git a/admin/spec/features/spree/admin/settings/api_keys_spec.rb b/admin/spec/features/spree/admin/settings/api_keys_spec.rbdeleted file mode 100644index 424892a4f5..0000000000--- a/admin/spec/features/spree/admin/settings/api_keys_spec.rb+++ /dev/null@@ -1,37 +0,0 @@-require 'spec_helper'--describe 'API keys', type: :feature do- stub_authorization!-- let!(:oauth_application) { create(:oauth_application, name: 'Test app') }-- it 'renders a list of applications' do- visit '/admin/oauth_applications'-- expect(page).to have_content('Test app')- end-- it 'can create a new app', js: true do- visit '/admin/oauth_applications/new'-- fill_in 'Name', with: 'My app'- select 'Read & Write', from: 'Scopes'- click_button 'Create'-- expect(page).to have_content('Client ID')- expect(page).to have_content('Client Secret')-- oauth_application = Spree::OauthApplication.last- expect(page).to have_field('Client ID', with: oauth_application.uid, readonly: true)- end-- it 'can modify existing app' do- visit "/admin/oauth_applications/#{oauth_application.id}/edit"-- fill_in 'Name', with: 'New name'- within('#page-header') { click_button 'Update' }-- expect(page).to have_content('successfully updated!')- expect(page).to have_content('New name')- end-enddiff --git a/docs/developer/admin/extending-ui.mdx b/docs/developer/admin/extending-ui.mdxindex eb60676300..cdecc50ed0 100644--- a/docs/developer/admin/extending-ui.mdx+++ b/docs/developer/admin/extending-ui.mdx@@ -780,32 +780,6 @@ Here's a list of all places you can inject your custom code:</Accordion></AccordionGroup>-### OAuth Applications--<AccordionGroup>- <Accordion title="OAuth Applications Actions">- `oauth_applications_actions`-- Injects code into the page actions area for the OAuth applications list page.-- ```erb- <%= link_to "Security Audit", oauth_security_audit_path, class: "btn btn-secondary" %>- ```- </Accordion>-- <Accordion title="OAuth Applications Header">- `oauth_applications_header`-- Injects code between the page header and the main content area for the OAuth applications list page.-- ```erb- <div class="alert alert-warning">- <strong>Security:</strong> Review OAuth applications regularly.- </div>- ```- </Accordion>-</AccordionGroup>-### Option Types<AccordionGroup>diff --git a/admin/app/controllers/spree/admin/oauth_applications_controller.rb b/legacy_api_v2/app/controllers/spree/admin/oauth_applications_controller.rbsimilarity index 100%rename from admin/app/controllers/spree/admin/oauth_applications_controller.rbrename to legacy_api_v2/app/controllers/spree/admin/oauth_applications_controller.rbdiff --git a/admin/app/views/spree/admin/oauth_applications/_form.html.erb b/legacy_api_v2/app/views/spree/admin/oauth_applications/_form.html.erbsimilarity index 100%rename from admin/app/views/spree/admin/oauth_applications/_form.html.erbrename to legacy_api_v2/app/views/spree/admin/oauth_applications/_form.html.erbdiff --git a/admin/app/views/spree/admin/oauth_applications/_table_header.html.erb b/legacy_api_v2/app/views/spree/admin/oauth_applications/_table_header.html.erbsimilarity index 100%rename from admin/app/views/spree/admin/oauth_applications/_table_header.html.erbrename to legacy_api_v2/app/views/spree/admin/oauth_applications/_table_header.html.erbdiff --git a/admin/app/views/spree/admin/oauth_applications/_table_row.html.erb b/legacy_api_v2/app/views/spree/admin/oauth_applications/_table_row.html.erbsimilarity index 100%rename from admin/app/views/spree/admin/oauth_applications/_table_row.html.erbrename to legacy_api_v2/app/views/spree/admin/oauth_applications/_table_row.html.erbdiff --git a/admin/app/views/spree/admin/oauth_applications/create.turbo_stream.erb b/legacy_api_v2/app/views/spree/admin/oauth_applications/create.turbo_stream.erbsimilarity index 100%rename from admin/app/views/spree/admin/oauth_applications/create.turbo_stream.erbrename to legacy_api_v2/app/views/spree/admin/oauth_applications/create.turbo_stream.erbdiff --git a/admin/app/views/spree/admin/oauth_applications/edit.html.erb b/legacy_api_v2/app/views/spree/admin/oauth_applications/edit.html.erbsimilarity index 100%rename from admin/app/views/spree/admin/oauth_applications/edit.html.erbrename to legacy_api_v2/app/views/spree/admin/oauth_applications/edit.html.erbdiff --git a/admin/app/views/spree/admin/oauth_applications/index.html.erb b/legacy_api_v2/app/views/spree/admin/oauth_applications/index.html.erbsimilarity index 100%rename from admin/app/views/spree/admin/oauth_applications/index.html.erbrename to legacy_api_v2/app/views/spree/admin/oauth_applications/index.html.erbdiff --git a/admin/app/views/spree/admin/oauth_applications/new.html.erb b/legacy_api_v2/app/views/spree/admin/oauth_applications/new.html.erbsimilarity index 100%rename from admin/app/views/spree/admin/oauth_applications/new.html.erbrename to legacy_api_v2/app/views/spree/admin/oauth_applications/new.html.erbdiff --git a/legacy_api_v2/config/routes.rb b/legacy_api_v2/config/routes.rbindex 62e0e9a356..927b48c4da 100644--- a/legacy_api_v2/config/routes.rb+++ b/legacy_api_v2/config/routes.rb@@ -7,6 +7,11 @@ Rails.application.routes.draw doendSpree::Core::Engine.add_routes do+ # Admin UI to manage OAuth applications+ namespace :admin do+ resources :oauth_applications+ end+namespace :api, defaults: { format: 'json' } donamespace :v2 donamespace :storefront dodiff --git a/admin/spec/controllers/spree/admin/oauth_applications_controller_spec.rb b/legacy_api_v2/spec/controllers/spree/admin/oauth_applications_controller_spec.rbsimilarity index 100%rename from admin/spec/controllers/spree/admin/oauth_applications_controller_spec.rbrename to legacy_api_v2/spec/controllers/spree/admin/oauth_applications_controller_spec.rb