mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 06:43:39 +08:00
9afb0b29f8
With the new admin sidebar restructure, we have a link to "Installed plugins". We would like to ensure that when the admin is searching for a plugin name like "akismet" or "automation" this link will be visible. Also when entering the plugins page, related plugins should be highlighted.
49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
import { tracked } from "@glimmer/tracking";
|
|
import { service } from "@ember/service";
|
|
import PreloadStore from "discourse/lib/preload-store";
|
|
import { ADMIN_PANEL, MAIN_PANEL } from "discourse/lib/sidebar/panels";
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
|
import I18n from "discourse-i18n";
|
|
|
|
export default class AdminRoute extends DiscourseRoute {
|
|
@service sidebarState;
|
|
@service siteSettings;
|
|
@service store;
|
|
@service currentUser;
|
|
@service adminSidebarStateManager;
|
|
@tracked initialSidebarState;
|
|
|
|
titleToken() {
|
|
return I18n.t("admin_title");
|
|
}
|
|
|
|
activate() {
|
|
if (this.currentUser.use_admin_sidebar) {
|
|
this.sidebarState.setPanel(ADMIN_PANEL);
|
|
this.sidebarState.setSeparatedMode();
|
|
this.sidebarState.hideSwitchPanelButtons();
|
|
}
|
|
|
|
this.controllerFor("application").setProperties({
|
|
showTop: false,
|
|
});
|
|
|
|
const visiblePlugins = PreloadStore.get("visiblePlugins");
|
|
if (visiblePlugins) {
|
|
this.adminSidebarStateManager.keywords.admin_installed_plugins = {
|
|
navigation: visiblePlugins.mapBy("name"),
|
|
};
|
|
}
|
|
}
|
|
|
|
deactivate(transition) {
|
|
this.controllerFor("application").set("showTop", true);
|
|
|
|
if (this.currentUser.use_admin_sidebar) {
|
|
if (!transition?.to.name.startsWith("admin")) {
|
|
this.sidebarState.setPanel(MAIN_PANEL);
|
|
}
|
|
}
|
|
}
|
|
}
|