discourse/app/assets/javascripts/admin/addon/routes/admin-plugins-show.js
Jarek Radosz 038e5deb2a
DEV: Clean up imports (#28060)
* `@ember/owner` instead of `@ember/application`
* `discourse-i18n` instead of `I18n`
* `{ service } from "@ember/service"` instead of `inject as service`
2024-07-25 15:09:06 +02:00

25 lines
709 B
JavaScript

import Route from "@ember/routing/route";
import { service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { sanitize } from "discourse/lib/text";
import AdminPlugin from "admin/models/admin-plugin";
export default class AdminPluginsShowRoute extends Route {
@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;
}
}