Browse Source

lint fixes

merge-requests/6/merge
rozetko 3 years ago
parent
commit
9186960dd4
  1. 3
      src/components/Panel.tsx
  2. 6
      src/components/editors/IconsEditor.tsx
  3. 4
      src/components/editors/ThresholdsEditor.tsx
  4. 2
      src/models/options.ts
  5. 2
      src/models/series.ts
  6. 2
      src/utils.ts

3
src/components/Panel.tsx

@ -7,8 +7,7 @@ import { DataProcessor } from '../grafana/data_processor';
import { ChartwerkGaugePod } from '@chartwerk/gauge-pod'; import { ChartwerkGaugePod } from '@chartwerk/gauge-pod';
import { PanelProps } from '@grafana/data'; import { PanelData, TimeRange, PanelProps } from '@grafana/data';
import { PanelData, TimeRange } from '@grafana/data';
import React, { useRef } from 'react'; import React, { useRef } from 'react';
import { css } from 'emotion'; import { css } from 'emotion';

6
src/components/editors/IconsEditor.tsx

@ -86,7 +86,7 @@ const fieldNamePickerSettings = {
settings: { width: 24 }, settings: { width: 24 },
} as any; } as any;
export function IconsEditor({ onChange, value, context }: StandardEditorProps<Array<IconConfig>>) { export function IconsEditor({ onChange, value, context }: StandardEditorProps<IconConfig[]>) {
const icons = value; const icons = value;
const addIcon = () => { const addIcon = () => {
@ -137,7 +137,7 @@ export function IconsEditor({ onChange, value, context }: StandardEditorProps<Ar
<div className={styles.icons}> <div className={styles.icons}>
{icons.map((icon, iconIdx) => { {icons.map((icon, iconIdx) => {
return ( return (
<div className={styles.icon}> <div key={iconIdx} className={styles.icon}>
<IconButton name="trash-alt" onClick={() => removeIcon(iconIdx)}></IconButton> <IconButton name="trash-alt" onClick={() => removeIcon(iconIdx)}></IconButton>
<Input <Input
type="url" type="url"
@ -160,7 +160,7 @@ export function IconsEditor({ onChange, value, context }: StandardEditorProps<Ar
{icon.conditions.map((condition, conditionIdx) => { {icon.conditions.map((condition, conditionIdx) => {
return ( return (
<HorizontalGroup> <HorizontalGroup key={conditionIdx}>
<FieldNamePicker <FieldNamePicker
context={context} context={context}
value={icon.metrics[conditionIdx]} value={icon.metrics[conditionIdx]}

4
src/components/editors/ThresholdsEditor.tsx

@ -19,7 +19,7 @@ import * as _ from 'lodash';
interface Props { interface Props {
defaultColor: string; defaultColor: string;
arcBackground: string; arcBackground: string;
thresholds: Array<ThresholdConfig>; thresholds: ThresholdConfig[];
} }
type ThresholdConfig = { type ThresholdConfig = {
@ -99,7 +99,7 @@ export function ThresholdsEditor({ onChange, value, context }: StandardEditorPro
/> />
{config.thresholds.map((threshold, thresholdIdx) => { {config.thresholds.map((threshold, thresholdIdx) => {
return ( return (
<HorizontalGroup> <HorizontalGroup key={thresholdIdx}>
<Input <Input
type="text" type="text"
value={'Color'} value={'Color'}

2
src/models/options.ts

@ -44,7 +44,7 @@ export class Options {
this.maxValue = aggregatedValue ? aggregatedValue : undefined; this.maxValue = aggregatedValue ? aggregatedValue : undefined;
} }
public getChartwerkOptions(): any { getChartwerkOptions(): any {
console.log('opt', this.maxValue, this.minValue); console.log('opt', this.maxValue, this.minValue);
return { return {
maxValue: this.maxValue, maxValue: this.maxValue,

2
src/models/series.ts

@ -20,7 +20,7 @@ export class Series {
this._seriesList = this._updateSeriesListWithChartwerkParams(filteredSeries); this._seriesList = this._updateSeriesListWithChartwerkParams(filteredSeries);
} }
public getChartwerkSeries(): any[] { getChartwerkSeries(): any[] {
return this._seriesList; return this._seriesList;
} }

2
src/utils.ts

@ -23,7 +23,7 @@ export function getAggregatedValueFromSerie(serie: any, aggregation = Aggregatio
} }
switch (aggregation) { switch (aggregation) {
case Aggregation.LAST: case Aggregation.LAST:
const lastRow = _.last(serie.datapoints as [number, number][]); const lastRow = _.last(serie.datapoints as Array<[number, number]>);
// [0] because it is Grafan series. So 0 idx for values, 1 idx for timestamps // [0] because it is Grafan series. So 0 idx for values, 1 idx for timestamps
// @ts-ignore // @ts-ignore
return !_.isEmpty(lastRow) ? lastRow[0] : null; return !_.isEmpty(lastRow) ? lastRow[0] : null;

Loading…
Cancel
Save