panel_ctrl.ts 733 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. ///<reference path="../../headers/common.d.ts" />
  2. import PanelMeta from './panel_meta2';
  3. export class PanelCtrl {
  4. meta: any;
  5. panel: any;
  6. row: any;
  7. dashboard: any;
  8. constructor(private scope) {
  9. this.meta = new PanelMeta(this.panel);
  10. this.publishAppEvent('panel-instantiated', {scope: scope});
  11. }
  12. publishAppEvent(evtName, evt) {
  13. this.scope.$root.appEvent(evtName, evt);
  14. }
  15. changeView(fullscreen, edit) {
  16. this.publishAppEvent('panel-change-view', {
  17. fullscreen: fullscreen, edit: edit, panelId: this.panel.id
  18. });
  19. }
  20. viewPanel() {
  21. this.changeView(true, false);
  22. }
  23. editPanel() {
  24. this.changeView(true, true);
  25. }
  26. exitFullscreen() {
  27. this.changeView(false, false);
  28. }
  29. }