|
@@ -12,6 +12,7 @@ export class DashRowCtrl {
|
|
|
dashboard: any;
|
|
dashboard: any;
|
|
|
row: any;
|
|
row: any;
|
|
|
dropView: number;
|
|
dropView: number;
|
|
|
|
|
+ editMode: boolean;
|
|
|
|
|
|
|
|
/** @ngInject */
|
|
/** @ngInject */
|
|
|
constructor(private $scope, private $rootScope, private $timeout, private uiSegmentSrv, private $q) {
|
|
constructor(private $scope, private $rootScope, private $timeout, private uiSegmentSrv, private $q) {
|
|
@@ -21,6 +22,12 @@ export class DashRowCtrl {
|
|
|
this.dropView = 1;
|
|
this.dropView = 1;
|
|
|
delete this.row.isNew;
|
|
delete this.row.isNew;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ this.dashboard.events.on('edit-mode-changed', this.editModeChanged.bind(this), $scope);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ editModeChanged() {
|
|
|
|
|
+ this.editMode = this.dashboard.editMode;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onDrop(panelId, dropTarget) {
|
|
onDrop(panelId, dropTarget) {
|
|
@@ -107,15 +114,20 @@ export class DashRowCtrl {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onMenuAddPanel() {
|
|
onMenuAddPanel() {
|
|
|
- this.dashboard.toggleEditMode();
|
|
|
|
|
|
|
+ this.editMode = true;
|
|
|
this.dropView = 1;
|
|
this.dropView = 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onMenuRowOptions() {
|
|
onMenuRowOptions() {
|
|
|
- this.dashboard.toggleEditMode();
|
|
|
|
|
|
|
+ this.editMode = true;
|
|
|
this.dropView = 2;
|
|
this.dropView = 2;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ closeDropView() {
|
|
|
|
|
+ this.dropView = 0;
|
|
|
|
|
+ this.editMode = this.dashboard.editMode;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
onMenuDeleteRow() {
|
|
onMenuDeleteRow() {
|
|
|
this.dashboard.removeRow(this.row);
|
|
this.dashboard.removeRow(this.row);
|
|
|
}
|
|
}
|
|
@@ -208,7 +220,7 @@ coreModule.directive('panelDropZone', function($timeout) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function updateState() {
|
|
function updateState() {
|
|
|
- if (scope.ctrl.dashboard.editMode) {
|
|
|
|
|
|
|
+ if (scope.ctrl.editMode) {
|
|
|
if (row.panels.length === 0 && indrag === false) {
|
|
if (row.panels.length === 0 && indrag === false) {
|
|
|
return showPanel(12, 'Empty Space');
|
|
return showPanel(12, 'Empty Space');
|
|
|
}
|
|
}
|
|
@@ -234,8 +246,7 @@ coreModule.directive('panelDropZone', function($timeout) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
row.events.on('span-changed', updateState, scope);
|
|
row.events.on('span-changed', updateState, scope);
|
|
|
-
|
|
|
|
|
- scope.$watchGroup(['ctrl.dashboard.editMode'], updateState);
|
|
|
|
|
|
|
+ scope.$watchGroup(['ctrl.editMode'], updateState);
|
|
|
|
|
|
|
|
scope.$on("ANGULAR_DRAG_START", function() {
|
|
scope.$on("ANGULAR_DRAG_START", function() {
|
|
|
indrag = true;
|
|
indrag = true;
|