Skip to content

Commit

Permalink
feat: use new dsl_parser
Browse files Browse the repository at this point in the history
  • Loading branch information
longxiaofei committed Sep 12, 2023
1 parent ba197ec commit 6c3d479
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 656 deletions.
30 changes: 1 addition & 29 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,8 @@ jobs:
name: pygwalker-app
path: ./pygwalker/templates/dist/*

build-go-wasm:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Try Build Wasm
working-directory: ./
run: |
chmod u+x ./scripts/gen_dsl_to_sql_wasm.sh
./scripts/gen_dsl_to_sql_wasm.sh
- name: Uploading wasm
uses: actions/upload-artifact@v3
with:
name: pygwalker-wasm
path: ./pygwalker/templates/dsl_to_sql.wasm

build-py:
needs: [build-js, build-go-wasm]
needs: [build-js]

strategy:
fail-fast: false
Expand All @@ -75,11 +52,6 @@ jobs:
with:
name: pygwalker-app
path: ./pygwalker/templates/dist
- name: Download PyGWalkerWasm
uses: actions/download-artifact@v3
with:
name: pygwalker-wasm
path: ./pygwalker/templates/
- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,5 @@ poetry.lock

pygwalker/templates/graphic-walker.umd.js
pygwalker/templates/graphic-walker.iife.js
pygwalker/templates/dsl_to_sql.wasm

tests/*.csv
5 changes: 3 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"dependencies": {
"@headlessui/react": "^1.7.14",
"@heroicons/react": "^2.0.8",
"@kanaries-temp/gw-dsl-parser": "0.1.0",
"@kanaries/auth-wrapper": "file:./lib/auth-wrapper-v0.1.4.tgz",
"@kanaries/graphic-walker": "0.4.3",
"autoprefixer": "^10.3.5",
"buffer": "^6.0.3",
"html-to-image": "^1.11.11",
"mobx": "^6.9.0",
"mobx-react-lite": "^3.4.3",
"pako": "^2.1.0",
"postcss": "^8.3.7",
"react": "^17.x",
"react-dom": "^17.x",
Expand All @@ -42,7 +42,8 @@
"@types/styled-components": "^5.1.26",
"@vitejs/plugin-react": "^3.1.x",
"typescript": "^4.9.5",
"vite": "^4.1.4"
"vite": "^4.1.4",
"vite-plugin-wasm": "^3.2.2"
},
"peerDependencies": {},
"prettier": {
Expand Down
11 changes: 3 additions & 8 deletions app/src/dataSource/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ import type { IDataSourceProps } from "../interfaces";
import type { IRow, IDataQueryPayload } from "@kanaries/graphic-walker/dist/interfaces";
import commonStore from "../store/common";
import communicationStore from "../store/communication"
import { parser_dsl_with_table } from "@kanaries-temp/gw-dsl-parser";

declare global {
export interface Window {
dslToSql: (datasetStr: string, PayloadStr: string) => string;
}
}

interface MessagePayload extends IDataSourceProps {
action: "requestData" | "postData" | "finishData";
dataSourceId: string;
Expand Down Expand Up @@ -84,8 +79,8 @@ export function finishDataService(msg: any) {
}

export async function getDatasFromKernel(payload: IDataQueryPayload) {
const sql = window.dslToSql(
JSON.stringify({type: "table", source: "pygwalker_mid_table"}),
const sql = parser_dsl_with_table(
"pygwalker_mid_table",
JSON.stringify(payload)
);
const result = await communicationStore.comm?.sendMsg("get_datas", {"sql": sql});
Expand Down
6 changes: 3 additions & 3 deletions app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import InitModal from './components/initModal';
import { getSaveTool, hidePreview } from './tools/saveTool';
import { getExportTool } from './tools/exportTool';
import { getShareTool } from './tools/shareTool';
import { formatExportedChartDatas } from "./utils/save"
import { initDslToSql } from "./utils/initDslWasm"
import { formatExportedChartDatas } from "./utils/save";
import initDslParser from "@kanaries-temp/gw-dsl-parser";

// @ts-ignore
import style from './index.css?inline'
Expand Down Expand Up @@ -154,7 +154,7 @@ const initOnJupyter = async(props: IAppProps) => {
comm.sendMsgAsync("request_data", {}, null);
}
if (props.useKernelCalc) {
await initDslToSql(props.dslToSqlWasmContent);
await initDslParser();
}
hidePreview(props.id);
}
Expand Down
1 change: 0 additions & 1 deletion app/src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export interface IAppProps extends IGWProps {
showCloudTool: boolean;
needInitChart: boolean;
useKernelCalc: boolean;
dslToSqlWasmContent: string;
}

export interface IDataSourceProps {
Expand Down
20 changes: 0 additions & 20 deletions app/src/utils/initDslWasm.ts

This file was deleted.

Loading

0 comments on commit 6c3d479

Please sign in to comment.