mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
final touches to aliasByNode automatic stuff
This commit is contained in:
parent
d9e6fcd730
commit
0b03ca158b
@ -227,17 +227,38 @@ function (angular, _, config, gfunc, Parser) {
|
||||
newFunc.added = true;
|
||||
$scope.functions.push(newFunc);
|
||||
|
||||
$scope.moveAliasFuncLast();
|
||||
$scope.smartlyHandleNewAliasByNode(newFunc);
|
||||
|
||||
if (!funcDef.params && newFunc.added) {
|
||||
$scope.targetChanged();
|
||||
}
|
||||
};
|
||||
|
||||
$scope.moveAliasFuncLast = function() {
|
||||
var aliasFunc = _.find($scope.functions, function(func) {
|
||||
return func.def.name === 'alias';
|
||||
return func.def.name === 'alias' ||
|
||||
func.def.name === 'aliasByNode' ||
|
||||
func.def.name === 'aliasByMetric';
|
||||
});
|
||||
|
||||
if (aliasFunc) {
|
||||
$scope.functions = _.without($scope.functions, aliasFunc);
|
||||
$scope.functions.push(aliasFunc);
|
||||
}
|
||||
};
|
||||
|
||||
if (!funcDef.params) {
|
||||
$scope.targetChanged();
|
||||
$scope.smartlyHandleNewAliasByNode = function(func) {
|
||||
if (func.def.name !== 'aliasByNode') {
|
||||
return;
|
||||
}
|
||||
for(var i = 0; i < $scope.segments.length; i++) {
|
||||
if ($scope.segments[i].val.indexOf('*') >= 0) {
|
||||
func.params[0] = i;
|
||||
func.added = false;
|
||||
$scope.targetChanged();
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,51 +0,0 @@
|
||||
<div class="grafana-func-editor">
|
||||
|
||||
<div class="grafana-func-editor-header">
|
||||
<a ng-click="removeFunction(func)">
|
||||
Remove
|
||||
</a>
|
||||
|
||||
<a ng-click="helpFunction(func)">
|
||||
Help
|
||||
</a>
|
||||
|
||||
<a class="close" ng-click="dismiss();" href="">×</a>
|
||||
</div>
|
||||
|
||||
<div class="editor-row" ng-if="func.def.params.length">
|
||||
<div class="section">
|
||||
<div class="editor-option" ng-repeat="param in func.def.params">
|
||||
<label class="small">{{param.name}}</label>
|
||||
<div ng-switch on="param.type">
|
||||
<div ng-switch-when="int">
|
||||
<input
|
||||
type="number"
|
||||
step="any"
|
||||
focus-me="true"
|
||||
class="input-mini"
|
||||
ng-change="functionParamsChanged(func)" ng-model-onblur
|
||||
ng-model="func.params[$index]" />
|
||||
</div>
|
||||
<div ng-switch-when="string">
|
||||
<input
|
||||
type="text"
|
||||
focus-me="true"
|
||||
class="input-small"
|
||||
ng-change="functionParamsChanged(func)" ng-model-onblur
|
||||
ng-model="func.params[$index]" />
|
||||
</div>
|
||||
<div ng-switch-when="select">
|
||||
<select
|
||||
class="input-mini"
|
||||
ng-model="func.params[$index]"
|
||||
ng-change="functionParamsChanged(func)"
|
||||
focus-me="true"
|
||||
ng-options="f for f in param.options">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
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
@ -383,34 +383,12 @@ select.grafana-target-segment-input {
|
||||
}
|
||||
}
|
||||
|
||||
input[type=text].func-param {
|
||||
border: none;
|
||||
background: inherit;
|
||||
width: 30px;
|
||||
border-radius: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.grafana-target {
|
||||
.popover-content {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.grafana-func-editor {
|
||||
min-width: 140px;
|
||||
.grafana-func-editor-header {
|
||||
background: @grafanaTargetFuncHightlight;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid @grafanaTargetFuncBackground;
|
||||
padding: 3px 5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.editor-row {
|
||||
padding: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.scrollable {
|
||||
max-height: 300px;
|
||||
|
Loading…
Reference in New Issue
Block a user