From 19798b0891765ca499723fbbc4deb6c0b154bbc6 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Fri, 8 Feb 2013 08:42:37 -0700 Subject: [PATCH] added panel configuration framework --- common/css/main.css | 22 ++++++- js/directives.js | 73 ++++++--------------- panels/fields/editor.html | 0 panels/fields/module.html | 5 +- panels/histogram/editor.html | 0 panels/histogram/module.html | 5 +- panels/hits/editor.html | 0 panels/hits/module.html | 5 +- panels/map/module.html | 5 +- panels/pie/editor.html | 42 ++++++++++++ panels/pie/module.html | 5 +- panels/sort/editor.html | 0 panels/sort/module.html | 5 +- panels/stringquery/editor.html | 0 panels/stringquery/module.html | 5 +- panels/table/editor.html | 45 +++++++------ panels/table/module.html | 5 +- panels/text/editor.html | 3 + panels/text/module.html | 5 +- panels/timepicker/editor.html | 0 panels/timepicker/module.html | 113 ++++++++++++++++----------------- partials/dashboard.html | 2 +- partials/paneleditor.html | 30 +++++++++ 23 files changed, 211 insertions(+), 164 deletions(-) create mode 100644 panels/fields/editor.html create mode 100644 panels/histogram/editor.html create mode 100644 panels/hits/editor.html create mode 100644 panels/pie/editor.html create mode 100644 panels/sort/editor.html create mode 100644 panels/stringquery/editor.html create mode 100644 panels/text/editor.html create mode 100644 panels/timepicker/editor.html create mode 100644 partials/paneleditor.html diff --git a/common/css/main.css b/common/css/main.css index 08e0e982693..0278db77224 100644 --- a/common/css/main.css +++ b/common/css/main.css @@ -17,7 +17,24 @@ .panel-error { opacity: 0.9; position:absolute; - z-index: 99999; + z-index: 2000; +} + +span.editlink { + position: absolute; + right: 5px; + z-index: 800; + display: none; +} + +.panel:hover span.editlink { + display: block; + opacity: 0.3; +} + +.panel span.editlink:hover { + display: block; + opacity: 1; } .pointer { @@ -54,8 +71,7 @@ } .remove:hover { - color: #A60000; - text-decoration: line-through; + background-color: #A60000; } .typeahead { z-index: 1051; } \ No newline at end of file diff --git a/js/directives.js b/js/directives.js index 396e755a053..a1024339fd2 100644 --- a/js/directives.js +++ b/js/directives.js @@ -3,22 +3,26 @@ 'use strict'; angular.module('kibana.directives', []) -.directive('panel', function($compile) { +.directive('kibanaPanel', function($compile) { return { - restrict: 'A', - compile: function(element, attrs) { - return function(scope, element, attrs) { - scope.$watch(function () { - return (attrs.panel && scope.index) ? true : false; - }, function (ready) { - if (ready) { - element.html($compile("
")(scope)) - } - }); - } + restrict: 'E', + link: function(scope, elem, attrs) { + var template = ''+ + '

{{panel.title}}

'; + elem.prepend($compile(angular.element(template))(scope)); + } + }; +}) +.directive('panelEdit', function(){ + return { + restrict: 'E', + replace: true, + scope: { + 'panel': '=panel' + }, + templateUrl: 'panels/table/editor.html', + //controller: 'ChildElement' } - } }) .directive('arrayJoin', function() { return { @@ -72,46 +76,5 @@ angular.module('kibana.directives', []) } } } -}) -.directive('datepicker', function(){ - return { - restrict: 'A', - require: 'ngModel', - link: function(scope, elem, attrs) { - elem.datepicker({ - noDefault: false, // set this to true if you don't want the current date inserted if the value-attribute is empty - format: 'mm/dd/yyyy hh:ii:ss' - }); - } - }; -}) -.directive('date', function(dateFilter) { - return { - require: 'ngModel', - link: function(scope, elm, attrs, ctrl) { - - var dateFormat = attrs['date'] || 'yyyy-MM-dd HH:mm:ss'; - var minDate = Date.parse(attrs['min']) || 0; - var maxDate = Date.parse(attrs['max']) || 9007199254740992; - - ctrl.$parsers.unshift(function(viewValue) { - var parsedDateMilissec = Date.parse(viewValue); - if (parsedDateMilissec > 0) { - if (parsedDateMilissec >= minDate && parsedDateMilissec <= maxDate) { - ctrl.$setValidity('date', true); - return new Date(parsedDateMilissec); - } - } - - // in all other cases it is invalid, return undefined (no model update) - ctrl.$setValidity('date', false); - return undefined; - }); - - ctrl.$formatters.unshift(function(modelValue) { - return dateFilter(modelValue, dateFormat); - }); - } - }; }); diff --git a/panels/fields/editor.html b/panels/fields/editor.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/panels/fields/module.html b/panels/fields/module.html index 7c5dafecd51..c5e3f5985b0 100644 --- a/panels/fields/module.html +++ b/panels/fields/module.html @@ -1,6 +1,5 @@ -
-

{{panel.title}}

+ -
\ No newline at end of file + \ No newline at end of file diff --git a/panels/histogram/editor.html b/panels/histogram/editor.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/panels/histogram/module.html b/panels/histogram/module.html index d2aa35afcb5..dd94a34b7a9 100644 --- a/panels/histogram/module.html +++ b/panels/histogram/module.html @@ -1,4 +1,3 @@ -
-

{{panel.title}}

+
-
\ No newline at end of file + \ No newline at end of file diff --git a/panels/hits/editor.html b/panels/hits/editor.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/panels/hits/module.html b/panels/hits/module.html index ceea3d52d4c..a12cf9479e2 100644 --- a/panels/hits/module.html +++ b/panels/hits/module.html @@ -1,4 +1,3 @@ -
-

{{panel.title}}

+

{{hits}}

-
\ No newline at end of file + \ No newline at end of file diff --git a/panels/map/module.html b/panels/map/module.html index d63664b461e..2a94a5672b1 100644 --- a/panels/map/module.html +++ b/panels/map/module.html @@ -1,4 +1,3 @@ -
-

{{panel.title}}

+
-
\ No newline at end of file + \ No newline at end of file diff --git a/panels/pie/editor.html b/panels/pie/editor.html new file mode 100644 index 00000000000..897a4ce1318 --- /dev/null +++ b/panels/pie/editor.html @@ -0,0 +1,42 @@ +

{{panel.type}} panel settings

+
+
+
+
Field
+ + +
+
+
+
+
Query
+ + +
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
Sort
+ + +
+
+
Length
+ +
+
\ No newline at end of file diff --git a/panels/pie/module.html b/panels/pie/module.html index e320569ca46..0118cd2632d 100644 --- a/panels/pie/module.html +++ b/panels/pie/module.html @@ -1,4 +1,3 @@ -
-

{{panel.title}}

+
-
\ No newline at end of file + \ No newline at end of file diff --git a/panels/sort/editor.html b/panels/sort/editor.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/panels/sort/module.html b/panels/sort/module.html index 4a3a6b9db27..752a9cf0216 100644 --- a/panels/sort/module.html +++ b/panels/sort/module.html @@ -1,6 +1,5 @@ -
-

{{panel.title}}

+ -
\ No newline at end of file + \ No newline at end of file diff --git a/panels/stringquery/editor.html b/panels/stringquery/editor.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/panels/stringquery/module.html b/panels/stringquery/module.html index d273a1659e2..46dfaf18570 100644 --- a/panels/stringquery/module.html +++ b/panels/stringquery/module.html @@ -1,8 +1,7 @@ -
-

{{panel.title}}

+
-
\ No newline at end of file + \ No newline at end of file diff --git a/panels/table/editor.html b/panels/table/editor.html index 76af4bfd872..dc70b3fba5f 100644 --- a/panels/table/editor.html +++ b/panels/table/editor.html @@ -1,30 +1,33 @@ - -