mirror of
https://github.com/discourse/discourse.git
synced 2024-12-11 16:23:44 +08:00
48193767bf
Automatically generated by `eslint --fix` to satisfy the updated configuration
37 lines
774 B
JavaScript
37 lines
774 B
JavaScript
import Controller from "@ember/controller";
|
|
import { inject as service } from "@ember/service";
|
|
|
|
export default class AdminPluginsController extends Controller {
|
|
@service router;
|
|
|
|
get adminRoutes() {
|
|
return this.allAdminRoutes.filter((route) =>
|
|
this.routeExists(route.full_location)
|
|
);
|
|
}
|
|
|
|
get brokenAdminRoutes() {
|
|
return this.allAdminRoutes.filter(
|
|
(route) => !this.routeExists(route.full_location)
|
|
);
|
|
}
|
|
|
|
get allAdminRoutes() {
|
|
return this.model
|
|
.filter((plugin) => plugin?.enabled)
|
|
.map((plugin) => {
|
|
return plugin.adminRoute;
|
|
})
|
|
.filter(Boolean);
|
|
}
|
|
|
|
routeExists(routeName) {
|
|
try {
|
|
this.router.urlFor(routeName);
|
|
return true;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|