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 { PanelProps } from '@grafana/data';
import { PanelData, TimeRange } from '@grafana/data';
import { PanelData, TimeRange, PanelProps } from '@grafana/data';
import React, { useRef } from 'react';
import { css } from 'emotion';

6
src/components/editors/IconsEditor.tsx

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

4
src/components/editors/ThresholdsEditor.tsx

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

2
src/models/options.ts

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

2
src/models/series.ts

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

2
src/utils.ts

@ -23,7 +23,7 @@ export function getAggregatedValueFromSerie(serie: any, aggregation = Aggregatio
}
switch (aggregation) {
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
// @ts-ignore
return !_.isEmpty(lastRow) ? lastRow[0] : null;

Loading…
Cancel
Save