diff --git a/web-console/e2e-tests/component/load-data/config/partition.ts b/web-console/e2e-tests/component/load-data/config/partition.ts index f811a531664..375ad550745 100644 --- a/web-console/e2e-tests/component/load-data/config/partition.ts +++ b/web-console/e2e-tests/component/load-data/config/partition.ts @@ -26,10 +26,10 @@ import { getLabeledInput, selectSuggestibleInput, setLabeledInput } from '../../ * Possible values for partition step segment granularity. */ export enum SegmentGranularity { - HOUR = 'HOUR', - DAY = 'DAY', - MONTH = 'MONTH', - YEAR = 'YEAR', + HOUR = 'hour', + DAY = 'day', + MONTH = 'month', + YEAR = 'year', } const PARTITIONING_TYPE = 'Partitioning type'; diff --git a/web-console/src/components/auto-form/__snapshots__/auto-form.spec.tsx.snap b/web-console/src/components/auto-form/__snapshots__/auto-form.spec.tsx.snap index 1a4000ef00f..baf1011bdc8 100644 --- a/web-console/src/components/auto-form/__snapshots__/auto-form.spec.tsx.snap +++ b/web-console/src/components/auto-form/__snapshots__/auto-form.spec.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`auto-form snapshot matches snapshot 1`] = ` +exports[`AutoForm matches snapshot 1`] = `
@@ -132,5 +132,16 @@ exports[`auto-form snapshot matches snapshot 1`] = ` placeholder="" /> + + +
`; diff --git a/web-console/src/components/auto-form/auto-form.spec.tsx b/web-console/src/components/auto-form/auto-form.spec.tsx index 89bd645e9f6..c2beb3d498b 100644 --- a/web-console/src/components/auto-form/auto-form.spec.tsx +++ b/web-console/src/components/auto-form/auto-form.spec.tsx @@ -21,7 +21,7 @@ import React from 'react'; import { AutoForm } from './auto-form'; -describe('auto-form snapshot', () => { +describe('AutoForm', () => { it('matches snapshot', () => { const autoForm = shallow( { { name: 'testFive', type: 'string-array' }, { name: 'testSix', type: 'json' }, { name: 'testSeven', type: 'json' }, + + { name: 'testNotDefined', type: 'string', defined: false }, + { name: 'testAdvanced', type: 'string', hideInMore: true }, ]} model={String} onChange={() => {}} diff --git a/web-console/src/components/auto-form/auto-form.tsx b/web-console/src/components/auto-form/auto-form.tsx index 6ae9e4b3b4d..3b2f6c0da0e 100644 --- a/web-console/src/components/auto-form/auto-form.tsx +++ b/web-console/src/components/auto-form/auto-form.tsx @@ -17,6 +17,7 @@ */ import { Button, ButtonGroup, FormGroup, Intent, NumericInput } from '@blueprintjs/core'; +import { IconNames } from '@blueprintjs/icons'; import React from 'react'; import { deepDelete, deepGet, deepSet } from '../../utils'; @@ -54,6 +55,7 @@ export interface Field { disabled?: Functor; defined?: Functor; required?: Functor; + hideInMore?: Functor; adjustment?: (model: M) => M; issueWithValue?: (value: any) => string | undefined; } @@ -68,7 +70,14 @@ export interface AutoFormProps { globalAdjustment?: (model: M) => M; } -export class AutoForm> extends React.PureComponent> { +export interface AutoFormState { + showMore: boolean; +} + +export class AutoForm> extends React.PureComponent< + AutoFormProps, + AutoFormState +> { static REQUIRED_INTENT = Intent.PRIMARY; static makeLabelName(label: string): string { @@ -138,7 +147,9 @@ export class AutoForm> extends React.PureComponent constructor(props: AutoFormProps) { super(props); - this.state = {}; + this.state = { + showMore: false, + }; } private fieldChange = (field: Field, newValue: any) => { @@ -391,7 +402,6 @@ export class AutoForm> extends React.PureComponent private renderField = (field: Field) => { const { model } = this.props; if (!model) return; - if (!AutoForm.evaluateFunctor(field.defined, model, true)) return; const label = field.label || AutoForm.makeLabelName(field.name); return ( @@ -415,12 +425,46 @@ export class AutoForm> extends React.PureComponent ); } + renderMoreOrLess() { + const { showMore } = this.state; + + return ( + +