func editor starting to work

This commit is contained in:
Torkel Ödegaard
2013-12-21 09:53:28 +01:00
parent 089b1f5395
commit 3059870b48
3 changed files with 76 additions and 3 deletions
+3 -2
View File
@@ -132,11 +132,12 @@ function (angular, _, config) {
$scope.functions = _.without($scope.functions, func);
};
$scope.functionParmsChanged = function(func) {
func.text = func.name + '(';
$scope.functionParamsChanged = function(func) {
func.text = func.def.name + '(';
_.each(func.def.params, function(param) {
func.text += func.params[param.name];
});
func.text += ')';
};
$scope.addFunction = function() {
+4 -1
View File
@@ -95,8 +95,11 @@
<i class="icon-long-arrow-right"></i>
</span>
<ul>
<li>
groupByNode( <input type="text" class="func-param" value="1"
</li>
<li ng-repeat="func in functions">
<a bs-popover="'app/panels/graphite/funcEditor.html'" data-placement="top">{{func.text}}</a>
<a bs-popover="'app/panels/graphite/funcEditor.html'" data-placement="bottom">{{func.text}}</a>
<i class="icon-long-arrow-right"></i>
</li>
<li>
+69
View File
@@ -0,0 +1,69 @@
<div class="grafana-func-editor">
<div class="row-fluid">
<a ng-click="removeFunction(func)">
Remove
</a>
|
<a ng-click="disableFunction(func)">
Disable
</a>
|
<a ng-click="helpFunction(func)">
Help
</a>
|
<a ng-click="dismiss()">
Close
</a>
</div>
<div class="editor-row">
<div class="section">
<div class="editor-option" ng-repeat="param in func.def.params">
<label class="small">{{param.name}}</label>
<input ng-if="param.type === 'int'"
placeholder="seconds"
focus-me="true"
class="input-mini"
ng-change="functionParamsChanged(func)" ng-model-onblur
ng-model="func.params[param.name]" />
<select ng-if="param.type === 'node'"
class="input-mini"
ng-model="func.params[param.name]"
ng-change="functionParamsChanged(func)"
ng-options="f for f in [1,2,3,4,5,6,7,8,9,10]">
</select>
<select ng-if="param.type === 'function'"
class="input-small"
ng-change="functionParamsChanged(func)"
ng-model="func.params[param.name]"
ng-options="f for f in ['sumSeries', 'avgSeries']">
</select>
</div>
</div>
</div>
<!-- <div class="row-fluid">
<div class="pull-left">
<input ng-if="param.type === 'int'"
placeholder="seconds"
focus-me="true"
class="input-mini"
ng-model="func.params[param.name]" />
<select ng-if="param.type === 'node'"
class="input-mini"
ng-model="func.params[param.name]"
ng-options="f for f in [1,2,3,4,5,6,7,8,9,10]">
</select>
<select ng-if="param.type === 'function'"
class="input-small"
ng-model="func.params[param.name]"
ng-options="f for f in ['sumSeries', 'avgSeries']">
</select>
</div>
</div>
--></div>