grafana/public/app/features/plugins/routes.ts
Marcus Andersson 52bd1eb1c5
Plugins: converted the plugins admin app to a core feature in grafana (#36026)
* moved the plugins admin to core and used the plugins toggle to decide which version to use.

* reverted change.

* changed so the library tab is the default one.

* fixing navigation.
#

* fixed so we have the proper header.

* including the core plugins

* fixed so we display logos for local plugins.

* fixed so we have a working version of plugin catalog.

* removed console logs.

* reverted changes.

* fixing failed test.
2021-07-08 17:50:42 +02:00

40 lines
1.3 KiB
TypeScript

import { SafeDynamicImport } from 'app/core/components/DynamicImports/SafeDynamicImport';
import { config } from 'app/core/config';
import { RouteDescriptor } from 'app/core/navigation/types';
export function getPluginsAdminRoutes(cfg = config): RouteDescriptor[] {
if (!cfg.pluginAdminEnabled) {
return [
{
path: '/plugins',
component: SafeDynamicImport(() => import(/* webpackChunkName: "PluginListPage" */ './PluginListPage')),
},
{
path: '/plugins/browse',
component: SafeDynamicImport(
() => import(/* webpackChunkName: "PluginAdminNotEnabled" */ './admin/pages/NotEnabed')
),
},
{
path: '/plugins/:pluginId/',
component: SafeDynamicImport(() => import(/* webpackChunkName: "PluginPage" */ './PluginPage')),
},
];
}
return [
{
path: '/plugins',
component: SafeDynamicImport(() => import(/* webpackChunkName: "PluginListPage" */ './admin/pages/Browse')),
},
{
path: '/plugins/browse',
component: SafeDynamicImport(() => import(/* webpackChunkName: "PluginListPage" */ './admin/pages/Browse')),
},
{
path: '/plugins/:pluginId/',
component: SafeDynamicImport(() => import(/* webpackChunkName: "PluginPage" */ './admin/pages/PluginDetails')),
},
];
}