mirror of
https://github.com/discourse/discourse.git
synced 2024-12-22 20:16:28 +08:00
61c1d35f17
This commit converts the current chat plugin UI into the new "show plugin" UI already followed by AI and Gamification. In the process, I also: * Made a dedicated /new route to create new webhooks * Converted the webhook form to FormKit * Made some fixes and improvements to the `AdminPluginConfigPage`, `AdminPageHeader`, and `AdminPageSubheader` generic components, so more plugins can adopt the UI guidelines too. This includes adding a header outlet so plugins can add action buttons to the plugin show page header. * Fixes the submit button loading state for FormKit (by Joffrey) --------- Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
29 lines
822 B
JavaScript
29 lines
822 B
JavaScript
import { service } from "@ember/service";
|
|
import { ajax } from "discourse/lib/ajax";
|
|
import { sanitize } from "discourse/lib/text";
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
|
import AdminPlugin from "admin/models/admin-plugin";
|
|
|
|
export default class AdminPluginsShowRoute extends DiscourseRoute {
|
|
@service router;
|
|
@service adminPluginNavManager;
|
|
|
|
async model(params) {
|
|
const pluginId = sanitize(params.plugin_id).substring(0, 100);
|
|
const pluginAttrs = await ajax(`/admin/plugins/${pluginId}.json`);
|
|
return AdminPlugin.create(pluginAttrs);
|
|
}
|
|
|
|
afterModel(model) {
|
|
this.adminPluginNavManager.currentPlugin = model;
|
|
}
|
|
|
|
deactivate() {
|
|
this.adminPluginNavManager.currentPlugin = null;
|
|
}
|
|
|
|
titleToken() {
|
|
return this.adminPluginNavManager.currentPlugin.nameTitleized;
|
|
}
|
|
}
|