Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2021 Open Version beta #75

Merged
merged 15 commits into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions apps/desktop/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ let win;
function createWindow () {
// 创建浏览器窗口。
win = new BrowserWindow({
width: 800,
height: 600,
width: 1400,
height: 800,
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
// webSecurity: false,
}
})

Expand Down Expand Up @@ -42,6 +43,13 @@ app.on('window-all-closed', () => {
}
})

app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
// On certificate error we disable default behaviour (stop loading the page)
// and we then say "it is all fine - true" to the callback
event.preventDefault();
callback(true);
});

app.on('activate', () => {
// 在macOS上,当单击dock图标并且没有其他窗口打开时,
// 通常在应用程序中重新创建一个窗口。
Expand Down
7 changes: 4 additions & 3 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "desktop",
"version": "0.1.0",
"version": "1.0.0",
"description": "Rath Desktop",
"main": "main.js",
"homepage": "./",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron ."
"start": "electron .",
"pack": "electron-builder --dir",
"dist": "electron-builder"
},
"build": {
"productName": "Kanaries Rath",
Expand Down Expand Up @@ -61,7 +63,6 @@
]
}
]

},
"linux": {
"icon": "icons/icon.ico"
Expand Down
30 changes: 30 additions & 0 deletions packages/connectors/app/controllers/connection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import axios from "axios";
import { Context } from "koa";
import { useGlobalStore } from "../store";
import { sendFailResponse, sendSuccessResponse } from "../utils";

export async function connectionTest(ctx: Context) {
try {
let { user, password } = ctx.request.body || {};
// clickhouse default connection: user=default, password=''
if (user === '' || user === undefined) {
user = 'default'
}
const config = useGlobalStore().getConfig();
const res = await axios(`${config.clickhouse.protocol}://${config.clickhouse.host}:${config.clickhouse.port}`, {
method: 'post',
params: {
user,
password,
query: 'select 1'
}
});
if (res.status === 200) {
sendSuccessResponse(ctx, true)
} else {
throw new Error('connection to clickhouse failed.')
}
} catch (error) {
sendFailResponse(ctx, error);
}
}
8 changes: 8 additions & 0 deletions packages/connectors/app/controllers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Context } from "koa";

export function indexPage (ctx: Context) {
ctx.body = `<div>
<h1>Connectors Service is Running!</h1>
</div>`
ctx.status = 200;
}
6 changes: 0 additions & 6 deletions packages/connectors/app/controllers/ping.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/connectors/app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function start () {
key: serverKey,
cert: serverCert
}, app.callback()).listen(config.port, () => {
console.log(`[server started] running on port: ${config.port}.`)
console.log(`[Connectors Server Started] running on port: ${config.port}.`)
});
} catch (error) {
console.error('应用启动失败', error)
Expand Down
7 changes: 5 additions & 2 deletions packages/connectors/app/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ import {
CHTableDescProxy,
CHTableListProxy
} from './controllers/clickHouseProxy';
import { ping } from './controllers/ping';
import { connectionTest } from './controllers/connection';
import { indexPage } from './controllers/index';
const router = new Router();

router.get('/ping', ping);
router.get('/', indexPage);
router.options('/connect', connectionTest);
router.post('/connect', connectionTest);
router.get('/api/ch/general', CHGeneralProxy);
router.post('/api/ch/general', CHGeneralProxy);

Expand Down
2 changes: 0 additions & 2 deletions packages/connectors/app/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Context } from "koa";
import { createConnection } from "mysql2/promise";
import fs from 'fs/promises';
import path from 'path';
import { IAPP_CONFIG } from "./interfaces";
import { useGlobalStore } from "./store";
import { createHash } from 'crypto';

export async function sendSuccessResponse(ctx: Context, payload: any) {
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
"chroma-js": "^2.0.6",
"cube-core": "^2.13.0",
"datalib": "^1.9.2",
"dayjs": "^1.10.7",
"fuse.js": "^3.4.6",
"immer": "^4.0.1",
"localforage": "^1.10.0",
"mobx": "^6.3.2",
"mobx-react-lite": "^3.2.0",
"mobx-utils": "^6.0.4",
Expand All @@ -50,7 +52,7 @@
"vega": "^5.19.1",
"vega-embed": "^6.15.1",
"vega-lite": "^4.17.0",
"visual-insights": "0.7.2",
"visual-insights": "0.7.5",
"web-vitals": "^0.2.4",
"worker-loader": "^3.0.7",
"yarn": "^1.19.0"
Expand Down
50 changes: 49 additions & 1 deletion packages/frontend/public/locales/en-US.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"common": {
"dimension": "dimension",
"measure": "measure",
"name": "Name"
},
"menu": {
"dataSource": "DataSource",
"noteBook": "NoteBook",
Expand All @@ -24,6 +29,39 @@
"notCompatible": "Not compatible with datasource"
}
},
"function": {
"confirm": "Confirm",
"cancel": "Cancel",
"analysis": {
"start": "Insight Analysis",
"checkResult": "Check Existed Results"
},
"importStorage": {
"title": "Import History Storage",
"desc": "Import a Rath storage file, which was exported from Rath, containing analysis history records in Rath.",
"type": {
"file": "File",
"indexdb": "Local Storage"
},
"storageColumns": {
"name": "Name",
"createTime": "Create Time",
"size": "Size",
"operation": "Operation"
}
},
"exportStorage": {
"title": "Export Rath Storage",
"type": {
"file": "File",
"indexdb": "Index DB"
}
},
"save": {
"title": "Save"
},
"upload": "Upload"
},
"dataSource": {
"extractInsight": "Insight Analysis",
"extractInsightOld": "Insight Analysis(Debug)",
Expand Down Expand Up @@ -154,6 +192,16 @@
"T2": "Associated Dimensions",
"hint": "Associated Measures refers to keep the dimensions similar, find correlated measures. Associated Dimensions refers to keep the measures similar, find correlated dimensions."
},
"bring": "Customize Analysis"
"bring": "Customize Analysis",
"commandBar": {
"editing": "editing chart",
"associate": "associate views",
"constraints": "analysis constraints"
},
"constraints": {
"exclude": "exclude field",
"auto": "include if exists insights",
"include": "force include"
}
}
}
50 changes: 49 additions & 1 deletion packages/frontend/public/locales/zh-CN.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"common": {
"dimension": "维度",
"measure": "度量",
"name": "名称"
},
"menu": {
"dataSource": "数据源",
"noteBook": "工作簿",
Expand All @@ -24,6 +29,39 @@
"notCompatible": "与数据源暂不兼容"
}
},
"function": {
"confirm": "确认",
"cancel": "取消",
"analysis": {
"start": "开始分析",
"checkResult": "查看已有结果"
},
"importStorage": {
"title": "导入历史分析",
"desc": "导入一个Rath的分析结果文件,这个文件是曾经从Rath中导出分析记录文件。",
"type": {
"file": "文件",
"indexdb": "本地存储"
},
"storageColumns": {
"name": "名称",
"createTime": "创建时间",
"size": "大小",
"operation": "操作"
}
},
"exportStorage": {
"title": "导出分析文件",
"type": {
"file": "文件",
"indexdb": "Index DB"
}
},
"save": {
"title": "保存"
},
"upload": "上传文件"
},
"dataSource": {
"extractInsight": "开始分析",
"extractInsightOld": "开始分析(调试模式)",
Expand Down Expand Up @@ -154,6 +192,16 @@
"T2": "关联维度",
"hint": "『关联度量』是指探索和当前图表中,度量/指标关联程度更高的图表,这可以帮你研究哪些指标的表现和当前关注的指标相近。『关联维度』是指探索和当前图表中,维度相关度更高的图表,这可以帮助你研究对于当前的度量下,相似维度对度量分布的划分差异。"
},
"bring": "自定义分析"
"bring": "自定义分析",
"commandBar": {
"editing": "编辑图表",
"associate": "联想",
"constraints": "分析约束"
},
"constraints": {
"exclude": "排除字段",
"auto": "机器判断(有洞察则包含)",
"include": "强制包含"
}
}
}
6 changes: 5 additions & 1 deletion packages/frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
cursor: pointer;
}
.content-container{
padding: 28px 9% 0px 9%;
padding: 1em 9% 0px 9%;
}
.header-bar{
position: relative;
Expand Down Expand Up @@ -109,4 +109,8 @@ h2, h3 {
.header-toolbar{
float: right;
padding: 0.5rem;
}

.message-container {
padding: 1em 4em 0em 4em;
}
6 changes: 5 additions & 1 deletion packages/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import DevPage from './pages/dev';
import SupportPage from './pages/support/index';
import LTSPage from './pages/lts';
import UserSettings from './components/userSettings';
import MessageSegment from "./components/messageSegment";
import { observer } from "mobx-react-lite";
import { useEffect } from "react";
import { destroyRathWorker, initRathWorker } from "./service";
Expand Down Expand Up @@ -71,7 +72,7 @@ function App() {
>
<img
style={{ width: '38px', marginTop: '4px' }}
src="/assets/kanaries-lite.png"
src="./assets/kanaries-lite.png"
alt="rath"
/>
</a>
Expand All @@ -98,6 +99,9 @@ function App() {
</div>
</div>
</div>
<div className="message-container">
<MessageSegment />
</div>
{appKey === PIVOT_KEYS.gallery && (
<Gallery />
)}
Expand Down