Web-console: Add continue to spec view (#8144)

* Add continue to spec view

* update spec when type selected

* remove redundancy

* fix mistakes
This commit is contained in:
mcbrewster 2019-07-25 14:48:26 -07:00 committed by Fangjin Yang
parent 8ba1f06632
commit ef9230f916
2 changed files with 63 additions and 6 deletions

View File

@ -16,6 +16,8 @@
* limitations under the License. * limitations under the License.
*/ */
@import '../../variables';
.load-data-view { .load-data-view {
height: 100%; height: 100%;
display: grid; display: grid;
@ -27,6 +29,29 @@
'main ctrl' 'main ctrl'
'main next'; 'main next';
&.load-data-continue-view {
display: grid;
justify-content: center;
grid-gap: $standard-padding;
grid-template-columns: 500px 500px;
.spec-card {
height: 100px;
display: grid;
grid-gap: $standard-padding;
grid-template-columns: 30px 1fr;
.spec-card-header {
font-size: 25px;
line-height: 30px;
.spec-card-caption {
font-size: 15px;
line-height: 20px;
}
}
}
}
&.welcome { &.welcome {
.main { .main {
height: 100%; height: 100%;

View File

@ -283,6 +283,8 @@ export interface LoadDataViewState {
selectedDimensionSpec: DimensionSpec | null; selectedDimensionSpec: DimensionSpec | null;
selectedMetricSpecIndex: number; selectedMetricSpecIndex: number;
selectedMetricSpec: MetricSpec | null; selectedMetricSpec: MetricSpec | null;
continueToSpec: boolean;
} }
export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDataViewState> { export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDataViewState> {
@ -343,6 +345,8 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
selectedDimensionSpec: null, selectedDimensionSpec: null,
selectedMetricSpecIndex: -1, selectedMetricSpecIndex: -1,
selectedMetricSpec: null, selectedMetricSpec: null,
continueToSpec: false,
}; };
} }
@ -361,6 +365,10 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
} else { } else {
this.updateStep('connect'); this.updateStep('connect');
} }
if (isEmptyIngestionSpec(spec)) {
this.setState({ continueToSpec: true });
}
} }
async getOverlordModules() { async getOverlordModules() {
@ -408,11 +416,37 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
}; };
render() { render() {
const { step } = this.state; const { step, continueToSpec } = this.state;
if (!continueToSpec) {
return (
<div className={classNames('load-data-continue-view load-data-view')}>
<Card className={'spec-card'} interactive onClick={this.handleResetConfirm}>
<Icon iconSize={30} icon={IconNames.ASTERISK} />
<div className={'spec-card-header'}>
Start a new spec
<div className={'spec-card-caption'}>start a new spec something something</div>
</div>
</Card>
<Card
className={'spec-card'}
interactive
onClick={() => this.setState({ continueToSpec: true })}
>
<Icon icon={IconNames.REPEAT} iconSize={30} />
<div className={'spec-card-header'}>
Continue from previous spec
<div className={'spec-card-caption'}>
Continue from most recent spec you were working on
</div>
</div>
</Card>
{this.renderResetConfirm()}
</div>
);
}
return ( return (
<div className={classNames('load-data-view', 'app-view', step)}> <div className={classNames('load-data-view', 'app-view', step)}>
{this.renderStepNav()} {this.renderStepNav()}
{step === 'welcome' && this.renderWelcomeStep()} {step === 'welcome' && this.renderWelcomeStep()}
{step === 'connect' && this.renderConnectStep()} {step === 'connect' && this.renderConnectStep()}
{step === 'parser' && this.renderParserStep()} {step === 'parser' && this.renderParserStep()}
@ -659,9 +693,7 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
text="Connect data" text="Connect data"
rightIcon={IconNames.ARROW_RIGHT} rightIcon={IconNames.ARROW_RIGHT}
onClick={() => { onClick={() => {
this.setState({ this.updateSpec(updateIngestionType(spec, selectedComboType as any));
spec: updateIngestionType(spec, selectedComboType as any),
});
setTimeout(() => { setTimeout(() => {
this.updateStep('connect'); this.updateStep('connect');
}, 10); }, 10);
@ -746,7 +778,7 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
isOpen isOpen
onCancel={() => this.setState({ showResetConfirm: false })} onCancel={() => this.setState({ showResetConfirm: false })}
onConfirm={() => { onConfirm={() => {
this.setState({ showResetConfirm: false }); this.setState({ showResetConfirm: false, step: 'welcome', continueToSpec: true });
this.updateSpec({} as any); this.updateSpec({} as any);
}} }}
> >