From 5325c2df9540aa25ebfd451a4b66f1aec49af32c Mon Sep 17 00:00:00 2001 From: Pavel Tiunov Date: Sun, 9 Jun 2019 16:48:50 -0700 Subject: [PATCH] feat(playground): Go to explore modal after schema generation --- packages/cubejs-playground/src/SchemaPage.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/cubejs-playground/src/SchemaPage.js b/packages/cubejs-playground/src/SchemaPage.js index 7aa41fb233539..fab5622f50d14 100644 --- a/packages/cubejs-playground/src/SchemaPage.js +++ b/packages/cubejs-playground/src/SchemaPage.js @@ -1,7 +1,8 @@ import React, { Component } from 'react'; +import * as PropTypes from 'prop-types'; import cubejs from '@cubejs-client/core'; import { - Layout, Menu, Button, Tree, Tabs, Dropdown, Spin, Alert + Layout, Menu, Button, Tree, Tabs, Dropdown, Spin, Alert, Modal } from 'antd'; import PrismCode from './PrismCode'; import { playgroundAction } from './events'; @@ -95,6 +96,7 @@ class SchemaPage extends Component { async generateSchema() { const { checkedKeys } = this.state; + const { history } = this.props; playgroundAction('Generate Schema'); const res = await fetch('/playground/generate-schema', { method: 'POST', @@ -107,6 +109,16 @@ class SchemaPage extends Component { playgroundAction('Generate Schema Success'); await this.loadFiles(); this.setState({ checkedKeys: [], activeTab: 'files' }); + Modal.success({ + title: 'Schema files successfully generated!', + content: 'You can start building the charts', + okText: 'Explore', + cancelText: 'Close', + okCancel: true, + onOk() { + history.push('/explore'); + } + }); } else { playgroundAction('Generate Schema Fail', { error: await res.text() }); } @@ -227,4 +239,8 @@ class SchemaPage extends Component { } } +SchemaPage.propTypes = { + history: PropTypes.object.isRequired +}; + export default SchemaPage;