You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by fj...@apache.org on 2019/05/21 18:30:37 UTC

[incubator-druid] branch 0.15.0-incubating updated: Web console: fix missing value input in timestampSpec step (#7698) (#7721)

This is an automated email from the ASF dual-hosted git repository.

fjy pushed a commit to branch 0.15.0-incubating
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/0.15.0-incubating by this push:
     new f44496c  Web console: fix missing value input in timestampSpec step (#7698) (#7721)
f44496c is described below

commit f44496c89f318dc2d8771b37d3eeefb576207394
Author: Clint Wylie <cj...@gmail.com>
AuthorDate: Tue May 21 11:30:32 2019 -0700

    Web console: fix missing value input in timestampSpec step (#7698) (#7721)
---
 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 f89dadb..8363d0d 100644
--- a/web-console/src/utils/ingestion-spec.tsx
+++ b/web-console/src/utils/ingestion-spec.tsx
@@ -250,11 +250,12 @@ const TIMESTAMP_SPEC_FORM_FIELDS: Field<TimestampSpec>[] = [
   {
     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: <p>
@@ -264,12 +265,30 @@ const TIMESTAMP_SPEC_FORM_FIELDS: Field<TimestampSpec>[] = [
   {
     name: 'missingValue',
     type: 'string',
-    isDefined: (timestampSpec: TimestampSpec) => !isColumnTimestampSpec(timestampSpec)
+    placeholder: '(optional)',
+    info: <p>
+      This value will be used if the specified column can not be found.
+    </p>
   }
 ];
 
-export function getTimestampSpecFormFields() {
-  return TIMESTAMP_SPEC_FORM_FIELDS;
+const CONSTANT_TIMESTAMP_SPEC_FORM_FIELDS: Field<TimestampSpec>[] = [
+  {
+    name: 'missingValue',
+    label: 'Constant value',
+    type: 'string',
+    info: <p>
+      The dummy value that will be used as the timestamp.
+    </p>
+  }
+];
+
+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 bbd9e76..ca144fc 100644
--- a/web-console/src/views/load-data-view.tsx
+++ b/web-console/src/views/load-data-view.tsx
@@ -1026,7 +1026,7 @@ export class LoadDataView extends React.Component<LoadDataViewProps, LoadDataVie
           </ButtonGroup>
         </FormGroup>
         <AutoForm
-          fields={getTimestampSpecFormFields()}
+          fields={getTimestampSpecFormFields(timestampSpec)}
           model={timestampSpec}
           onChange={(timestampSpec) => {
             this.updateSpec(deepSet(spec, 'dataSchema.parser.parseSpec.timestampSpec', timestampSpec));


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org