| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- import React, {Component} from 'react';
- import {Layout, Menu} from 'antd';
- import GenerateJs from "../common/generateJs/GenerateJs";
- import Deploy from '../common/deploy/Deploy';
- import Schema from '../common/schema/Schema';
- import Graphql from "../common/graphql/Graphql";
- import CaseMetabase from "../common/caseMetabase/CaseMetabase";
- import Application from "../common/application/Application";
- import axios from 'axios';
- axios.defaults.withCredentials = true;
- const {Content} = Layout;
- class TrialCase extends Component {
- constructor(props) {
- super(props);
- this.state = {
- menuLevel2: "schema",
- // default user
- userID: "ioobot",
- }
- }
- switchMenu = (menuName, e) => {
- this.setState({
- [menuName]: e.key,
- });
- };
- render() {
- let schemaID = this.props.history.location.state ? this.props.history.location.state.schemaID : "schema_1542243424669_92094965";
- let schemaName = this.props.history.location.state ? this.props.history.location.state.schemaName : "ecommerce";
- return (
- <div>
- <Menu
- mode="horizontal"
- defaultSelectedKeys={['schema']}
- style={{padding: '0 24px', position: 'fixed', width: '100%', zIndex: '1',lineHeight:'50px',fontWeight:600}}
- onClick={(e) => this.switchMenu('menuLevel2', e)}
- selectedKeys={[this.state.menuLevel2]}
- >
- <Menu.Item key="schema">schema</Menu.Item>
- <Menu.Item key="application">application</Menu.Item>
- <Menu.Item key="deploy">deploy</Menu.Item>
- <Menu.Item key="graphql">graphql</Menu.Item>
- <Menu.Item key="graphiql">graphql IDE</Menu.Item>
- <Menu.Item key="metabase">metabase</Menu.Item>
- </Menu>
- <Layout style={{padding: '24px', zIndex: '0'}}>
- <Content style={{padding: '24px', minHeight: 280, background: '#fff', marginTop: '48px'}}>
- {
- (() => {
- switch (this.state.menuLevel2) {
- case 'schema':
- return <Schema trialcase={true} userID={this.state.userID} schemaName={schemaName} schemaID={schemaID} history={this.props.history} location={this.props.location}/>;
- case 'application':
- return <Application location={this.props.location}/>;
- case 'deploy':
- return <Deploy userID={this.state.userID} schemaID={schemaID} schemaName={schemaName}/>;
- case 'graphql':
- return <GenerateJs schemaID={schemaID}/>;
- case 'graphiql':
- return <Graphql/>;
- case 'metabase':
- return <CaseMetabase/>;
- default:
- return <Graphql/>
- }
- })()
- }
- </Content>
- </Layout>
- </div>
- )
- }
- }
- export default TrialCase;
|