plugin_page_ctrl.ts 706 B

12345678910111213141516171819202122232425
  1. ///<reference path="../../headers/common.d.ts" />
  2. import angular from 'angular';
  3. import _ from 'lodash';
  4. export class AppPageCtrl {
  5. page: any;
  6. pluginId: any;
  7. appModel: any;
  8. /** @ngInject */
  9. constructor(private backendSrv, private $routeParams: any, private $rootScope) {
  10. this.pluginId = $routeParams.pluginId;
  11. this.backendSrv.get(`/api/plugins/${this.pluginId}/settings`).then(app => {
  12. this.appModel = app;
  13. this.page = _.findWhere(app.pages, {slug: this.$routeParams.slug});
  14. if (!this.page) {
  15. $rootScope.appEvent('alert-error', ['App Page Not Found', '']);
  16. }
  17. });
  18. }
  19. }
  20. angular.module('grafana.controllers').controller('AppPageCtrl', AppPageCtrl);