From b1bae9b785faef025c5d05f1eb94337c4867eeca Mon Sep 17 00:00:00 2001 From: Ted Johansson Date: Fri, 10 Jan 2025 10:21:22 +0800 Subject: [PATCH] FIX: Add back missing API key 'peek' step (#30683) In #30096 we converted the API keys UI to follow the new admin UI guidelines. During this conversion, the step where you get a chance to copy the API key after creating, was lost due to a rebase mistake. This re-introduces it. --- .../admin-config-areas/api-keys-new.gjs | 308 +++++++++--------- app/assets/stylesheets/common/admin/api.scss | 4 + config/locales/client.en.yml | 1 + spec/system/admin_api_keys_spec.rb | 4 + spec/system/page_objects/admin_api_keys.rb | 8 + 5 files changed, 179 insertions(+), 146 deletions(-) diff --git a/app/assets/javascripts/admin/addon/components/admin-config-areas/api-keys-new.gjs b/app/assets/javascripts/admin/addon/components/admin-config-areas/api-keys-new.gjs index 923c97e5ee6..c7f2b8efcbd 100644 --- a/app/assets/javascripts/admin/addon/components/admin-config-areas/api-keys-new.gjs +++ b/app/assets/javascripts/admin/addon/components/admin-config-areas/api-keys-new.gjs @@ -24,6 +24,8 @@ export default class AdminConfigAreasApiKeysNew extends Component { @tracked loadingScopes = false; @tracked scopes = null; + @tracked generatedApiKey = null; + userModes = [ { id: "all", name: i18n("admin.api.all_users") }, { id: "single", name: i18n("admin.api.single_user") }, @@ -93,8 +95,8 @@ export default class AdminConfigAreasApiKeysNew extends Component { } try { - await this.store.createRecord("api-key").save(payload); - this.router.transitionTo("adminApiKeys"); + const result = await this.store.createRecord("api-key").save(payload); + this.generatedApiKey = result.payload.key; } catch (error) { popupAjaxError(error); } @@ -148,169 +150,183 @@ export default class AdminConfigAreasApiKeysNew extends Component {