diff --git a/app/assets/javascripts/admin/controllers/admin-api-keys-new.js b/app/assets/javascripts/admin/controllers/admin-api-keys-new.js index bd9c4463485..f8590220144 100644 --- a/app/assets/javascripts/admin/controllers/admin-api-keys-new.js +++ b/app/assets/javascripts/admin/controllers/admin-api-keys-new.js @@ -3,6 +3,7 @@ import { isBlank } from "@ember/utils"; import Controller from "@ember/controller"; import discourseComputed from "discourse-common/utils/decorators"; import { popupAjaxError } from "discourse/lib/ajax-error"; +import showModal from "discourse/lib/show-modal"; export default Controller.extend({ userModes: [ @@ -48,6 +49,15 @@ export default Controller.extend({ continue() { this.transitionToRoute("adminApiKeys.show", this.model.id); + }, + + showURLs(urls) { + return showModal("admin-api-key-urls", { + admin: true, + model: { + urls + } + }); } } }); diff --git a/app/assets/javascripts/admin/controllers/admin-api-keys-show.js b/app/assets/javascripts/admin/controllers/admin-api-keys-show.js index 6927de87e7d..b907e51b09f 100644 --- a/app/assets/javascripts/admin/controllers/admin-api-keys-show.js +++ b/app/assets/javascripts/admin/controllers/admin-api-keys-show.js @@ -3,6 +3,7 @@ import Controller from "@ember/controller"; import { isEmpty } from "@ember/utils"; import { popupAjaxError } from "discourse/lib/ajax-error"; import { empty } from "@ember/object/computed"; +import showModal from "discourse/lib/show-modal"; export default Controller.extend(bufferedProperty("model"), { isNew: empty("model.id"), @@ -51,6 +52,15 @@ export default Controller.extend(bufferedProperty("model"), { undoRevokeKey(key) { key.undoRevoke().catch(popupAjaxError); + }, + + showURLs(urls) { + return showModal("admin-api-key-urls", { + admin: true, + model: { + urls + } + }); } } }); diff --git a/app/assets/javascripts/admin/templates/api-keys-new.hbs b/app/assets/javascripts/admin/templates/api-keys-new.hbs index 28095418a98..59678c1342a 100644 --- a/app/assets/javascripts/admin/templates/api-keys-new.hbs +++ b/app/assets/javascripts/admin/templates/api-keys-new.hbs @@ -37,12 +37,15 @@ {{/admin-form-row}} {{#unless useGlobalKey}} +
{{i18n "admin.api.scopes.description"}}
{{#each-in scopes as |resource actions|}}{{resource}} | + | {{i18n "admin.api.scopes.allowed_urls"}} | {{i18n "admin.api.scopes.optional_allowed_parameters"}} | ||||||||||
{{input type="checkbox" checked=act.selected}} | -{{act.name}} | +
+ {{act.name}}
+
+ {{d-icon "question-circle"}}
+
+ |
+ + {{d-button icon="link" action=(action "showURLs" act.urls) class="btn-info"}} + |
{{#each act.params as |p|}}
diff --git a/app/assets/javascripts/admin/templates/api-keys-show.hbs b/app/assets/javascripts/admin/templates/api-keys-show.hbs
index 2ffd5c4e025..416771602c8 100644
--- a/app/assets/javascripts/admin/templates/api-keys-show.hbs
+++ b/app/assets/javascripts/admin/templates/api-keys-show.hbs
@@ -81,14 +81,14 @@
{{/admin-form-row}}
{{#if model.api_key_scopes.length}}
- {{#admin-form-row label="admin.api.scopes.title"}}
- {{/admin-form-row}}
+ {{i18n "admin.api.scopes.title"}}
|