mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
AppPlugins: Remove unused angular plugin page files (#41569)
* AppPlugins: Remove unused angular plugin page files * Remove more unused bits
This commit is contained in:
parent
25ad916473
commit
e4a499b957
@ -50,9 +50,6 @@ export class AppPlugin<T = KeyValue> extends GrafanaPlugin<AppPluginMeta<T>> {
|
||||
root?: ComponentClass<AppRootProps<T>>;
|
||||
rootNav?: NavModel; // Initial navigation model
|
||||
|
||||
// Old style pages
|
||||
angularPages?: { [component: string]: any };
|
||||
|
||||
/**
|
||||
* Called after the module has loaded, and before the app is used.
|
||||
* This function may be called multiple times on the same instance.
|
||||
@ -88,12 +85,6 @@ export class AppPlugin<T = KeyValue> extends GrafanaPlugin<AppPluginMeta<T>> {
|
||||
console.warn('App Page uses unknown component: ', include.component, this.meta);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!this.angularPages) {
|
||||
this.angularPages = {};
|
||||
}
|
||||
|
||||
this.angularPages[include.component] = exp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
import './plugin_page_ctrl';
|
||||
import './datasource_srv';
|
||||
import './plugin_component';
|
||||
import './variableQueryEditorLoader';
|
||||
|
@ -1,12 +0,0 @@
|
||||
<div ng-if="ctrl.navModel">
|
||||
<page-header model="ctrl.navModel"></page-header>
|
||||
|
||||
<div class="page-container">
|
||||
<div ng-if="ctrl.page">
|
||||
<plugin-component type="app-page">
|
||||
</plugin-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer />
|
@ -186,23 +186,6 @@ function pluginDirectiveLoader(
|
||||
};
|
||||
});
|
||||
}
|
||||
// App Page
|
||||
case 'app-page': {
|
||||
const appModel = scope.ctrl.appModel;
|
||||
return importAppPlugin(appModel).then((appPlugin) => {
|
||||
if (!appPlugin.angularPages) {
|
||||
throw new Error('Plugin has no page components');
|
||||
}
|
||||
|
||||
return {
|
||||
baseUrl: appModel.baseUrl,
|
||||
name: 'app-page-' + appModel.id + '-' + scope.ctrl.page.slug,
|
||||
bindings: { appModel: '=' },
|
||||
attrs: { 'app-model': 'ctrl.appModel' },
|
||||
Component: appPlugin.angularPages[scope.ctrl.page.component],
|
||||
};
|
||||
});
|
||||
}
|
||||
// Panel
|
||||
case 'panel': {
|
||||
return loadPanelComponentInfo(scope, attrs);
|
||||
|
@ -1,62 +0,0 @@
|
||||
import angular from 'angular';
|
||||
import { find } from 'lodash';
|
||||
|
||||
import { getPluginSettings } from './PluginSettingsCache';
|
||||
import { PluginMeta, AppEvents } from '@grafana/data';
|
||||
import { GrafanaRootScope } from 'app/angular/GrafanaCtrl';
|
||||
import { promiseToDigest } from '../../angular/promiseToDigest';
|
||||
import { NavModelSrv } from 'app/angular/services/nav_model_srv';
|
||||
|
||||
export class AppPageCtrl {
|
||||
page: any;
|
||||
pluginId: any;
|
||||
appModel: any;
|
||||
navModel: any;
|
||||
|
||||
/** @ngInject */
|
||||
constructor(private $routeParams: any, private $rootScope: GrafanaRootScope, private navModelSrv: NavModelSrv) {
|
||||
this.pluginId = $routeParams.pluginId;
|
||||
|
||||
promiseToDigest($rootScope)(
|
||||
Promise.resolve(getPluginSettings(this.pluginId))
|
||||
.then((settings) => {
|
||||
this.initPage(settings);
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$rootScope.appEvent(AppEvents.alertError, ['Unknown Plugin']);
|
||||
this.navModel = this.navModelSrv.getNotFoundNav();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
initPage(app: PluginMeta) {
|
||||
this.appModel = app;
|
||||
this.page = find(app.includes, { slug: this.$routeParams.slug });
|
||||
|
||||
if (!this.page) {
|
||||
this.$rootScope.appEvent(AppEvents.alertError, ['App Page Not Found']);
|
||||
this.navModel = this.navModelSrv.getNotFoundNav();
|
||||
return;
|
||||
}
|
||||
|
||||
if (app.type !== 'app' || !app.enabled) {
|
||||
this.$rootScope.appEvent(AppEvents.alertError, ['Application Not Enabled']);
|
||||
this.navModel = this.navModelSrv.getNotFoundNav();
|
||||
return;
|
||||
}
|
||||
|
||||
const pluginNav = this.navModelSrv.getNav('plugin-page-' + app.id);
|
||||
|
||||
this.navModel = {
|
||||
main: {
|
||||
img: app.info.logos.large,
|
||||
subTitle: app.name,
|
||||
url: '',
|
||||
text: this.page.name,
|
||||
breadcrumbs: [{ title: app.name, url: pluginNav.main.url }],
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('grafana.controllers').controller('AppPageCtrl', AppPageCtrl);
|
@ -324,13 +324,6 @@ export function getAppRoutes(): RouteDescriptor[] {
|
||||
() => import(/* webpackChunkName: "SnapshotListPage" */ 'app/features/manage-dashboards/SnapshotListPage')
|
||||
),
|
||||
},
|
||||
// TODO[Router]
|
||||
// {
|
||||
// path: '/plugins/:pluginId/page/:slug',
|
||||
// templateUrl: 'public/app/features/plugins/partials/plugin_page.html',
|
||||
// controller: 'AppPageCtrl',
|
||||
// controllerAs: 'ctrl',
|
||||
// },
|
||||
{
|
||||
path: '/playlists',
|
||||
component: SafeDynamicImport(
|
||||
|
Loading…
Reference in New Issue
Block a user