From 169d2493bc71aa4d4a6fe4835c13b95d02e33246 Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Tue, 21 May 2019 03:59:48 -0700 Subject: [PATCH] Web console: fix missing value input in timestampSpec step (#7698) --- web-console/src/utils/ingestion-spec.tsx | 27 ++++++++++++++++++++---- web-console/src/views/load-data-view.tsx | 2 +- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/web-console/src/utils/ingestion-spec.tsx b/web-console/src/utils/ingestion-spec.tsx index 9e506189478..678adbb9b78 100644 --- a/web-console/src/utils/ingestion-spec.tsx +++ b/web-console/src/utils/ingestion-spec.tsx @@ -255,11 +255,12 @@ const TIMESTAMP_SPEC_FORM_FIELDS: Field[] = [ { name: 'column', type: 'string', - isDefined: (timestampSpec: TimestampSpec) => isColumnTimestampSpec(timestampSpec) + defaultValue: 'timestamp' }, { name: 'format', type: 'string', + defaultValue: 'auto', suggestions: ['auto'].concat(TIMESTAMP_FORMAT_VALUES), isDefined: (timestampSpec: TimestampSpec) => isColumnTimestampSpec(timestampSpec), info:

@@ -269,12 +270,30 @@ const TIMESTAMP_SPEC_FORM_FIELDS: Field[] = [ { name: 'missingValue', type: 'string', - isDefined: (timestampSpec: TimestampSpec) => !isColumnTimestampSpec(timestampSpec) + placeholder: '(optional)', + info:

+ This value will be used if the specified column can not be found. +

} ]; -export function getTimestampSpecFormFields() { - return TIMESTAMP_SPEC_FORM_FIELDS; +const CONSTANT_TIMESTAMP_SPEC_FORM_FIELDS: Field[] = [ + { + name: 'missingValue', + label: 'Constant value', + type: 'string', + info:

+ The dummy value that will be used as the timestamp. +

+ } +]; + +export function getTimestampSpecFormFields(timestampSpec: TimestampSpec) { + if (isColumnTimestampSpec(timestampSpec)) { + return TIMESTAMP_SPEC_FORM_FIELDS; + } else { + return CONSTANT_TIMESTAMP_SPEC_FORM_FIELDS; + } } export function issueWithTimestampSpec(timestampSpec: TimestampSpec | undefined): string | null { diff --git a/web-console/src/views/load-data-view.tsx b/web-console/src/views/load-data-view.tsx index e69bf262f8a..dbaecd3ed1a 100644 --- a/web-console/src/views/load-data-view.tsx +++ b/web-console/src/views/load-data-view.tsx @@ -1112,7 +1112,7 @@ export class LoadDataView extends React.Component { this.updateSpec(deepSet(spec, 'dataSchema.parser.parseSpec.timestampSpec', timestampSpec));