Skip to content

Commit 3556a74

Browse files
authored
fix: appying templates in a git repo (#952)
1 parent f20d9ec commit 3556a74

File tree

6 files changed

+26
-58
lines changed

6 files changed

+26
-58
lines changed

packages/cubejs-playground/src/SchemaPage.js

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React, { Component } from 'react';
22
import * as PropTypes from 'prop-types';
33
import cubejs from '@cubejs-client/core';
4-
import { PlusOutlined } from '@ant-design/icons';
54
import {
6-
Layout, Menu, Button, Tree, Tabs, Dropdown, Spin, Alert, Modal, Empty
5+
Layout, Menu, Button, Tree, Tabs, Spin, Alert, Modal, Empty
76
} from 'antd';
87
import PrismCode from './PrismCode';
98
import { playgroundAction } from './events';
@@ -173,14 +172,6 @@ class SchemaPage extends Component {
173172
return <TreeNode {...item} />;
174173
});
175174

176-
const menu = (
177-
<Menu>
178-
<Menu.Item onClick={() => this.generateSchema()}>
179-
Generate Schema
180-
</Menu.Item>
181-
</Menu>
182-
);
183-
184175
const renderTree = () => (Object.keys(tablesSchema || {}).length > 0 ? (
185176
<Tree
186177
checkable
@@ -214,24 +205,20 @@ class SchemaPage extends Component {
214205
<Layout style={{ height: '100%' }}>
215206
<Sider
216207
width={300}
217-
style={{
218-
background: '#fff',
219-
borderRight: '1px solid #eee',
220-
}}
221208
className="schema-sidebar"
222209
>
223210
<Tabs
224211
activeKey={activeTab}
225212
onChange={(tab) => this.setState({ activeTab: tab })}
226213
tabBarExtraContent={(
227-
<Dropdown overlay={menu} placement="bottomRight" disabled={!checkedKeys.length}>
228-
<Button
229-
shape="circle"
230-
icon={<PlusOutlined />}
231-
type="primary"
232-
/>
233-
</Dropdown>
234-
)}
214+
<Button
215+
disabled={!checkedKeys.length}
216+
type="primary"
217+
onClick={() => this.generateSchema()}
218+
>
219+
Generate Schema
220+
</Button>
221+
)}
235222
>
236223
<TabPane tab="Tables" key="schema">
237224
{schemaLoading ? <Spin style={{ width: '100%' }}/> : renderTreeOrError()}

packages/cubejs-playground/src/index.css

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,29 @@ body {
33
padding: 0;
44
-webkit-font-smoothing: antialiased;
55
-moz-osx-font-smoothing: grayscale;
6-
background: #F8F8FB;
6+
background: #f8f8fb;
77
}
88

99
code {
10-
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
11-
monospace;
10+
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
1211
}
1312

1413
#root {
1514
height: 100%;
1615
}
1716

18-
.schema-sidebar, .schema-sidebar .ant-tabs, .schema-sidebar .ant-tabs-content {
17+
.schema-sidebar,
18+
.schema-sidebar .ant-tabs,
19+
.schema-sidebar .ant-tabs-content {
1920
height: 100%;
2021
}
2122

23+
.schema-sidebar {
24+
background: #fff;
25+
border-right: 1px solid #eee;
26+
padding: 0 12px;
27+
}
28+
2229
.schema-sidebar .ant-tabs-tabpane {
2330
/* TODO: replace with flexbox */
2431
height: 85%;
@@ -27,4 +34,4 @@ code {
2734

2835
.ant-popover-disabled-compatible-wrapper {
2936
pointer-events: none;
30-
}
37+
}

packages/cubejs-server-core/dev/PackageFetcher.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const fs = require('fs-extra');
2-
const axios = require('axios').default;
2+
const fetch = require('node-fetch').default;
33
const decompress = require('decompress');
44
const decompressTargz = require('decompress-targz');
55
const path = require('path');
@@ -26,22 +26,18 @@ class PackageFetcher {
2626
}
2727

2828
async manifestJSON() {
29-
const response = await axios.get(
29+
const response = await fetch(
3030
`https://api.github.com/repos/${this.repo.owner}/${this.repo.name}/contents/manifest.json`
3131
);
3232

33-
return JSON.parse(Buffer.from(response.data.content, 'base64').toString());
33+
return JSON.parse(Buffer.from((await response.json()).content, 'base64').toString());
3434
}
3535

3636
async downloadRepo() {
3737
const url = `https://github.com/${this.repo.owner}/${this.repo.name}/archive/master.tar.gz`;
3838
const writer = fs.createWriteStream(this.repoArchivePath);
3939

40-
const response = await axios.get(url, {
41-
responseType: 'stream',
42-
});
43-
44-
response.data.pipe(writer);
40+
(await fetch(url)).body.pipe(writer);
4541

4642
return new Promise((resolve, reject) => {
4743
writer.on('finish', resolve);

packages/cubejs-server-core/dev/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async function fileContentsRecursive(dir, rootPath, includeNodeModules) {
99
if (!(await fs.pathExists(dir))) {
1010
return [];
1111
}
12-
if (dir.indexOf('node_modules') !== -1 && !includeNodeModules) {
12+
if ((dir.includes('node_modules') && !includeNodeModules) || dir.includes('.git')) {
1313
return [];
1414
}
1515

packages/cubejs-server-core/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"@cubejs-backend/api-gateway": "^0.19.54",
2626
"@cubejs-backend/query-orchestrator": "^0.19.56",
2727
"@cubejs-backend/schema-compiler": "^0.19.57",
28-
"axios": "^0.19.2",
2928
"codesandbox-import-utils": "^2.1.12",
3029
"cross-spawn": "^7.0.1",
3130
"decompress": "^4.2.1",

packages/cubejs-server-core/yarn.lock

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,13 +1406,6 @@ aws4@^1.8.0:
14061406
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f"
14071407
integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==
14081408

1409-
axios@^0.19.2:
1410-
version "0.19.2"
1411-
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27"
1412-
integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==
1413-
dependencies:
1414-
follow-redirects "1.5.10"
1415-
14161409
babel-jest@^24.9.0:
14171410
version "24.9.0"
14181411
resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.9.0.tgz#3fc327cb8467b89d14d7bc70e315104a783ccd54"
@@ -1938,13 +1931,6 @@ debug@3.2.6, debug@^3.2.6:
19381931
dependencies:
19391932
ms "^2.1.1"
19401933

1941-
debug@=3.1.0:
1942-
version "3.1.0"
1943-
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
1944-
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
1945-
dependencies:
1946-
ms "2.0.0"
1947-
19481934
debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:
19491935
version "4.1.1"
19501936
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791"
@@ -2732,13 +2718,6 @@ flatted@^2.0.0:
27322718
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08"
27332719
integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==
27342720

2735-
follow-redirects@1.5.10:
2736-
version "1.5.10"
2737-
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a"
2738-
integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==
2739-
dependencies:
2740-
debug "=3.1.0"
2741-
27422721
for-in@^1.0.2:
27432722
version "1.0.2"
27442723
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"

0 commit comments

Comments
 (0)