From 1cff73f3e0556e1e76074bb6974a4b61db3717e1 Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Wed, 4 Dec 2019 20:21:07 -0800 Subject: [PATCH] Web console: support new ingest spec format (#8828) * converter v1 * working v1 * update tests * update tests * upgrades * adjust to new API * remove hack * fwd * step * neo cache * fix time selection * smart reset * parquest autodetection * add binaryAsString option * partitionsSpec * add ORC support * ingestSegment -> druid * remove index tasks * better min * load data works * remove downgrade * filter on group_id * fix group_id in test * update auto form for new props * add dropBeforeByPeriod rule * simplify * prettify json --- .../assets/{ingestsegment.png => druid.png} | Bin ...static-google-blobstore.png => google.png} | Bin web-console/assets/{static-s3.png => s3.png} | Bin .../components/array-input/array-input.tsx | 11 +- .../src/components/auto-form/auto-form.tsx | 82 +- .../__snapshots__/rule-editor.spec.tsx.snap | 75 +- .../components/rule-editor/rule-editor.scss | 7 +- .../components/rule-editor/rule-editor.tsx | 110 ++- .../suggestible-input/suggestible-input.tsx | 4 +- web-console/src/console-application.tsx | 12 +- .../dialogs/doctor-dialog/doctor-checks.tsx | 24 +- .../__snapshots__/ingestion-spec.spec.ts.snap | 76 ++ web-console/src/utils/druid-type.ts | 10 +- web-console/src/utils/ingestion-spec.spec.ts | 99 +++ web-console/src/utils/ingestion-spec.tsx | 709 +++++++++++------- web-console/src/utils/load-rule.ts | 143 ++-- web-console/src/utils/object-change.ts | 10 + web-console/src/utils/sampler.ts | 415 +++++----- web-console/src/utils/spec-utils.ts | 4 +- web-console/src/utils/utils.spec.ts | 225 +++--- .../ingestion-view.spec.tsx.snap | 2 +- .../ingestion-view/ingestion-view.spec.tsx | 2 +- .../views/ingestion-view/ingestion-view.tsx | 4 +- .../load-data-view.spec.tsx.snap | 4 +- .../filter-table/filter-table.spec.tsx | 2 +- .../load-data-view/load-data-view.spec.tsx | 2 +- .../views/load-data-view/load-data-view.tsx | 448 +++++------ .../parse-data-table.spec.tsx | 2 +- .../parse-data-table/parse-data-table.tsx | 16 +- .../parse-time-table.spec.tsx | 6 +- .../schema-table/schema-table.spec.tsx | 2 +- .../transform-table/transform-table.spec.tsx | 2 +- .../src/views/query-view/query-view.tsx | 2 +- .../query-view/run-button/run-button.tsx | 2 +- 34 files changed, 1386 insertions(+), 1126 deletions(-) rename web-console/assets/{ingestsegment.png => druid.png} (100%) rename web-console/assets/{static-google-blobstore.png => google.png} (100%) rename web-console/assets/{static-s3.png => s3.png} (100%) create mode 100644 web-console/src/utils/__snapshots__/ingestion-spec.spec.ts.snap create mode 100644 web-console/src/utils/ingestion-spec.spec.ts diff --git a/web-console/assets/ingestsegment.png b/web-console/assets/druid.png similarity index 100% rename from web-console/assets/ingestsegment.png rename to web-console/assets/druid.png diff --git a/web-console/assets/static-google-blobstore.png b/web-console/assets/google.png similarity index 100% rename from web-console/assets/static-google-blobstore.png rename to web-console/assets/google.png diff --git a/web-console/assets/static-s3.png b/web-console/assets/s3.png similarity index 100% rename from web-console/assets/static-s3.png rename to web-console/assets/s3.png diff --git a/web-console/src/components/array-input/array-input.tsx b/web-console/src/components/array-input/array-input.tsx index 02b0f12beb3..ec82932ccb7 100644 --- a/web-console/src/components/array-input/array-input.tsx +++ b/web-console/src/components/array-input/array-input.tsx @@ -23,7 +23,7 @@ import { compact } from '../../utils'; export interface ArrayInputProps { className?: string; - values: string[]; + values: string[] | undefined; onChange: (newValues: string[] | undefined) => void; placeholder?: string; large?: boolean; @@ -40,8 +40,11 @@ export const ArrayInput = React.memo(function ArrayInput(props: ArrayInputProps) const stringValue = e.target.value; const newValues: string[] = stringValue.split(/[,\s]+/).map((v: string) => v.trim()); const newValuesFiltered = compact(newValues); - if (newValues.length === newValuesFiltered.length) { - onChange(stringValue === '' ? undefined : newValuesFiltered); + if (stringValue === '') { + onChange(undefined); + setStringValue(undefined); + } else if (newValues.length === newValuesFiltered.length) { + onChange(newValuesFiltered); setStringValue(undefined); } else { setStringValue(stringValue); @@ -51,7 +54,7 @@ export const ArrayInput = React.memo(function ArrayInput(props: ArrayInputProps) return (