Query option to override use trends option, fixes #1442
This commit is contained in:
@@ -69,6 +69,7 @@ const getDefaultQuery: () => Partial<ZabbixMetricsQuery> = () => ({
|
||||
skipEmptyValues: false,
|
||||
disableDataAlignment: false,
|
||||
useZabbixValueMapping: false,
|
||||
useTrends: 'default',
|
||||
},
|
||||
table: {
|
||||
skipEmptyValues: false,
|
||||
@@ -103,7 +104,9 @@ export interface ZabbixQueryEditorProps
|
||||
extends QueryEditorProps<ZabbixDatasource, ZabbixMetricsQuery, ZabbixDSOptions> {}
|
||||
|
||||
export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: ZabbixQueryEditorProps) => {
|
||||
query = { ...getDefaultQuery(), ...query };
|
||||
const queryDefaults = getDefaultQuery();
|
||||
query = { ...queryDefaults, ...query };
|
||||
query.options = { ...queryDefaults.options, ...query.options };
|
||||
const { queryType } = query;
|
||||
if (queryType === c.MODE_PROBLEMS || queryType === c.MODE_TRIGGERS) {
|
||||
const defaults = getProblemsQueryDefaults();
|
||||
|
||||
@@ -26,6 +26,12 @@ const sortOptions: Array<SelectableValue<string>> = [
|
||||
{ label: 'Severity', value: 'severity' },
|
||||
];
|
||||
|
||||
const trendsOptions: Array<SelectableValue<string>> = [
|
||||
{ label: 'Default', value: 'default' },
|
||||
{ label: 'True', value: 'true' },
|
||||
{ label: 'False', value: 'false' },
|
||||
];
|
||||
|
||||
interface Props {
|
||||
queryType: string;
|
||||
queryOptions: ZabbixQueryOptions;
|
||||
@@ -93,6 +99,15 @@ export const QueryOptionsEditor = ({ queryType, queryOptions, onChange }: Props)
|
||||
const renderMetricOptions = () => {
|
||||
return (
|
||||
<>
|
||||
<InlineField label="Trends" labelWidth={24}>
|
||||
<Select
|
||||
isSearchable={false}
|
||||
width={16}
|
||||
value={queryOptions.useTrends}
|
||||
options={trendsOptions}
|
||||
onChange={onPropChange('useTrends')}
|
||||
/>
|
||||
</InlineField>
|
||||
<InlineField label="Show disabled items" labelWidth={24}>
|
||||
<InlineSwitch
|
||||
value={queryOptions.showDisabledItems}
|
||||
|
||||
Reference in New Issue
Block a user