-
Notifications
You must be signed in to change notification settings - Fork 72
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
build(log-viewer-webui-client): Switch from Webpack to Vite for bundling; Convert the codebase to TypeScript. #645
base: main
Are you sure you want to change the base?
Changes from 1 commit
bb3f508
ad34028
3444981
8b03576
4976d95
ff5da99
7ac39ee
d0c1443
a7998e1
d6a224b
2c6e393
b222fc6
c3b26e2
0a3de9e
a85679c
ca86be9
2767de1
c345e00
8a29872
e434b64
1116797
05a51e4
580b215
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,7 +2,7 @@ | |||||||||
"name": "log-viewer-webui-client", | ||||||||||
"version": "0.1.0", | ||||||||||
"description": "", | ||||||||||
"main": "src/index.jsx", | ||||||||||
"main": "src/index.tsx", | ||||||||||
"scripts": { | ||||||||||
"build": "webpack --define-process-env-node-env production", | ||||||||||
junhaoliao marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
"lint:check": "npx eslint --no-eslintrc --config package.json src webpack.config.js", | ||||||||||
|
@@ -13,33 +13,76 @@ | |||||||||
"license": "Apache-2.0", | ||||||||||
"type": "module", | ||||||||||
"devDependencies": { | ||||||||||
"@babel/core": "^7.24.7", | ||||||||||
"@babel/preset-env": "^7.24.7", | ||||||||||
"@babel/preset-react": "^7.24.7", | ||||||||||
"@babel/core": "^7.26.0", | ||||||||||
"@babel/preset-env": "^7.26.0", | ||||||||||
"@babel/preset-react": "^7.26.3", | ||||||||||
"@babel/preset-typescript": "^7.26.0", | ||||||||||
"@types/react": "^19.0.2", | ||||||||||
"@types/react-dom": "^19.0.2", | ||||||||||
"@typescript-eslint/eslint-plugin": "^8.18.2", | ||||||||||
"@typescript-eslint/parser": "^8.18.2", | ||||||||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15", | ||||||||||
"babel-loader": "^9.1.3", | ||||||||||
"babel-loader": "^9.2.1", | ||||||||||
"css-loader": "^7.1.2", | ||||||||||
"eslint-config-yscope": "latest", | ||||||||||
"html-webpack-plugin": "^5.6.0", | ||||||||||
"mini-css-extract-plugin": "^2.9.0", | ||||||||||
"react-refresh": "^0.14.2", | ||||||||||
"eslint-import-resolver-typescript": "^3.7.0", | ||||||||||
"html-webpack-plugin": "^5.6.3", | ||||||||||
"mini-css-extract-plugin": "^2.9.2", | ||||||||||
"react-refresh": "^0.16.0", | ||||||||||
"style-loader": "^4.0.0", | ||||||||||
"webpack": "^5.95.0", | ||||||||||
"webpack-cli": "^5.1.4", | ||||||||||
"webpack-dev-server": "^5.1.0" | ||||||||||
"webpack": "^5.97.1", | ||||||||||
"webpack-cli": "^6.0.1", | ||||||||||
"webpack-dev-server": "^5.2.0" | ||||||||||
}, | ||||||||||
"dependencies": { | ||||||||||
"@emotion/react": "^11.14.0", | ||||||||||
"@emotion/styled": "^11.14.0", | ||||||||||
"@mui/joy": "^5.0.0-beta.51", | ||||||||||
"axios": "^1.7.9", | ||||||||||
"react": "^19.0.0", | ||||||||||
"react-dom": "^19.0.0" | ||||||||||
Comment on lines
+21
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix React version to use the latest stable release The specified React version Apply this diff to fix the versions: - "react": "^19.0.0",
- "react-dom": "^19.0.0"
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0" 📝 Committable suggestion
Suggested change
|
||||||||||
}, | ||||||||||
"eslintConfig": { | ||||||||||
"root": true, | ||||||||||
"extends": [ | ||||||||||
"yscope/react" | ||||||||||
] | ||||||||||
}, | ||||||||||
"dependencies": { | ||||||||||
"@emotion/react": "^11.13.0", | ||||||||||
"@emotion/styled": "^11.13.0", | ||||||||||
"@mui/joy": "^5.0.0-beta.48", | ||||||||||
"@types/react": "^18.3.3", | ||||||||||
"axios": "^1.7.2", | ||||||||||
"react": "^18.3.1", | ||||||||||
"react-dom": "^18.3.1" | ||||||||||
], | ||||||||||
"ignorePatterns": [ | ||||||||||
"dist/", | ||||||||||
"node_modules/" | ||||||||||
], | ||||||||||
"overrides": [ | ||||||||||
{ | ||||||||||
"files": [ | ||||||||||
"*.ts", | ||||||||||
"*.tsx" | ||||||||||
], | ||||||||||
"extends": [ | ||||||||||
"yscope/typescript" | ||||||||||
] | ||||||||||
} | ||||||||||
], | ||||||||||
"rules": { | ||||||||||
"no-restricted-imports": [ | ||||||||||
"error", | ||||||||||
{ | ||||||||||
"paths": [ | ||||||||||
{ | ||||||||||
"message": "Please use path imports and name your imports with postfix \"Icon\" to avoid confusions.", | ||||||||||
"name": "@mui/icons-material" | ||||||||||
} | ||||||||||
], | ||||||||||
"patterns": [ | ||||||||||
{ | ||||||||||
"group": [ | ||||||||||
"@mui/joy/*", | ||||||||||
"!@mui/joy/styles" | ||||||||||
], | ||||||||||
"message": "Please use the default import from \"@mui/joy\" instead." | ||||||||||
} | ||||||||||
] | ||||||||||
} | ||||||||||
] | ||||||||||
} | ||||||||||
} | ||||||||||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import axios, { | ||
AxiosProgressEvent, | ||
AxiosResponse, | ||
} from "axios"; | ||
|
||
import {QUERY_JOB_TYPE} from "../typings/query"; | ||
|
||
|
||
interface ExtractStreamResp { | ||
_id: string, | ||
begin_msg_ix: number, | ||
end_msg_ix: number, | ||
is_last_chunk: boolean, | ||
path: string, | ||
stream_id: string, | ||
} | ||
|
||
|
||
/** | ||
* Submits a job to extract the stream that contains a given log event. The stream is extracted | ||
* either as a CLP IR or a JSON Lines file. | ||
* | ||
* @param extractJobType | ||
* @param streamId | ||
* @param logEventIdx | ||
* @param onUploadProgress Callback to handle upload progress events. | ||
* @return The API response. | ||
*/ | ||
const submitExtractStreamJob = async ( | ||
extractJobType: QUERY_JOB_TYPE, | ||
streamId: string, | ||
logEventIdx: number, | ||
onUploadProgress: (progressEvent: AxiosProgressEvent) => void, | ||
): Promise<AxiosResponse<ExtractStreamResp>> => { | ||
return await axios.post( | ||
"/query/extract-stream", | ||
{ | ||
extractJobType, | ||
streamId, | ||
logEventIdx, | ||
}, | ||
{onUploadProgress} | ||
); | ||
}; | ||
|
||
export {submitExtractStreamJob}; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe rename this file config.ts like log viewer. The caps are a bit out of place. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type Nullable<T> = T | null; | ||
|
||
export type {Nullable}; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
enum QUERY_LOADING_STATE { | ||
SUBMITTING = 0, | ||
WAITING, | ||
LOADING, | ||
} | ||
|
||
/** | ||
* Key names in enum `QUERY_LOADING_STATE`. | ||
junhaoliao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
const QUERY_LOADING_STATE_VALUES = Object.freeze( | ||
Object.values(QUERY_LOADING_STATE).filter((value) => "number" === typeof value) | ||
); | ||
|
||
enum QUERY_JOB_TYPE { | ||
SEARCH_OR_AGGREGATION = 0, | ||
EXTRACT_IR, | ||
EXTRACT_JSON, | ||
} | ||
|
||
interface QueryLoadingStateDescription { | ||
label: string, | ||
description: string, | ||
} | ||
|
||
/** | ||
* Descriptions for query loading states. | ||
*/ | ||
const QUERY_LOADING_STATE_DESCRIPTIONS | ||
: Record<QUERY_LOADING_STATE, QueryLoadingStateDescription> = | ||
Object.freeze({ | ||
[QUERY_LOADING_STATE.SUBMITTING]: { | ||
label: "Submitting query Job", | ||
description: "Parsing arguments and submitting job to the server.", | ||
}, | ||
[QUERY_LOADING_STATE.WAITING]: { | ||
label: "Waiting for job to finish", | ||
description: "The job is running. Waiting for the job to finish.", | ||
}, | ||
[QUERY_LOADING_STATE.LOADING]: { | ||
label: "Loading Log Viewer", | ||
description: "The query has been completed and the results are being loaded.", | ||
}, | ||
}); | ||
|
||
export { | ||
QUERY_JOB_TYPE, | ||
QUERY_LOADING_STATE, | ||
QUERY_LOADING_STATE_DESCRIPTIONS, | ||
QUERY_LOADING_STATE_VALUES, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be updated once y-scope/eslint-config-yscope#3 is merged and a new version is published.