Commit 5f6ecac3 by Torkel Ödegaard

poc(editmode): experimental edit mode

parent 49b2743a
...@@ -20,17 +20,13 @@ function (_, $, coreModule) { ...@@ -20,17 +20,13 @@ function (_, $, coreModule) {
elem.toggleClass('panel-in-fullscreen', false); elem.toggleClass('panel-in-fullscreen', false);
}); });
$scope.$watch('dashboard.hideControls', function() { $scope.$watch('dashboard.editMode', function() {
if (!$scope.dashboard) { if (!$scope.dashboard) {
return; return;
} }
var hideControls = $scope.dashboard.hideControls || $scope.playlist_active; var editMode = $scope.dashboard.editMode;
elem.toggleClass('dash-edit-mode', editMode === true);
if (lastHideControlsVal !== hideControls) {
elem.toggleClass('hide-controls', hideControls);
lastHideControlsVal = hideControls;
}
}); });
$scope.$watch('playlistSrv', function(newValue) { $scope.$watch('playlistSrv', function(newValue) {
......
...@@ -43,9 +43,8 @@ function(angular, $) { ...@@ -43,9 +43,8 @@ function(angular, $) {
scope.broadcastRefresh(); scope.broadcastRefresh();
}, { inputDisabled: true }); }, { inputDisabled: true });
keyboardManager.bind('ctrl+h', function() { keyboardManager.bind('ctrl+e', function() {
var current = scope.dashboard.hideControls; scope.dashboard.editMode = !scope.dashboard.editMode;
scope.dashboard.hideControls = !current;
}, { inputDisabled: true }); }, { inputDisabled: true });
keyboardManager.bind('ctrl+s', function(evt) { keyboardManager.bind('ctrl+s', function(evt) {
......
...@@ -49,9 +49,9 @@ ...@@ -49,9 +49,9 @@
label-class="width-10"> label-class="width-10">
</gf-form-switch> </gf-form-switch>
<gf-form-switch class="gf-form" <gf-form-switch class="gf-form"
label="Hide Controls" label="Edit Mode"
tooltip="Hide row controls. Shortcut: CTRL+H" tooltip="Enable edit mode. Shortcut: CTRL+E"
checked="dashboard.hideControls" checked="dashboard.editMode"
label-class="width-10"> label-class="width-10">
</gf-form-switch> </gf-form-switch>
<gf-form-switch class="gf-form" <gf-form-switch class="gf-form"
......
...@@ -11,22 +11,13 @@ ...@@ -11,22 +11,13 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="grafana-row" ng-controller="RowCtrl" ng-repeat="(row_name, row) in dashboard.rows" row-height> <div class="dash-row" ng-controller="RowCtrl" ng-repeat="(row_name, row) in dashboard.rows" row-height>
<div class="row-control"> <div class="dash-row-header" ng-if="row.showTitle || dashboard.editMode">
<div class="row-control-inner"> <div class="dash-row-header-title" ng-bind="row.title | interpolateTemplateVars:this"></div>
<div class="row-close" ng-show="row.collapse" data-placement="bottom" > <div class="dash-row-header-settings dropdown">
<div class="row-close-buttons"> <a class="pointer dropdown-toggle" data-toggle="dropdown">
<span class="row-button" ng-click="toggleRow(row)"> <i class="fa fa-cog"></i>
<i bs-tooltip="'Expand row'" data-placement="right" class="fa fa-caret-left pointer" ></i> </a>
</span>
</div>
<div class="row-text pointer" ng-click="toggleRow(row)" ng-bind="row.title | interpolateTemplateVars:this"></div>
</div>
<div class="row-open" ng-show="!row.collapse">
<div class='row-tab dropdown' ng-show="dashboardMeta.canEdit" ng-hide="dashboard.meta.fullscreen">
<span class="row-tab-button dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bars"></i>
</span>
<ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="drop1"> <ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="drop1">
<li> <li>
<a ng-click="toggleRow(row)">Collapse row</a> <a ng-click="toggleRow(row)">Collapse row</a>
...@@ -72,15 +63,15 @@ ...@@ -72,15 +63,15 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="dash-row-header-collapse-toggle">
<a class="pointer" ng-click="row.collapse = !row.collapse">
<i class="fa fa-chevron-down"></i>
</a>
</div> </div>
</div> </div>
<div class="panels-wrapper" ng-if="!row.collapse"> <div class="panels-wrapper" ng-if="!row.collapse">
<div class="row-text pointer" ng-click="toggleRow(row)" ng-if="row.showTitle" ng-bind="row.title | interpolateTemplateVars:this"> <div ng-repeat="panel in row.panels track by panel.id" class="panel" ui-draggable="!dashboard.meta.fullscreen" drag="panel.id" ui-on-drop="onDrop($data, row, panel)" drag-handle-class="drag-handle" panel-width>
</div>
<div ng-repeat="panel in row.panels track by panel.id" class="panel" ui-draggable="!dashboard.meta.fullscreen" drag="panel.id"
ui-on-drop="onDrop($data, row, panel)" drag-handle-class="drag-handle" panel-width>
<plugin-component type="panel" class="panel-margin"> <plugin-component type="panel" class="panel-margin">
</plugin-component> </plugin-component>
</div> </div>
...@@ -105,5 +96,4 @@ ...@@ -105,5 +96,4 @@
</span> </span>
</div> </div>
</div> </div>
</div>
</div> </div>
...@@ -13,85 +13,6 @@ ...@@ -13,85 +13,6 @@
color: $variable; color: $variable;
} }
.row-tab {
.dropdown-menu-right {
top: 0;
left: 33px;
}
}
.row-tab-button {
padding: 0px;
cursor: pointer;
vertical-align: middle;
width: 30px;
height: 30px;
text-align: center;
display: inline-block;
line-height: 30px;
background: $btn-success-bg;
color: rgba(255,255,255,.90);
}
.row-button {
width: 24px;
float: left;
cursor: pointer;
line-height: 31px;
background-color: $blue-dark;
}
.row-text {
white-space: nowrap;
text-transform: uppercase;
font-weight: bold;
font-size: 0.9em;
text-align: center;
line-height: 31px;
height: 31px;
}
.row-close {
padding: 0px;
margin: 0px;
background: $panel-bg;
text-align: center;
}
.row-close-buttons {
position: absolute;
left: 0;
}
.row-open {
margin-top: 5px;
left: -30px;
position: absolute;
z-index: 100;
transition: .10s left;
transition-delay: .10s;
&:hover {
left: -12px;
}
}
.row-control-inner {
padding:0px;
margin:0px;
position:relative;
}
.hide-controls {
padding: 0;
.row-tab {
display: none;
}
.add-row-panel-hint {
display: none;
}
}
.playlist-active { .playlist-active {
.add-row-panel-hint, .add-row-panel-hint,
.dashnav-refresh-action, .dashnav-refresh-action,
...@@ -287,3 +208,41 @@ div.flot-text { ...@@ -287,3 +208,41 @@ div.flot-text {
padding: 0.5rem .5rem .2rem .5rem; padding: 0.5rem .5rem .2rem .5rem;
} }
} }
//
// Dashboard row header
//
.dash-row-header {
display: flex;
flex-direction: row;
text-align: left;
}
.dash-row-header-title {
font-size: $font-size-h3;
font-family: $headings-font-family;
padding: $spacer $spacer*2;
}
.dash-row-header-settings {
display: none;
}
.dash-row-header-collapse-toggle {
flex-grow: 100;
text-align: right;
display: none;
}
.dash-edit-mode {
.dash-row {
background-color: $dark-5;
padding: 0 $spacer $spacer $spacer;
}
.dash-row-header-collapse-toggle,
.dash-row-header-settings {
display: block;
}
}
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