Explorar el Código

changing type and started on Gauge

Peter Holmberg hace 7 años
padre
commit
f7cb5a1fd5
Se han modificado 2 ficheros con 13 adiciones y 9 borrados
  1. 1 1
      public/app/plugins/panel/gauge/MappingRow.tsx
  2. 12 8
      public/app/viz/Gauge.tsx

+ 1 - 1
public/app/plugins/panel/gauge/MappingRow.tsx

@@ -159,7 +159,7 @@ export default class MappingRow extends PureComponent<Props, State> {
             value={mappingOptions.find(o => o.value === mapping.type)}
             getOptionLabel={i => i.label}
             getOptionValue={i => i.value}
-            onSelected={type => this.onMappingTypeChange(type)}
+            onSelected={type => this.onMappingTypeChange(type.value)}
             width={7}
           />
         </div>

+ 12 - 8
public/app/viz/Gauge.tsx

@@ -1,38 +1,42 @@
 import React, { PureComponent } from 'react';
 import $ from 'jquery';
-import { Threshold, TimeSeriesVMs } from 'app/types';
+import { RangeMap, Threshold, TimeSeriesVMs, ValueMap } from 'app/types';
 import config from '../core/config';
 import kbn from '../core/utils/kbn';
 
 interface Props {
   decimals: number;
+  height: number;
+  mappings: Array<RangeMap | ValueMap>;
+  maxValue: number;
+  minValue: number;
+  prefix: string;
   timeSeries: TimeSeriesVMs;
-  showThresholdMarkers: boolean;
   thresholds: Threshold[];
+  showThresholdMarkers: boolean;
   showThresholdLabels: boolean;
-  unit: string;
-  width: number;
-  height: number;
   stat: string;
-  prefix: string;
   suffix: string;
+  unit: string;
+  width: number;
 }
 
 export class Gauge extends PureComponent<Props> {
   canvasElement: any;
 
   static defaultProps = {
-    minValue: 0,
     maxValue: 100,
+    mappings: [],
+    minValue: 0,
     prefix: '',
     showThresholdMarkers: true,
     showThresholdLabels: false,
     suffix: '',
-    unit: 'none',
     thresholds: [
       { label: 'Min', value: 0, color: 'rgba(50, 172, 45, 0.97)' },
       { label: 'Max', value: 100, color: 'rgba(245, 54, 54, 0.9)' },
     ],
+    unit: 'none',
   };
 
   componentDidMount() {