diff --git a/public/app/plugins/panel/table/editor.html b/public/app/plugins/panel/table/editor.html index 657771d8338..5697bebe97d 100644 --- a/public/app/plugins/panel/table/editor.html +++ b/public/app/plugins/panel/table/editor.html @@ -53,7 +53,7 @@
- Style Rules + Column Style Rules @@ -69,90 +69,81 @@
-
+
+
Options
-
- -
- -
-
- +
-
-
Date options
+
+
Type
+
+ +
+ +
+
+
-
-
-
String options
- -
- -
- -
-
Number options
- -
-
- -
-
-
-
-
- - -
-
+
+
-
-
Thresholds & Coloring
-
-
- - -
-
- -
- -
-
- -
- - - - - - - - - - -
- Invert -
-
+
+
+ +
+
+
+ +
+
+
Thresholds
+
+ + +
+
+ +
+ +
+
+
+ + + + + + + + + + +
+ Invert +
+
+
+ +
+ diff --git a/public/app/plugins/panel/table/editor.ts b/public/app/plugins/panel/table/editor.ts index fca7b8a90fb..9379702e7db 100644 --- a/public/app/plugins/panel/table/editor.ts +++ b/public/app/plugins/panel/table/editor.ts @@ -106,7 +106,7 @@ export class TablePanelEditorCtrl { } addColumnStyle() { - var columnStyleDefaults = { + var newStyleRule = { unit: 'short', type: 'number', alias: '', @@ -118,8 +118,20 @@ export class TablePanelEditorCtrl { thresholds: [], }; - this.panel.styles.push(angular.copy(columnStyleDefaults)); - this.activeStyleIndex = this.panel.styles.length-1; + var styles = this.panel.styles; + var stylesCount = styles.length; + var indexToInsert = stylesCount; + + // check if last is a catch all rule, then add it before that one + if (stylesCount > 0) { + var last = styles[stylesCount-1]; + if (last.pattern === '/.*/') { + indexToInsert = stylesCount-1; + } + } + + styles.splice(indexToInsert, 0, newStyleRule); + this.activeStyleIndex = indexToInsert; } removeColumnStyle(style) {