Skip to content

Commit

Permalink
Merge pull request #34 from grafadruid/grafana74
Browse files Browse the repository at this point in the history
updates for grafana 4.0
  • Loading branch information
ahuret authored Feb 7, 2021
2 parents 631823e + 6dfe907 commit 783e02d
Show file tree
Hide file tree
Showing 68 changed files with 1,867 additions and 2,420 deletions.
4 changes: 2 additions & 2 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
...require("./node_modules/@grafana/toolkit/src/config/prettier.plugin.config.json"),
};
...require('./node_modules/@grafana/toolkit/src/config/prettier.plugin.config.json'),
};
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ services:
restart: always

grafana:
image: grafana/grafana:7.3.6
image: grafana/grafana:7.4.0
container_name: grafana
user: root
volumes:
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"author": "Grafadruid",
"license": "Apache-2.0",
"devDependencies": {
"@grafana/data": "7.3.6",
"@grafana/runtime": "7.3.6",
"@grafana/toolkit": "7.3.6",
"@grafana/ui": "7.3.6",
"@grafana/data": "7.4.0",
"@grafana/runtime": "7.4.0",
"@grafana/toolkit": "7.4.0",
"@grafana/ui": "7.4.0",
"@types/lodash": "latest"
},
"engines": {
Expand Down
14 changes: 8 additions & 6 deletions src/ConfigEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ConfigEditor extends PureComponent<Props, State> {

normalizeData = (data: Record<string, any>, namespaced: boolean, namespace: string): object => {
const keyPrefix = namespace + '.';
const keys = Object.keys(data).filter(key => {
const keys = Object.keys(data).filter((key) => {
if (namespaced) {
return !key.includes('.');
} else {
Expand Down Expand Up @@ -60,9 +60,11 @@ export class ConfigEditor extends PureComponent<Props, State> {
const jsonData = { ...options.jsonData, ...connectionSettings };
const connectionSecretSettings = this.normalizeData(secretSettings, true, 'connection');
const secureJsonData = { ...options.secureJsonData, ...connectionSecretSettings };
const connectionSecretSettingsFields = this.normalizeData(secretSettingsFields, true, 'connection') as KeyValue<
boolean
>;
const connectionSecretSettingsFields = this.normalizeData(
secretSettingsFields,
true,
'connection'
) as KeyValue<boolean>;
const secureJsonFields = { ...options.secureJsonFields, ...connectionSecretSettingsFields };
onOptionsChange({ ...options, jsonData, secureJsonData, secureJsonFields });
};
Expand Down Expand Up @@ -114,7 +116,7 @@ export class ConfigEditor extends PureComponent<Props, State> {
return (
<>
<TabsBar>
{tabs.map(t => (
{tabs.map((t) => (
<Tab
key={t.value}
label={t.label}
Expand All @@ -124,7 +126,7 @@ export class ConfigEditor extends PureComponent<Props, State> {
/>
))}
</TabsBar>
<TabContent>{tabs.find(t => t.value === activeTab)?.content}</TabContent>
<TabContent>{tabs.find((t) => t.value === activeTab)?.content}</TabContent>
</>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/DruidDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class DruidDataSource extends DataSourceWithBackend<DruidQuery, DruidSett
});
}
async metricFindQuery(query: DruidQuery, options?: any): Promise<MetricFindValue[]> {
return this.postResource('query-variable', this.applyTemplateVariables(query)).then(response => {
return this.postResource('query-variable', this.applyTemplateVariables(query)).then((response) => {
return response;
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/QueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class QueryEditor extends PureComponent<Props, State> {
return (
<>
<TabsBar>
{tabs.map(t => (
{tabs.map((t) => (
<Tab
key={t.value}
label={t.label}
Expand All @@ -100,7 +100,7 @@ export class QueryEditor extends PureComponent<Props, State> {
/>
))}
</TabsBar>
<TabContent>{tabs.find(t => t.value === activeTab)?.content}</TabContent>
<TabContent>{tabs.find((t) => t.value === activeTab)?.content}</TabContent>
</>
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/VariableQueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class VariableQueryEditor extends PureComponent<Props, State> {
return (
<>
<TabsBar>
{tabs.map(t => (
{tabs.map((t) => (
<Tab
key={t.value}
label={t.label}
Expand All @@ -95,7 +95,7 @@ export class VariableQueryEditor extends PureComponent<Props, State> {
/>
))}
</TabsBar>
<TabContent>{tabs.find(t => t.value === activeTab)?.content}</TabContent>
<TabContent>{tabs.find((t) => t.value === activeTab)?.content}</TabContent>
</>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/aggregation/Aggregation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class Aggregation extends PureComponent<QueryBuilderProps, State> {
};

selectOptionByValue = (value: string): SelectableValue<string> | null => {
const options = this.selectOptions.filter(option => option.value === value.toLowerCase());
const options = this.selectOptions.filter((option) => option.value === value.toLowerCase());
if (options.length > 0) {
return options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/aggregation/Cardinality.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const ComponentRow: FC<ComponentRowProps> = ({ index, component, props, onRemove
return (
<div className={styles.layout}>
<Component {...props} />
<Button variant="secondary" size="xs" onClick={_e => onRemove(index)}>
<Button variant="secondary" size="xs" onClick={(_e) => onRemove(index)}>
<Icon name="trash-alt" />
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/builder/aggregation/Histogram.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class Histogram extends PureComponent<QueryBuilderProps> {
selectOptions = (component: string, opts: Array<SelectableValue<number>>) => {
const { options, onOptionsChange } = this.props;
const { builder } = options;
builder[component] = opts.map(o => o.value);
builder[component] = opts.map((o) => o.value);
this.multiSelectOptions[component] = this.buildMultiSelectOptions(builder[component]);
onOptionsChange({ ...options, builder });
};
Expand Down
2 changes: 1 addition & 1 deletion src/builder/aggregation/Javascript.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class Javascript extends PureComponent<QueryBuilderProps> {
selectOptions = (opts: Array<SelectableValue<string>>) => {
const { options, onOptionsChange } = this.props;
const { builder } = options;
builder.fieldNames = opts.map(o => o.value);
builder.fieldNames = opts.map((o) => o.value);
this.multiSelectOptions = this.buildMultiSelectOptions(builder.fieldNames);
onOptionsChange({ ...options, builder });
};
Expand Down
2 changes: 1 addition & 1 deletion src/builder/bound/Bound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class Bound extends PureComponent<QueryBuilderProps, State> {
};

selectOptionByValue = (value: string): SelectableValue<string> | null => {
const options = this.selectOptions.filter(option => option.value === value.toLowerCase());
const options = this.selectOptions.filter((option) => option.value === value.toLowerCase());
if (options.length > 0) {
return options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/bound/Radius.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class Radius extends PureComponent<QueryBuilderProps> {
selectOptions = (component: string, opts: Array<SelectableValue<number>>) => {
const { options, onOptionsChange } = this.props;
const { builder } = options;
builder[component] = opts.map(o => o.value);
builder[component] = opts.map((o) => o.value);
this.multiSelectOptions[component] = this.buildMultiSelectOptions(builder[component]);
onOptionsChange({ ...options, builder });
};
Expand Down
2 changes: 1 addition & 1 deletion src/builder/bound/Rectangular.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class Rectangular extends PureComponent<QueryBuilderProps> {
selectOptions = (component: string, opts: Array<SelectableValue<number>>) => {
const { options, onOptionsChange } = this.props;
const { builder } = options;
builder[component] = opts.map(o => o.value);
builder[component] = opts.map((o) => o.value);
this.multiSelectOptions[component] = this.buildMultiSelectOptions(builder[component]);
onOptionsChange({ ...options, builder });
};
Expand Down
2 changes: 1 addition & 1 deletion src/builder/datasource/DataSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class DataSource extends PureComponent<QueryBuilderProps, State> {
};

selectOptionByValue = (value: string): SelectableValue<string> | null => {
const options = this.selectOptions.filter(option => option.value === value.toLowerCase());
const options = this.selectOptions.filter((option) => option.value === value.toLowerCase());
if (options.length > 0) {
return options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/datasource/Join.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class Join extends PureComponent<QueryBuilderProps> {
if (undefined === value) {
return undefined;
}
const options = this.selectOptions.filter(option => option.value === value);
const options = this.selectOptions.filter((option) => option.value === value);
if (options.length > 0) {
return options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/datasource/Union.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class Union extends PureComponent<QueryBuilderProps> {
selectOptions = (opts: Array<SelectableValue<string>>) => {
const { options, onOptionsChange } = this.props;
const { builder } = options;
builder.dataSources = opts.map(o => o.value);
builder.dataSources = opts.map((o) => o.value);
this.multiSelectOptions = this.buildMultiSelectOptions(builder.dataSources);
onOptionsChange({ ...options, builder });
};
Expand Down
2 changes: 1 addition & 1 deletion src/builder/dimension/Default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class Default extends PureComponent<QueryBuilderProps> {
if (undefined === value) {
return undefined;
}
const options = this.selectOptions.filter(option => option.value === value);
const options = this.selectOptions.filter((option) => option.value === value);
if (options.length > 0) {
return options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/dimension/Dimension.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class Dimension extends PureComponent<QueryBuilderProps, State> {
};

selectOptionByValue = (value: string): SelectableValue<string> | null => {
const options = this.selectOptions.filter(option => option.value === value.toLowerCase());
const options = this.selectOptions.filter((option) => option.value === value.toLowerCase());
if (options.length > 0) {
return options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/dimension/Extraction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Extraction extends PureComponent<QueryBuilderProps> {
if (undefined === value) {
return undefined;
}
const options = this.selectOptions.filter(option => option.value === value);
const options = this.selectOptions.filter((option) => option.value === value);
if (options.length > 0) {
return options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/dimension/ListFiltered.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class ListFiltered extends PureComponent<QueryBuilderProps> {
selectOptions = (opts: Array<SelectableValue<string>>) => {
const { options, onOptionsChange } = this.props;
const { builder } = options;
builder.values = opts.map(o => o.value);
builder.values = opts.map((o) => o.value);
this.multiSelectOptions = this.buildMultiSelectOptions(builder.values);
onOptionsChange({ ...options, builder });
};
Expand Down
2 changes: 1 addition & 1 deletion src/builder/extractionfn/Cascade.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ComponentRow: FC<ComponentRowProps> = ({ index, component, props, onRemove
return (
<div className={styles.layout}>
<Component {...props} />
<Button variant="secondary" size="xs" onClick={_e => onRemove(index)}>
<Button variant="secondary" size="xs" onClick={(_e) => onRemove(index)}>
<Icon name="trash-alt" />
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/builder/extractionfn/ExtractionFn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class ExtractionFn extends PureComponent<QueryBuilderProps, State> {
};

selectOptionByValue = (value: string): SelectableValue<string> | null => {
const options = this.selectOptions.filter(option => option.value === value.toLowerCase());
const options = this.selectOptions.filter((option) => option.value === value.toLowerCase());
if (options.length > 0) {
return options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/extractionfn/StringFormat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class StringFormat extends PureComponent<QueryBuilderProps> {
if (undefined === value) {
return undefined;
}
const options = this.selectOptions.filter(option => option.value === value);
const options = this.selectOptions.filter((option) => option.value === value);
if (options.length > 0) {
return options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/filter/And.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ComponentRow: FC<ComponentRowProps> = ({ index, component, props, onRemove
return (
<div className={styles.layout}>
<Component {...props} />
<Button variant="secondary" size="xs" onClick={_e => onRemove(index)}>
<Button variant="secondary" size="xs" onClick={(_e) => onRemove(index)}>
<Icon name="trash-alt" />
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/builder/filter/Bound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class Bound extends PureComponent<QueryBuilderProps> {
if (undefined === value) {
return undefined;
}
const options = this.selectOptions[component].filter(option => option.value === value);
const options = this.selectOptions[component].filter((option) => option.value === value);
if (options.length > 0) {
return options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/filter/ColumnComparison.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ComponentRow: FC<ComponentRowProps> = ({ index, component, props, onRemove
return (
<div className={styles.layout}>
<Component {...props} />
<Button variant="secondary" size="xs" onClick={_e => onRemove(index)}>
<Button variant="secondary" size="xs" onClick={(_e) => onRemove(index)}>
<Icon name="trash-alt" />
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/builder/filter/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class Filter extends PureComponent<QueryBuilderProps, State> {
};

selectOptionByValue = (value: string): SelectableValue<string> | null => {
const options = this.selectOptions.filter(option => option.value === value.toLowerCase());
const options = this.selectOptions.filter((option) => option.value === value.toLowerCase());
if (options.length > 0) {
return options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/filter/FilterTuning.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { QueryBuilderProps } from '../types';

export const FilterTuning: React.FunctionComponent<QueryBuilderProps> = props => {
export const FilterTuning: React.FunctionComponent<QueryBuilderProps> = (props) => {
return <div>FilterTuning</div>;
};
2 changes: 1 addition & 1 deletion src/builder/filter/In.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class In extends PureComponent<QueryBuilderProps> {
selectOptions = (opts: Array<SelectableValue<string>>) => {
const { options, onOptionsChange } = this.props;
const { builder } = options;
builder.values = opts.map(o => o.value);
builder.values = opts.map((o) => o.value);
this.multiSelectOptions = this.buildMultiSelectOptions(builder.values);
onOptionsChange({ ...options, builder });
};
Expand Down
2 changes: 1 addition & 1 deletion src/builder/filter/Interval.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const ComponentRow: FC<ComponentRowProps> = ({ index, component, props, onRemove
return (
<div className={styles.layout}>
<Component {...props} />
<Button variant="secondary" size="xs" onClick={_e => onRemove(index)}>
<Button variant="secondary" size="xs" onClick={(_e) => onRemove(index)}>
<Icon name="trash-alt" />
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/builder/filter/Or.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ComponentRow: FC<ComponentRowProps> = ({ index, component, props, onRemove
return (
<div className={styles.layout}>
<Component {...props} />
<Button variant="secondary" size="xs" onClick={_e => onRemove(index)}>
<Button variant="secondary" size="xs" onClick={(_e) => onRemove(index)}>
<Icon name="trash-alt" />
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/builder/granularity/Granularity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class Granularity extends PureComponent<QueryBuilderProps, State> {
};

selectOptionByValue = (value: string): SelectableValue<string> | null => {
const options = this.selectOptions.filter(option => option.value === value.toLowerCase());
const options = this.selectOptions.filter((option) => option.value === value.toLowerCase());
if (options.length > 0) {
return options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/granularity/Simple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class Simple extends PureComponent<QueryBuilderProps> {
if (undefined === value) {
return undefined;
}
const options = this.selectOptions.filter(option => option.value === value);
const options = this.selectOptions.filter((option) => option.value === value);
if (options.length > 0) {
return options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/havingspec/And.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ComponentRow: FC<ComponentRowProps> = ({ index, component, props, onRemove
return (
<div className={styles.layout}>
<Component {...props} />
<Button variant="secondary" size="xs" onClick={_e => onRemove(index)}>
<Button variant="secondary" size="xs" onClick={(_e) => onRemove(index)}>
<Icon name="trash-alt" />
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/builder/havingspec/HavingSpec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class HavingSpec extends PureComponent<QueryBuilderProps, State> {
};

selectOptionByValue = (value: string): SelectableValue<string> | null => {
const options = this.selectOptions.filter(option => option.value === value.toLowerCase());
const options = this.selectOptions.filter((option) => option.value === value.toLowerCase());
if (options.length > 0) {
return options[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/builder/havingspec/Or.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ComponentRow: FC<ComponentRowProps> = ({ index, component, props, onRemove
return (
<div className={styles.layout}>
<Component {...props} />
<Button variant="secondary" size="xs" onClick={_e => onRemove(index)}>
<Button variant="secondary" size="xs" onClick={(_e) => onRemove(index)}>
<Icon name="trash-alt" />
</Button>
</div>
Expand Down
Loading

0 comments on commit 783e02d

Please sign in to comment.