DEV: Update modal to component API (#269)

<img width="622" alt="Screenshot 2023-12-06 at 12 10 09 PM" src="https://github.com/discourse/discourse-data-explorer/assets/50783505/5a6fb0b2-829c-4af3-93c9-91676b78ab59">
This commit is contained in:
Isaac Janzen 2023-12-07 11:49:35 -07:00 committed by GitHub
parent ac7df5e3d0
commit 3dd5ad0f9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 8 deletions

View File

@ -0,0 +1,19 @@
import DModal from "discourse/components/d-modal";
import htmlSafe from "discourse-common/helpers/html-safe";
import i18n from "discourse-common/helpers/i18n";
const QueryHelp = <template>
<DModal
@title={{i18n "explorer.help.modal_title"}}
@closeModal={{@closeModal}}
>
<:body>
{{htmlSafe (i18n "explorer.help.auto_resolution")}}
{{htmlSafe (i18n "explorer.help.custom_params")}}
{{htmlSafe (i18n "explorer.help.default_values")}}
{{htmlSafe (i18n "explorer.help.data_types")}}
</:body>
</DModal>
</template>;
export default QueryHelp;

View File

@ -5,14 +5,15 @@ import { inject as service } from "@ember/service";
import { Promise } from "rsvp";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import showModal from "discourse/lib/show-modal";
import { bind } from "discourse-common/utils/decorators";
import I18n from "I18n";
import QueryHelp from "discourse/plugins/discourse-data-explorer/discourse/components/modal/query-help";
import Query from "discourse/plugins/discourse-data-explorer/discourse/models/query";
const NoQuery = Query.create({ name: "No queries", fake: true, group_ids: [] });
export default class PluginsExplorerController extends Controller {
@service modal;
@service dialog;
@service appEvents;
@service router;
@ -270,7 +271,7 @@ export default class PluginsExplorerController extends Controller {
@action
showHelpModal() {
showModal("query-help");
this.modal.show(QueryHelp);
}
@action

View File

@ -1,6 +0,0 @@
<DModalBody @title="explorer.help.modal_title">
{{html-safe (i18n "explorer.help.auto_resolution")}}
{{html-safe (i18n "explorer.help.custom_params")}}
{{html-safe (i18n "explorer.help.default_values")}}
{{html-safe (i18n "explorer.help.data_types")}}
</DModalBody>