DEV: Convert `api-key-urls` modal to component-based API (#22913)

<img width="474" alt="Screenshot 2023-08-01 at 1 29 26 PM" src="https://github.com/discourse/discourse/assets/50783505/1a46901f-8231-46fb-8c36-cb441b7fd883">
This commit is contained in:
Isaac Janzen 2023-08-01 14:51:18 -05:00 committed by GitHub
parent 50d527b80c
commit da6ddb638f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 18 deletions

View File

@ -0,0 +1,16 @@
<DModal
@title={{i18n "admin.api.scopes.allowed_urls"}}
@closeModal={{@closeModal}}
>
<:body>
<div>
<ul>
{{#each @model.urls as |url|}}
<li>
<code>{{url}}</code>
</li>
{{/each}}
</ul>
</div>
</:body>
</DModal>

View File

@ -5,12 +5,13 @@ import discourseComputed from "discourse-common/utils/decorators";
import { isBlank } from "@ember/utils";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { action, get } from "@ember/object";
import showModal from "discourse/lib/show-modal";
import { ajax } from "discourse/lib/ajax";
import { inject as service } from "@ember/service";
import ApiKeyUrlsModal from "../components/modal/api-key-urls";
export default class AdminApiKeysNewController extends Controller {
@service router;
@service modal;
userModes = [
{ id: "all", name: I18n.t("admin.api.all_users") },
@ -84,8 +85,7 @@ export default class AdminApiKeysNewController extends Controller {
@action
showURLs(urls) {
return showModal("admin-api-key-urls", {
admin: true,
this.modal.show(ApiKeyUrlsModal, {
model: { urls },
});
}

View File

@ -4,13 +4,14 @@ import Controller from "@ember/controller";
import { bufferedProperty } from "discourse/mixins/buffered-content";
import { isEmpty } from "@ember/utils";
import { popupAjaxError } from "discourse/lib/ajax-error";
import showModal from "discourse/lib/show-modal";
import { inject as service } from "@ember/service";
import ApiKeyUrlsModal from "../components/modal/api-key-urls";
export default class AdminApiKeysShowController extends Controller.extend(
bufferedProperty("model")
) {
@service router;
@service modal;
@empty("model.id") isNew;
@ -67,8 +68,7 @@ export default class AdminApiKeysShowController extends Controller.extend(
@action
showURLs(urls) {
return showModal("admin-api-key-urls", {
admin: true,
this.modal.show(ApiKeyUrlsModal, {
model: {
urls,
},

View File

@ -1,11 +0,0 @@
<DModalBody @title="admin.api.scopes.allowed_urls">
<div>
<ul>
{{#each this.model.urls as |url|}}
<li>
<code>{{url}}</code>
</li>
{{/each}}
</ul>
</div>
</DModalBody>

View File

@ -49,7 +49,6 @@ const KNOWN_LEGACY_MODALS = [
"topic-summary",
"user-status",
"admin-watched-word-test",
"admin-api-key-urls",
"admin-delete-user-posts-progress",
"admin-install-theme",
"admin-penalize-user",