mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fixed submenu in fullscreen mode
This commit is contained in:
@@ -12,20 +12,14 @@ function (angular, app, _) {
|
|||||||
return {
|
return {
|
||||||
link: function($scope, elem) {
|
link: function($scope, elem) {
|
||||||
|
|
||||||
var lastPulldownVal;
|
|
||||||
var lastHideControlsVal;
|
var lastHideControlsVal;
|
||||||
|
|
||||||
$scope.$watchCollection('dashboard.pulldowns', function() {
|
$scope.$watch('submenuEnabled', function() {
|
||||||
if (!$scope.dashboard) {
|
if (!$scope.dashboard) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var panel = _.find($scope.dashboard.pulldowns, function(pulldown) { return pulldown.enable; });
|
elem.toggleClass('submenu-controls-visible', $scope.submenuEnabled);
|
||||||
var panelEnabled = panel ? panel.enable : false;
|
|
||||||
if (lastPulldownVal !== panelEnabled) {
|
|
||||||
elem.toggleClass('submenu-controls-visible', panelEnabled);
|
|
||||||
lastPulldownVal = panelEnabled;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$watch('dashboard.hideControls', function() {
|
$scope.$watch('dashboard.hideControls', function() {
|
||||||
|
|||||||
@@ -34,63 +34,6 @@ function (angular, app, _) {
|
|||||||
$scope.filter.removeTemplateParameter(templateParameter);
|
$scope.filter.removeTemplateParameter(templateParameter);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.filterOptionSelected = function(templateParameter, option, recursive) {
|
|
||||||
templateParameter.current = option;
|
|
||||||
|
|
||||||
$scope.filter.updateTemplateData();
|
|
||||||
|
|
||||||
return $scope.applyFilterToOtherFilters(templateParameter)
|
|
||||||
.then(function() {
|
|
||||||
// only refresh in the outermost call
|
|
||||||
if (!recursive) {
|
|
||||||
$scope.dashboard.emit_refresh();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.applyFilterToOtherFilters = function(updatedTemplatedParam) {
|
|
||||||
var promises = _.map($scope.filter.templateParameters, function(templateParam) {
|
|
||||||
if (templateParam === updatedTemplatedParam) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (templateParam.query.indexOf('[[' + updatedTemplatedParam.name + ']]') !== -1) {
|
|
||||||
return $scope.applyFilter(templateParam);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return $q.all(promises);
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.applyFilter = function(templateParam) {
|
|
||||||
return datasourceSrv.default.metricFindQuery($scope.filter, templateParam.query)
|
|
||||||
.then(function (results) {
|
|
||||||
templateParam.editing = undefined;
|
|
||||||
templateParam.options = _.map(results, function(node) {
|
|
||||||
return { text: node.text, value: node.text };
|
|
||||||
});
|
|
||||||
|
|
||||||
if (templateParam.includeAll) {
|
|
||||||
var allExpr = '{';
|
|
||||||
_.each(templateParam.options, function(option) {
|
|
||||||
allExpr += option.text + ',';
|
|
||||||
});
|
|
||||||
allExpr = allExpr.substring(0, allExpr.length - 1) + '}';
|
|
||||||
templateParam.options.unshift({text: 'All', value: allExpr});
|
|
||||||
}
|
|
||||||
|
|
||||||
// if parameter has current value
|
|
||||||
// if it exists in options array keep value
|
|
||||||
if (templateParam.current) {
|
|
||||||
var currentExists = _.findWhere(templateParam.options, { value: templateParam.current.value });
|
|
||||||
if (currentExists) {
|
|
||||||
return $scope.filterOptionSelected(templateParam, templateParam.current, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $scope.filterOptionSelected(templateParam, templateParam.options[0], true);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.add = function() {
|
$scope.add = function() {
|
||||||
$scope.filter.addTemplateParameter({
|
$scope.filter.addTemplateParameter({
|
||||||
type : 'filter',
|
type : 'filter',
|
||||||
|
|||||||
@@ -1,118 +1,10 @@
|
|||||||
.submenu-controls {
|
|
||||||
background: @submenuBackground;
|
|
||||||
font-size: inherit;
|
|
||||||
label {
|
|
||||||
margin: 0;
|
|
||||||
padding-right: 4px;
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
input[type=checkbox] {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.submenu-controls-visible:not(.hide-controls) {
|
.submenu-controls-visible:not(.hide-controls) {
|
||||||
.panel-fullscreen {
|
.panel-fullscreen {
|
||||||
top: 82px;
|
top: 90px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.submenu-panel {
|
|
||||||
padding: 0 4px 0 8px;
|
|
||||||
border-right: 1px solid @submenuBorder;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.submenu-panel:first-child {
|
|
||||||
padding-left: 17px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.submenu-panel-title {
|
|
||||||
float: left;
|
|
||||||
text-transform: uppercase;
|
|
||||||
padding: 4px 10px 3px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.submenu-panel-wrapper {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.submenu-toggle {
|
|
||||||
padding: 4px 0 3px 8px;
|
|
||||||
float: left;
|
|
||||||
.annotation-color-icon {
|
|
||||||
position: relative;
|
|
||||||
top: 2px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.submenu-toggle:first-child {
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.submenu-control-edit {
|
|
||||||
padding: 4px 4px 3px 8px;
|
|
||||||
float: right;
|
|
||||||
border-left: 1px solid @submenuBorder;
|
|
||||||
margin-left: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.annotation-disabled, .annotation-disabled a {
|
.annotation-disabled, .annotation-disabled a {
|
||||||
color: darken(@textColor, 25%);
|
color: darken(@textColor, 25%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Filter submenu
|
|
||||||
.filtering-container {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filtering-container label {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filtering-container input[type=checkbox] {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-panel-filter {
|
|
||||||
display:inline-block;
|
|
||||||
vertical-align: top;
|
|
||||||
padding: 4px 10px 3px 10px;
|
|
||||||
border-right: 1px solid @submenuBorder;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-panel-filter:first-child {
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-panel-filter ul {
|
|
||||||
margin-bottom: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-deselected {
|
|
||||||
opacity: 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filtering-container .filter-action {
|
|
||||||
float:right;
|
|
||||||
padding-right: 2px;
|
|
||||||
margin-bottom: 0px !important;
|
|
||||||
margin-left: 0px;
|
|
||||||
margin-top: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-filter-action {
|
|
||||||
padding: 3px 5px 0px 5px;
|
|
||||||
position: relative;
|
|
||||||
top: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-mandate {
|
|
||||||
text-decoration: underline;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-apply {
|
|
||||||
float:right;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user