Skip to content

Commit

Permalink
feat(playground): Go to explore modal after schema generation
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltiunov committed Jun 9, 2019
1 parent f039c01 commit 5325c2d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion 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';
Expand Down Expand Up @@ -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',
Expand All @@ -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() });
}
Expand Down Expand Up @@ -227,4 +239,8 @@ class SchemaPage extends Component {
}
}

SchemaPage.propTypes = {
history: PropTypes.object.isRequired
};

export default SchemaPage;

0 comments on commit 5325c2d

Please sign in to comment.