Problems: Able to select tags evaluation type, fixes #1600
This commit is contained in:
@@ -4,7 +4,7 @@ import { InlineField, InlineFieldRow, Select } from '@grafana/ui';
|
||||
import * as c from '../constants';
|
||||
import { migrate, DS_QUERY_SCHEMA } from '../migrations';
|
||||
import { ZabbixDatasource } from '../datasource';
|
||||
import { ShowProblemTypes, ZabbixDSOptions, ZabbixMetricsQuery, ZabbixQueryOptions } from '../types';
|
||||
import { ShowProblemTypes, ZabbixDSOptions, ZabbixMetricsQuery, ZabbixQueryOptions, ZabbixTagEvalType } from '../types';
|
||||
import { MetricsQueryEditor } from './QueryEditor/MetricsQueryEditor';
|
||||
import { QueryFunctionsEditor } from './QueryEditor/QueryFunctionsEditor';
|
||||
import { QueryOptionsEditor } from './QueryEditor/QueryOptionsEditor';
|
||||
@@ -68,6 +68,7 @@ const getDefaultQuery: () => Partial<ZabbixMetricsQuery> = () => ({
|
||||
tags: { filter: '' },
|
||||
proxy: { filter: '' },
|
||||
textFilter: '',
|
||||
evaltype: ZabbixTagEvalType.AndOr,
|
||||
options: {
|
||||
showDisabledItems: false,
|
||||
skipEmptyValues: false,
|
||||
|
||||
@@ -8,7 +8,7 @@ import { QueryEditorRow } from './QueryEditorRow';
|
||||
import { MetricPicker } from '../../../components';
|
||||
import { getVariableOptions } from './utils';
|
||||
import { ZabbixDatasource } from '../../datasource';
|
||||
import { ZabbixMetricsQuery } from '../../types';
|
||||
import { ZabbixMetricsQuery, ZabbixTagEvalType } from '../../types';
|
||||
|
||||
const showProblemsOptions: Array<SelectableValue<string>> = [
|
||||
{ label: 'Problems', value: 'problems' },
|
||||
@@ -25,6 +25,11 @@ const severityOptions: Array<SelectableValue<number>> = [
|
||||
{ value: 5, label: 'Disaster' },
|
||||
];
|
||||
|
||||
const evaltypeOptions: Array<SelectableValue<ZabbixTagEvalType>> = [
|
||||
{ label: 'AND/OR', value: ZabbixTagEvalType.AndOr },
|
||||
{ label: 'OR', value: ZabbixTagEvalType.Or },
|
||||
];
|
||||
|
||||
export interface Props {
|
||||
query: ZabbixMetricsQuery;
|
||||
datasource: ZabbixDatasource;
|
||||
@@ -206,6 +211,15 @@ export const ProblemsQueryEditor = ({ query, datasource, onChange }: Props) => {
|
||||
onBlur={onTextFilterChange('tags')}
|
||||
/>
|
||||
</InlineField>
|
||||
<InlineField>
|
||||
<Select
|
||||
isSearchable={false}
|
||||
width={15}
|
||||
value={query.evaltype}
|
||||
options={evaltypeOptions}
|
||||
onChange={onPropChange('evaltype')}
|
||||
/>
|
||||
</InlineField>
|
||||
</QueryEditorRow>
|
||||
<QueryEditorRow>
|
||||
<InlineField label="Show" labelWidth={12}>
|
||||
|
||||
Reference in New Issue
Block a user