panel.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ///<reference path="../../headers/common.d.ts" />
  2. import config from 'app/core/config';
  3. import {PanelCtrl} from './panel_ctrl';
  4. import {MetricsPanelCtrl} from './metrics_panel_ctrl';
  5. export class DefaultPanelCtrl extends PanelCtrl {
  6. /** @ngInject */
  7. constructor($scope, $injector) {
  8. super($scope, $injector);
  9. }
  10. }
  11. class PanelDirective {
  12. template: string;
  13. templateUrl: string;
  14. bindToController: boolean;
  15. scope: any;
  16. controller: any;
  17. controllerAs: string;
  18. getDirective() {
  19. if (!this.controller) {
  20. this.controller = DefaultPanelCtrl;
  21. }
  22. return {
  23. template: this.template,
  24. templateUrl: this.templateUrl,
  25. controller: this.controller,
  26. controllerAs: 'ctrl',
  27. bindToController: true,
  28. scope: {dashboard: "=", panel: "=", row: "="},
  29. link: (scope, elem, attrs, ctrl) => {
  30. ctrl.init();
  31. this.link(scope, elem, attrs, ctrl);
  32. }
  33. };
  34. }
  35. link(scope, elem, attrs, ctrl) {
  36. return null;
  37. }
  38. }
  39. export {
  40. PanelCtrl,
  41. MetricsPanelCtrl,
  42. PanelDirective,
  43. }