Browse Source

made unknown color theme aware and sync with graph color, some minor cleanup

Torkel Ödegaard 7 years ago
parent
commit
9ac3821454

+ 2 - 2
public/app/core/logs_model.ts

@@ -1,6 +1,6 @@
 import _ from 'lodash';
 import _ from 'lodash';
 import { TimeSeries } from 'app/core/core';
 import { TimeSeries } from 'app/core/core';
-import colors from 'app/core/utils/colors';
+import colors, { getThemeColor } from 'app/core/utils/colors';
 
 
 export enum LogLevel {
 export enum LogLevel {
   crit = 'critical',
   crit = 'critical',
@@ -22,7 +22,7 @@ export const LogLevelColor = {
   [LogLevel.info]: colors[0],
   [LogLevel.info]: colors[0],
   [LogLevel.debug]: colors[5],
   [LogLevel.debug]: colors[5],
   [LogLevel.trace]: colors[2],
   [LogLevel.trace]: colors[2],
-  [LogLevel.unkown]: '#ddd',
+  [LogLevel.unkown]: getThemeColor('#8e8e8e', '#dde4ed'),
 };
 };
 
 
 export interface LogSearchMatch {
 export interface LogSearchMatch {

+ 5 - 0
public/app/core/utils/colors.ts

@@ -1,5 +1,6 @@
 import _ from 'lodash';
 import _ from 'lodash';
 import tinycolor from 'tinycolor2';
 import tinycolor from 'tinycolor2';
+import config from 'app/core/config';
 
 
 export const PALETTE_ROWS = 4;
 export const PALETTE_ROWS = 4;
 export const PALETTE_COLUMNS = 14;
 export const PALETTE_COLUMNS = 14;
@@ -90,5 +91,9 @@ export function hslToHex(color) {
   return tinycolor(color).toHexString();
   return tinycolor(color).toHexString();
 }
 }
 
 
+export function getThemeColor(dark: string, light: string): string {
+  return config.bootData.user.lightTheme ? light : dark;
+}
+
 export let sortedColors = sortColorsByHue(colors);
 export let sortedColors = sortColorsByHue(colors);
 export default colors;
 export default colors;

+ 3 - 0
public/sass/_variables.dark.scss

@@ -350,3 +350,6 @@ $diff-json-icon: $gray-7;
 
 
 //Submenu
 //Submenu
 $variable-option-bg: $blue-dark;
 $variable-option-bg: $blue-dark;
+
+// logs
+$logs-color-unkown: $gray-2;

+ 3 - 0
public/sass/_variables.light.scss

@@ -359,3 +359,6 @@ $diff-json-icon: $gray-4;
 
 
 //Submenu
 //Submenu
 $variable-option-bg: $blue-light;
 $variable-option-bg: $blue-light;
+
+// logs
+$logs-color-unkown: $gray-5;

+ 1 - 11
public/sass/components/_panel_logs.scss

@@ -54,7 +54,6 @@ $column-horizontal-spacing: 10px;
   font-size: 12px;
   font-size: 12px;
   display: table;
   display: table;
   table-layout: fixed;
   table-layout: fixed;
-  margin: 0 -(nth($panel-padding, 2));
 }
 }
 
 
 .logs-row {
 .logs-row {
@@ -66,14 +65,6 @@ $column-horizontal-spacing: 10px;
     vertical-align: middle;
     vertical-align: middle;
     border-top: 1px solid transparent;
     border-top: 1px solid transparent;
     border-bottom: 1px solid transparent;
     border-bottom: 1px solid transparent;
-
-    &:first-child {
-      padding-left: $column-horizontal-spacing - 2px;
-    }
-
-    &:last-child {
-      padding-left: $column-horizontal-spacing;
-    }
   }
   }
 
 
   &:hover {
   &:hover {
@@ -111,7 +102,6 @@ $column-horizontal-spacing: 10px;
 
 
 .logs-row__level {
 .logs-row__level {
   position: relative;
   position: relative;
-  // width: 12px;
 
 
   &::after {
   &::after {
     content: '';
     content: '';
@@ -120,7 +110,7 @@ $column-horizontal-spacing: 10px;
     top: 1px;
     top: 1px;
     bottom: 1px;
     bottom: 1px;
     width: 3px;
     width: 3px;
-    background-color: $gray-2;
+    background-color: $logs-color-unkown;
   }
   }
 
 
   &--critical,
   &--critical,