Commit 075c7225 by Torkel Ödegaard

ux(dashboard): worked on single row edit mode, #6442

parent e23f8984
......@@ -192,6 +192,7 @@ export class DashboardModel {
this.editMode = !this.editMode;
this.updateSubmenuVisibility();
this.events.emit('edit-mode-changed', this.editMode);
}
setPanelFocus(id) {
......
......@@ -93,7 +93,7 @@ export class AddPanelCtrl {
isNew: true,
};
this.rowCtrl.dropView = 0;
this.rowCtrl.closeDropView();
this.dashboard.addPanel(panel, this.row);
this.$timeout(() => {
this.$rootScope.$broadcast('render');
......
<div ng-if="ctrl.dashboard.editMode">
<div ng-if="ctrl.editMode">
<div class="dash-row-header">
<a class="dash-row-header-title" ng-click="ctrl.toggleCollapse()">
<span class="dash-row-collapse-toggle pointer">
......@@ -40,7 +40,7 @@
</div>
</div>
<div ng-if="!ctrl.dashboard.editMode">
<div ng-if="!ctrl.editMode">
<div class="row-open">
<div class='row-tab dropdown' ng-show="dashboardMeta.canEdit" ng-hide="dashboard.meta.fullscreen">
<span class="row-tab-button dropdown-toggle" data-toggle="dropdown">
......
......@@ -12,6 +12,7 @@ export class DashRowCtrl {
dashboard: any;
row: any;
dropView: number;
editMode: boolean;
/** @ngInject */
constructor(private $scope, private $rootScope, private $timeout, private uiSegmentSrv, private $q) {
......@@ -21,6 +22,12 @@ export class DashRowCtrl {
this.dropView = 1;
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) {
......@@ -107,15 +114,20 @@ export class DashRowCtrl {
}
onMenuAddPanel() {
this.dashboard.toggleEditMode();
this.editMode = true;
this.dropView = 1;
}
onMenuRowOptions() {
this.dashboard.toggleEditMode();
this.editMode = true;
this.dropView = 2;
}
closeDropView() {
this.dropView = 0;
this.editMode = this.dashboard.editMode;
}
onMenuDeleteRow() {
this.dashboard.removeRow(this.row);
}
......@@ -208,7 +220,7 @@ coreModule.directive('panelDropZone', function($timeout) {
}
function updateState() {
if (scope.ctrl.dashboard.editMode) {
if (scope.ctrl.editMode) {
if (row.panels.length === 0 && indrag === false) {
return showPanel(12, 'Empty Space');
}
......@@ -234,8 +246,7 @@ coreModule.directive('panelDropZone', function($timeout) {
}
row.events.on('span-changed', updateState, scope);
scope.$watchGroup(['ctrl.dashboard.editMode'], updateState);
scope.$watchGroup(['ctrl.editMode'], updateState);
scope.$on("ANGULAR_DRAG_START", function() {
indrag = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment