From 7c14fa08f8198385075f223bcd5994b1f47ae7d0 Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Tue, 24 Sep 2019 12:27:46 -0700 Subject: [PATCH] Web console: Expand filter UI (#8579) * add controls to the filter UI * fix double base --- .../dialogs/status-dialog/status-dialog.tsx | 2 +- web-console/src/utils/ingestion-spec.tsx | 53 +++++++++++++++++-- .../views/load-data-view/load-data-view.tsx | 1 + 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/web-console/src/dialogs/status-dialog/status-dialog.tsx b/web-console/src/dialogs/status-dialog/status-dialog.tsx index af800eb0a5b..b9f16541156 100644 --- a/web-console/src/dialogs/status-dialog/status-dialog.tsx +++ b/web-console/src/dialogs/status-dialog/status-dialog.tsx @@ -110,7 +110,7 @@ export class StatusDialog extends React.PureComponent window.open(UrlBaser.base(UrlBaser.base(`/status`)), '_blank')} + onClick={() => window.open(UrlBaser.base(`/status`), '_blank')} />
diff --git a/web-console/src/utils/ingestion-spec.tsx b/web-console/src/utils/ingestion-spec.tsx index fdc85a6c645..12f29bd862b 100644 --- a/web-console/src/utils/ingestion-spec.tsx +++ b/web-console/src/utils/ingestion-spec.tsx @@ -286,11 +286,13 @@ const PARSE_SPEC_FORM_FIELDS: Field[] = [ { name: 'pattern', type: 'string', + required: true, defined: (p: ParseSpec) => p.format === 'regex', }, { name: 'function', type: 'string', + required: true, defined: (p: ParseSpec) => p.format === 'javascript', }, { @@ -513,11 +515,13 @@ const FLATTEN_FIELD_FORM_FIELDS: Field[] = [ name: 'name', type: 'string', placeholder: 'column_name', + required: true, }, { name: 'type', type: 'string', suggestions: ['path', 'jq', 'root'], + required: true, }, { name: 'expr', @@ -525,6 +529,7 @@ const FLATTEN_FIELD_FORM_FIELDS: Field[] = [ placeholder: '$.thing', defined: (flattenField: FlattenField) => flattenField.type === 'path' || flattenField.type === 'jq', + required: true, info: ( <> Specify a flatten{' '} @@ -557,16 +562,19 @@ const TRANSFORM_FORM_FIELDS: Field[] = [ name: 'name', type: 'string', placeholder: 'output_name', + required: true, }, { name: 'type', type: 'string', suggestions: ['expression'], + required: true, }, { name: 'expression', type: 'string', placeholder: '"foo" + "bar"', + required: true, info: ( <> A valid Druid{' '} @@ -2126,21 +2134,60 @@ const FILTER_FORM_FIELDS: Field[] = [ { name: 'type', type: 'string', - suggestions: ['selector', 'in'], + suggestions: ['selector', 'in', 'regex', 'like', 'not'], }, { name: 'dimension', type: 'string', + defined: (df: DruidFilter) => ['selector', 'in', 'regex', 'like'].includes(df.type), }, { name: 'value', type: 'string', - defined: (druidFilter: DruidFilter) => druidFilter.type === 'selector', + defined: (df: DruidFilter) => df.type === 'selector', }, { name: 'values', type: 'string-array', - defined: (druidFilter: DruidFilter) => druidFilter.type === 'in', + defined: (df: DruidFilter) => df.type === 'in', + }, + { + name: 'pattern', + type: 'string', + defined: (df: DruidFilter) => ['regex', 'like'].includes(df.type), + }, + + { + name: 'field.type', + label: 'Sub-filter type', + type: 'string', + suggestions: ['selector', 'in', 'regex', 'like'], + defined: (df: DruidFilter) => df.type === 'not', + }, + { + name: 'field.dimension', + label: 'Sub-filter dimension', + type: 'string', + defined: (df: DruidFilter) => df.type === 'not', + }, + { + name: 'field.value', + label: 'Sub-filter value', + type: 'string', + defined: (df: DruidFilter) => df.type === 'not' && deepGet(df, 'field.type') === 'selector', + }, + { + name: 'field.values', + label: 'Sub-filter values', + type: 'string-array', + defined: (df: DruidFilter) => df.type === 'not' && deepGet(df, 'field.type') === 'in', + }, + { + name: 'field.pattern', + label: 'Sub-filter pattern', + type: 'string', + defined: (df: DruidFilter) => + df.type === 'not' && ['regex', 'like'].includes(deepGet(df, 'field.type')), }, ]; diff --git a/web-console/src/views/load-data-view/load-data-view.tsx b/web-console/src/views/load-data-view/load-data-view.tsx index 5d1a6358f35..9b122131ad7 100644 --- a/web-console/src/views/load-data-view/load-data-view.tsx +++ b/web-console/src/views/load-data-view/load-data-view.tsx @@ -1989,6 +1989,7 @@ export class LoadDataView extends React.PureComponent this.setState({ selectedFilter: f })} + showCustom={f => !['selector', 'in', 'regex', 'like', 'not'].includes(f.type)} />