From 8e69f8255319f673784cc973dbd33b97fad02365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 20 Dec 2013 08:18:08 +0100 Subject: [PATCH] working on graphite target editor --- src/app/controllers/graphiteTarget.js | 17 ++++++- src/app/panels/graphite/editor.html | 72 +++++++++++++++++++++++++-- src/app/panels/graphite/module.js | 2 +- src/app/partials/dashboard.html | 1 + 4 files changed, 84 insertions(+), 8 deletions(-) diff --git a/src/app/controllers/graphiteTarget.js b/src/app/controllers/graphiteTarget.js index f528d6f9863..043013723f6 100644 --- a/src/app/controllers/graphiteTarget.js +++ b/src/app/controllers/graphiteTarget.js @@ -1,7 +1,8 @@ define([ 'angular', + 'underscore' ], -function (angular) { +function (angular, _) { 'use strict'; var module = angular.module('kibana.controllers'); @@ -9,7 +10,19 @@ function (angular) { module.controller('GraphiteTargetCtrl', function($scope) { $scope.init = function() { - console.log('target:', $scope.target); + $scope.segments = []; + var strSegments = $scope.target.target.split('.'); + _.each(strSegments, function (segment, index) { + if (segment === '*') { + segment = ''; + } + + $scope.segments[index] = { val: segment }; + }); + }; + + $scope.setSegmentStar = function (index) { + $scope.segments[index] = {val: '' }; }; $scope.targetChanged = function() { diff --git a/src/app/panels/graphite/editor.html b/src/app/panels/graphite/editor.html index c21ca7479c0..2a2770409f3 100644 --- a/src/app/panels/graphite/editor.html +++ b/src/app/panels/graphite/editor.html @@ -1,7 +1,68 @@
+ + +
+ + + + + + + +
+
    + +
      +
+ +
+
- Add target - +
\ No newline at end of file diff --git a/src/app/panels/graphite/module.js b/src/app/panels/graphite/module.js index 109ffd5c987..7cfe00ec899 100644 --- a/src/app/panels/graphite/module.js +++ b/src/app/panels/graphite/module.js @@ -211,6 +211,7 @@ function (angular, app, $, _, kbn, moment, timeSeries, graphiteSrv, RQ) { $scope.init = function() { // Hide view options by default $scope.options = false; + $scope.editor = {index: 1}; // Always show the query if an alias isn't set. Users can set an alias if the query is too // long @@ -422,7 +423,6 @@ function (angular, app, $, _, kbn, moment, timeSeries, graphiteSrv, RQ) { $scope.$emit('render'); }; - $scope.setEditorTabs = function(panelMeta) { $scope.editorTabs = ['General']; if(!_.isUndefined(panelMeta.editorTabs)) { diff --git a/src/app/partials/dashboard.html b/src/app/partials/dashboard.html index ab664e41825..e63df3b2ba4 100644 --- a/src/app/partials/dashboard.html +++ b/src/app/partials/dashboard.html @@ -14,6 +14,7 @@
+