Skip to content

Commit f5ac516

Browse files
authored
feat: Template gallery (#272)
* Template Gallery WIP * Template Gallery WIP: add chart to static dashboard works * Template Gallery WIP: chart libraries work * Template Gallery WIP: fix body.css * Template Gallery WIP: basic flow * Template Gallery WIP: web socket transport * Template Gallery WIP: do not overwrite if versions equals * Template Gallery WIP: revert back simple static dashboard * Template Gallery WIP: revert to modern static dashboard as simple one isn't compatible with different CSS frameworks * Template Gallery WIP: Material UI static dashboard template * Top Menu and Gallery Styling WIP * Redirect without dashbooad app to the gallery * Extract create your own modal * Styles for menu and templates gallery * Recipes Cards css update * Template Gallery WIP: Copy and ensure dependencies fix
1 parent ac97c44 commit f5ac516

File tree

117 files changed

+6383
-887
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+6383
-887
lines changed

packages/cubejs-playground/generateScaffolding.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

packages/cubejs-playground/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,21 @@
3333
"react-chartjs-2": "^2.7.4",
3434
"react-dom": "^16.8.3",
3535
"react-is": "^16.8.4",
36+
"react-responsive": "^8.0.1",
3637
"react-router": "^5.1.2",
3738
"react-router-dom": "^5.1.2",
3839
"react-scripts": "2.1.5",
3940
"react-source-render": "^2.0.0-beta.6",
4041
"recharts": "^1.7.1",
4142
"sql-formatter": "^2.3.2",
43+
"styled-components": "^4.4.1",
4244
"whatwg-fetch": "^3.0.0"
4345
},
4446
"scripts": {
45-
"start": "node generateScaffolding.js && PORT=3080 react-app-rewired start",
46-
"build": "node generateScaffolding.js && react-app-rewired --max-old-space-size=2048 build && rm -Rf ../cubejs-server-core/playground/** && cp -R build/ ../cubejs-server-core/playground/",
47-
"test": "node generateScaffolding.js && react-app-rewired test",
48-
"eject": "node generateScaffolding.js && react-scripts eject"
47+
"start": "PORT=3080 react-app-rewired start",
48+
"build": "react-app-rewired --max-old-space-size=2048 build && rm -Rf ../cubejs-server-core/playground/** && cp -R build/ ../cubejs-server-core/playground/",
49+
"test": "react-app-rewired test",
50+
"eject": "react-scripts eject"
4951
},
5052
"eslintConfig": {
5153
"extends": "react-app"
Lines changed: 15 additions & 15 deletions
Loading

packages/cubejs-playground/src/App.js

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
/* eslint-disable no-undef,react/jsx-no-target-blank */
22
import React, { Component } from 'react';
3-
import { Link } from "react-router-dom";
43
import * as PropTypes from 'prop-types';
54
import "./index.less";
65
import "./index.css";
7-
import {
8-
Layout, Menu, Alert, notification, Icon
9-
} from "antd";
6+
import { Layout, Alert, notification } from "antd";
107
import { fetch } from 'whatwg-fetch';
118
import { withRouter } from "react-router";
9+
import Header from './components/Header';
1210
import { event } from './events';
1311

14-
const { Header, Content } = Layout;
12+
const selectedTab = (pathname) => {
13+
if (pathname === '/template-gallery') {
14+
return ['/dashboard'];
15+
} else {
16+
return [pathname];
17+
}
18+
};
1519

1620
class App extends Component {
1721
async componentDidMount() {
@@ -69,47 +73,16 @@ class App extends Component {
6973
const { location, children } = this.props;
7074
return (
7175
<Layout style={{ height: '100%' }}>
72-
<Header style={{ padding: '0 32px' }}>
73-
<div style={{ float: 'left' }}>
74-
<img src="./cubejs-playground-logo.svg" style={{ display: 'inline', height: 43, marginRight: 15 }} alt="" />
75-
</div>
76-
<Menu
77-
theme="light"
78-
mode="horizontal"
79-
selectedKeys={[location.pathname]}
80-
>
81-
<Menu.Item key="/build"><Link to="/build">Build</Link></Menu.Item>
82-
<Menu.Item key="/dashboard"><Link to="/dashboard">Dashboard App</Link></Menu.Item>
83-
<Menu.Item key="/schema"><Link to="/schema">Schema</Link></Menu.Item>
84-
<Menu.Item
85-
key="docs"
86-
style={{ float: 'right' }}
87-
>
88-
<a href="https://cube.dev/docs" target="_blank">
89-
<Icon type="book" />
90-
Docs
91-
</a>
92-
</Menu.Item>
93-
<Menu.Item
94-
key="slack"
95-
style={{ float: 'right' }}
96-
>
97-
<a href="https://slack.cube.dev" target="_blank">
98-
<Icon type="slack" />
99-
Slack
100-
</a>
101-
</Menu.Item>
102-
</Menu>
103-
</Header>
104-
<Content style={{ height: '100%' }}>
76+
<Header selectedKeys={selectedTab(location.pathname)} />
77+
<Layout.Content style={{ height: '100%' }}>
10578
{fatalError ? (
10679
<Alert
10780
message="Error occured while rendering"
10881
description={fatalError.stack}
10982
type="error"
11083
/>
11184
) : children}
112-
</Content>
85+
</Layout.Content>
11386
</Layout>
11487
);
11588
}

packages/cubejs-playground/src/ChartContainer.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ export const frameworks = [{
1717
id: 'vanilla',
1818
title: 'Vanilla JavaScript',
1919
docsLink: 'https://cube.dev/docs/@cubejs-client-core'
20+
}, {
21+
id: 'react',
22+
title: 'React'
2023
}, {
2124
id: 'angular',
2225
title: 'Angular',
2326
docsLink: 'https://cube.dev/docs/@cubejs-client-ngx'
24-
}, {
25-
id: 'react',
26-
title: 'React'
2727
}, {
2828
id: 'vue',
2929
title: 'Vue.js',

packages/cubejs-playground/src/ChartRenderer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import * as chartjsLibrary from './libraries/chartjs';
1717
import * as tablesLibrary from './libraries/tables';
1818

1919
export const libraryToTemplate = {
20-
bizcharts: { library: bizChartLibrary, title: 'Bizcharts' },
20+
chartjs: { library: chartjsLibrary, title: 'Chart.js' },
2121
recharts: { library: rechartsLibrary, title: 'Recharts' },
22-
chartjs: { library: chartjsLibrary, title: 'Chart.js' }
22+
bizcharts: { library: bizChartLibrary, title: 'Bizcharts' }
2323
};
2424

2525
export const babelConfig = {

0 commit comments

Comments
 (0)