mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
move func left right, remove, and link to graphite docs works
This commit is contained in:
parent
feb20243e5
commit
d9e6fcd730
@ -15,12 +15,12 @@ function (angular, _, $) {
|
|||||||
' class="input-mini grafana-function-param-input"></input>';
|
' class="input-mini grafana-function-param-input"></input>';
|
||||||
|
|
||||||
var funcControlsTemplate =
|
var funcControlsTemplate =
|
||||||
'<span class="graphite-func-controls">' +
|
'<div class="graphite-func-controls">' +
|
||||||
'<span class="pointer icon-arrow-left"></span>' +
|
'<span class="pointer icon-arrow-left"></span>' +
|
||||||
'<span class="pointer icon-info-sign"></span>' +
|
'<span class="pointer icon-info-sign"></span>' +
|
||||||
'<span class="pointer icon-remove" ></span>' +
|
'<span class="pointer icon-remove" ></span>' +
|
||||||
'<span class="pointer icon-arrow-right"></span>' +
|
'<span class="pointer icon-arrow-right"></span>' +
|
||||||
'</span>';
|
'</div>';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
@ -111,19 +111,6 @@ function (angular, _, $) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPosition() {
|
|
||||||
var el = elem[0];
|
|
||||||
var pos = {};
|
|
||||||
if (typeof el.getBoundingClientRect === 'function') {
|
|
||||||
pos = el.getBoundingClientRect();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pos = { width: el.offsetWidth, height: el.offsetHeight };
|
|
||||||
}
|
|
||||||
|
|
||||||
return $.extend(pos, elem.offset());
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleFuncControls() {
|
function toggleFuncControls() {
|
||||||
var targetDiv = elem.closest('.grafana-target-inner');
|
var targetDiv = elem.closest('.grafana-target-inner');
|
||||||
|
|
||||||
@ -137,18 +124,11 @@ function (angular, _, $) {
|
|||||||
elem.addClass('show-function-controls');
|
elem.addClass('show-function-controls');
|
||||||
targetDiv.addClass('has-open-function');
|
targetDiv.addClass('has-open-function');
|
||||||
|
|
||||||
setTimeout(function() {
|
$funcControls.show();
|
||||||
var pos = getPosition();
|
|
||||||
$funcControls.css('position', 'absolute');
|
|
||||||
$funcControls.css('top', (pos.top - 78) + 'px');
|
|
||||||
$funcControls.css('left', pos.left + 'px');
|
|
||||||
$funcControls.css('width', pos.width + 'px');
|
|
||||||
console.log(pos);
|
|
||||||
$funcControls.show();
|
|
||||||
}, 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addElementsAndCompile() {
|
function addElementsAndCompile() {
|
||||||
|
$funcControls.appendTo(elem);
|
||||||
$funcLink.appendTo(elem);
|
$funcLink.appendTo(elem);
|
||||||
|
|
||||||
_.each(funcDef.params, function(param, index) {
|
_.each(funcDef.params, function(param, index) {
|
||||||
@ -175,8 +155,6 @@ function (angular, _, $) {
|
|||||||
|
|
||||||
$('<span>)</span>').appendTo(elem);
|
$('<span>)</span>').appendTo(elem);
|
||||||
|
|
||||||
elem.append($funcControls);
|
|
||||||
|
|
||||||
$compile(elem.contents())($scope);
|
$compile(elem.contents())($scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +179,26 @@ function (angular, _, $) {
|
|||||||
$scope.$apply(function() {
|
$scope.$apply(function() {
|
||||||
$scope.removeFunction($scope.func);
|
$scope.removeFunction($scope.func);
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($target.hasClass('icon-arrow-left')) {
|
||||||
|
$scope.$apply(function() {
|
||||||
|
_.move($scope.functions, $scope.$index, $scope.$index - 1);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($target.hasClass('icon-arrow-right')) {
|
||||||
|
$scope.$apply(function() {
|
||||||
|
_.move($scope.functions, $scope.$index, $scope.$index + 1);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($target.hasClass('icon-info-sign')) {
|
||||||
|
window.open("http://graphite.readthedocs.org/en/latest/functions.html#graphite.render.functions." + funcDef.name,'_blank');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
2
src/css/bootstrap.dark.min.css
vendored
2
src/css/bootstrap.dark.min.css
vendored
File diff suppressed because one or more lines are too long
2
src/css/bootstrap.light.min.css
vendored
2
src/css/bootstrap.light.min.css
vendored
File diff suppressed because one or more lines are too long
@ -227,10 +227,6 @@
|
|||||||
border-right: 1px solid @grafanaTargetBorder;
|
border-right: 1px solid @grafanaTargetBorder;
|
||||||
background: @grafanaTargetBackground;
|
background: @grafanaTargetBackground;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
&.has-open-function {
|
|
||||||
margin-top: 35px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.grafana-target-onoff {
|
.grafana-target-onoff {
|
||||||
@ -262,6 +258,10 @@
|
|||||||
color: @grafanaTargetColor;
|
color: @grafanaTargetColor;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
|
.has-open-function & {
|
||||||
|
padding-top: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
.grafana-target-hidden & {
|
.grafana-target-hidden & {
|
||||||
color: @grafanaTargetColorHide;
|
color: @grafanaTargetColorHide;
|
||||||
}
|
}
|
||||||
@ -284,6 +284,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.show-function-controls {
|
&.show-function-controls {
|
||||||
|
padding-top: 5px;
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user