2016-02-09 04:17:49 -06:00
|
|
|
///<reference path="../../headers/common.d.ts" />
|
|
|
|
|
|
|
|
import angular from 'angular';
|
|
|
|
import _ from 'lodash';
|
|
|
|
|
|
|
|
export class AppPageCtrl {
|
|
|
|
page: any;
|
2016-02-29 01:50:02 -06:00
|
|
|
pluginId: any;
|
2016-02-09 04:17:49 -06:00
|
|
|
appModel: any;
|
|
|
|
|
|
|
|
/** @ngInject */
|
|
|
|
constructor(private backendSrv, private $routeParams: any, private $rootScope) {
|
2016-02-29 01:50:02 -06:00
|
|
|
this.pluginId = $routeParams.pluginId;
|
|
|
|
this.backendSrv.get(`/api/org/plugins/${this.pluginId}/settings`).then(app => {
|
2016-02-09 04:17:49 -06:00
|
|
|
this.appModel = app;
|
|
|
|
this.page = _.findWhere(app.pages, {slug: this.$routeParams.slug});
|
|
|
|
if (!this.page) {
|
|
|
|
$rootScope.appEvent('alert-error', ['App Page Not Found', '']);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
angular.module('grafana.controllers').controller('AppPageCtrl', AppPageCtrl);
|
|
|
|
|