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:
@@ -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);
|
||||
Reference in New Issue
Block a user