Skip to content

Commit 10d9264

Browse files
authored
[SL-3] Cosmetic fixes in OSS UI (#6404)
1 parent 6a99897 commit 10d9264

File tree

4 files changed

+98
-42
lines changed

4 files changed

+98
-42
lines changed

packages/cubejs-playground/src/components/CopiableInput.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ const IconButton: typeof Button = styled(Button)`
1111

1212
type CopiableInputProps = {
1313
label?: string;
14+
wrapperStyle?: object;
1415
onCopyClick?: (value: string) => void;
1516
} & InputProps;
1617

1718
export function CopiableInput({
1819
label,
1920
value,
2021
onCopyClick,
22+
wrapperStyle,
2123
...props
2224
}: CopiableInputProps) {
2325
const suffix = (
@@ -41,6 +43,7 @@ export function CopiableInput({
4143
label={label ? <b>{label}</b> : null}
4244
labelCol={{ span: 24 }}
4345
wrapperCol={{ span: 24 }}
46+
style={wrapperStyle}
4447
>
4548
<Input
4649
data-testid={`localhost-tipbox-${label?.toLowerCase()}-input`}

packages/cubejs-playground/src/pages/ConnectToBI/ConnectToBiPage.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import hightouchSvg from '../../img/bi/hightouch.svg';
2020
import thoughtSpot from '../../img/bi/thoughtspot.svg';
2121
import { Content, Header } from '../components/Ui';
2222

23+
const { Paragraph, Link } = Typography;
24+
2325
const SpaceFlex = styled(Space)`
2426
div.ant-space {
2527
display: flex;
@@ -36,21 +38,21 @@ type CubeSqlCredentials = {
3638

3739
const BI_KEYS = {
3840
Generic: 'BIs and Visualization Tools',
39-
Tableau: 'Tableau',
40-
PowerBI: 'Power BI',
4141
Superset: 'Apache Superset',
4242
Metabase: 'Metabase',
43+
Tableau: 'Tableau',
44+
ThoughtSpot: 'ThoughtSpot',
45+
PowerBI: 'Power BI',
4346
Hex: 'Hex',
4447
Jupyter: 'Jupyter notebook',
4548
Streamlit: 'Streamlit',
49+
Observable: 'Observable',
4650
// Not listed on the integration page:
4751
Deepnote: 'Deepnote',
4852
Excel: 'Excel',
4953
GoogleStudio: 'Google Data Studio',
5054
GoogleSheets: 'Google Sheets',
5155
Hightouch: 'Hightouch',
52-
Observable: 'Observable',
53-
ThoughtSpot: 'ThoughtSpot',
5456
} as const;
5557

5658
type BiKeyNames = keyof typeof BI_KEYS;
@@ -290,11 +292,6 @@ type BIFields = {
290292
const BI_FIELDS: BIFields = {
291293
Generic: [
292294
POSTGRESQL_FIELD,
293-
{
294-
type: 'alert',
295-
value:
296-
'Warning: some BI tools are not fully supported yet and you may encounter problems when querying',
297-
},
298295
PG_SNIPPET_FIELD,
299296
...BASE_CREDENTIALS,
300297
],
@@ -532,6 +529,11 @@ export function ConnectToBiPage() {
532529
</Header>
533530

534531
<Content>
532+
<Paragraph>
533+
With Cube SQL API you can query Cube via Postgres-compatible SQL.
534+
It enables the use of BI applications and other visualization tools on top of Cube. <br />
535+
<Link href="https://cube.dev/docs/config/downstream" target="_blank">Learn more about SQL API and connecting to BI tools in Cube docs ↗ </Link>
536+
</Paragraph>
535537
<Tabs defaultActiveKey="1" tabPosition="left" size="small">
536538
{Object.entries(BI_KEYS).map(([key, title]) => (
537539
<Tabs.TabPane

packages/cubejs-playground/src/pages/FrontendIntegrations/FrontendIntegrationsPage.tsx

Lines changed: 74 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,57 @@
1-
import { Card, Layout, Space, Tabs, Typography } from 'antd';
1+
import { Card, Layout, Space, Tabs, Typography, Table, Col, Row } from 'antd';
22
import { CodeSnippet } from '../../atoms';
33
import { Content, Header } from '../components/Ui';
4+
import { CopiableInput } from '../../components/CopiableInput';
45

56
const { Paragraph, Link, Title } = Typography;
67

78
export function FrontendIntegrationsPage() {
89
const token = 'token';
910
const apiUrl = 'http://localhost:4000/cubejs-api';
11+
const restUrl = `${apiUrl}/v1/load`;
12+
const wsUrl = "ws://localhost:4000/";
13+
const graphqlUrl = `${apiUrl}/v1/graphql`;
14+
15+
const dataSource = [
16+
{
17+
key: '1',
18+
name: 'REST API Endpoint',
19+
url: restUrl,
20+
docsUrl: 'https://cube.dev/docs/rest-api',
21+
},
22+
{
23+
key: '2',
24+
name: 'Websockets Endpoint',
25+
url: wsUrl,
26+
docsUrl: 'https://cube.dev/docs/real-time-data-fetch',
27+
},
28+
{
29+
key: '2',
30+
name: 'GraphQL Endpoint',
31+
url: graphqlUrl,
32+
docsUrl: 'https://cube.dev/docs/backend/graphql',
33+
},
34+
];
35+
36+
const columns = [
37+
{
38+
title: 'Name',
39+
dataIndex: 'name',
40+
key: 'name',
41+
},
42+
{
43+
title: 'URL',
44+
dataIndex: 'url',
45+
key: 'url',
46+
render: (text) => <CopiableInput wrapperStyle={{ margin: 0 }} value={text} />
47+
},
48+
{
49+
title: 'Docs',
50+
dataIndex: 'docsUrl',
51+
key: 'docsUrl',
52+
render: (text) => <a href={text} target="_blank">Docs</a>
53+
}
54+
];
1055

1156
return (
1257
<Layout>
@@ -15,27 +60,32 @@ export function FrontendIntegrationsPage() {
1560
</Header>
1661

1762
<Content>
18-
<Space direction="vertical" size="large">
19-
<Paragraph>
20-
Learn more about{' '}
21-
<Link href="https://cube.dev/docs/rest-api" target="_blank">
22-
REST
23-
</Link>
24-
,{' '}
25-
<Link href="https://cube.dev/docs/backend/graphql" target="_blank">
26-
GraphQL
27-
</Link>{' '}
28-
APIs and{' '}
29-
<Link
30-
href="https://cube.dev/docs/frontend-introduction"
31-
target="_blank"
32-
>
33-
integration with frontend frameworks
34-
</Link>
35-
.
36-
</Paragraph>
37-
38-
<Tabs defaultActiveKey="1" size="small">
63+
<Row gutter={48}>
64+
<Col span={12}>
65+
<Paragraph>
66+
You can refer to Cube docs to learn more about{' '}
67+
<Link href="https://cube.dev/docs/rest-api" target="_blank">
68+
REST
69+
</Link>
70+
,{' '}
71+
<Link href="https://cube.dev/docs/backend/graphql" target="_blank">
72+
GraphQL
73+
</Link>{' '}
74+
APIs and{' '}
75+
<Link
76+
href="https://cube.dev/docs/frontend-introduction"
77+
target="_blank"
78+
>
79+
integration with frontend frameworks
80+
</Link>
81+
.
82+
</Paragraph>
83+
<Paragraph>
84+
<Table dataSource={dataSource} columns={columns} pagination={false} showHeader={false} />
85+
</Paragraph>
86+
</Col>
87+
<Col span={12}>
88+
<Tabs defaultActiveKey="1" size="small">
3989
<Tabs.TabPane key="terminal" tab="Terminal">
4090
<Space direction="vertical" size="large">
4191
<Card>
@@ -194,7 +244,8 @@ const cubeApi = cube(
194244
</Space>
195245
</Tabs.TabPane>
196246
</Tabs>
197-
</Space>
247+
</Col>
248+
</Row>
198249
</Content>
199250
</Layout>
200251
);

packages/cubejs-playground/src/pages/Schema/SchemaPage.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export class SchemaPage extends Component<SchemaPageProps, any> {
9999
const result = await res.json();
100100
this.setState({
101101
files: result.files,
102+
activeTab: (result.files && result.files.length > 0) ? "files" : "schema"
102103
});
103104
}
104105

@@ -128,8 +129,8 @@ export class SchemaPage extends Component<SchemaPageProps, any> {
128129
await this.loadFiles();
129130
this.setState({ checkedKeys: [], activeTab: 'files' });
130131
Modal.success({
131-
title: 'Schema files successfully generated!',
132-
content: 'You can start building the charts',
132+
title: 'Data model files successfully generated!',
133+
content: 'You can start exploring your data model and building the charts',
133134
okText: 'Build',
134135
cancelText: 'Close',
135136
okCancel: true,
@@ -254,10 +255,6 @@ export class SchemaPage extends Component<SchemaPageProps, any> {
254255
data-testid="chart-type-btn"
255256
overlay={
256257
<Menu data-testid="generate-schema">
257-
<Menu.Item onClick={() => this.generateSchema()}>
258-
JavaScript
259-
</Menu.Item>
260-
261258
<Menu.Item
262259
title={
263260
!isYamlFormatSupported
@@ -269,11 +266,14 @@ export class SchemaPage extends Component<SchemaPageProps, any> {
269266
>
270267
YAML
271268
</Menu.Item>
269+
<Menu.Item onClick={() => this.generateSchema()}>
270+
JavaScript
271+
</Menu.Item>
272272
</Menu>
273273
}
274274
style={{ border: 0 }}
275275
>
276-
Generate Schema
276+
Generate Data Model
277277
</ButtonDropdown>
278278
}
279279
>
@@ -298,13 +298,13 @@ export class SchemaPage extends Component<SchemaPageProps, any> {
298298
message={
299299
isDocker ? (
300300
<span>
301-
Schema files are located and can be edited in the mount
301+
Data model files are located and can be edited in the mount
302302
volume directory.{' '}
303303
<Typography.Link
304304
href="https://cube.dev/docs/schema/getting-started"
305305
target="_blank"
306306
>
307-
Learn more about working with Cube data schema in the docs
307+
Learn more about working with Cube data model in the docs
308308
</Typography.Link>
309309
</span>
310310
) : (
@@ -329,7 +329,7 @@ export class SchemaPage extends Component<SchemaPageProps, any> {
329329
) : (
330330
<Empty
331331
style={{ marginTop: 50 }}
332-
description="Select tables to generate Cube schema"
332+
description="Select tables to generate Cube data model"
333333
/>
334334
)}
335335

0 commit comments

Comments
 (0)