Skip to content

Commit c40da58

Browse files
committed
add ui code to guidellm
1 parent 3d4ad78 commit c40da58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+16274
-0
lines changed

.github/workflows/ghpages.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: GH Pages
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
types:
8+
- opened
9+
- reopened
10+
- synchronize
11+
12+
workflow_dispatch:
13+
14+
jobs:
15+
publish-gh-pages:
16+
permissions:
17+
contents: write
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Check out code
21+
uses: actions/checkout@v3
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
working-directory: ui
26+
27+
- name: Build app to root
28+
id: build
29+
run: |
30+
# Export vars to ensure they are loaded before build
31+
export $(grep -v '^#' .env.development | xargs)
32+
33+
# Set asset prefix and base path
34+
ASSET_PREFIX=https://didactic-adventure-rww9l86.pages.github.io
35+
BASE_PATH=/
36+
GIT_SHA=${{ github.sha }}
37+
export ASSET_PREFIX=${ASSET_PREFIX}
38+
export BASE_PATH=${BASE_PATH}
39+
export GIT_SHA=${GIT_SHA}
40+
41+
npm run build
42+
working-directory: ui
43+
44+
- name: Deploy to GitHub Pages
45+
uses: peaceiris/actions-gh-pages@v3
46+
with:
47+
github_token: ${{ secrets.GITHUB_TOKEN }}
48+
publish_dir: ui/out
49+
publish_branch: gh-pages

.github/workflows/ui-development.yaml

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Development
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
types:
8+
- opened
9+
- reopened
10+
- synchronize
11+
workflow_dispatch:
12+
13+
jobs:
14+
quality-check:
15+
# Permissions needed to get ID token for OIDC auth
16+
permissions:
17+
contents: 'read'
18+
id-token: 'write'
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Check out code
22+
uses: actions/checkout@v3
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
working-directory: ui
27+
28+
- name: Run quality and typing checks
29+
run: make quality
30+
working-directory: ui
31+
32+
precommit-check:
33+
# Permissions needed to get ID token for OIDC auth
34+
permissions:
35+
contents: 'read'
36+
id-token: 'write'
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Check out code
40+
uses: actions/checkout@v3
41+
42+
- name: Install dependencies
43+
run: npm ci
44+
working-directory: ui
45+
46+
- name: Run pre-commit checks
47+
run: npx husky run pre-commit
48+
working-directory: ui
49+
50+
unit-tests:
51+
# Permissions needed to get ID token for OIDC auth
52+
permissions:
53+
contents: 'read'
54+
id-token: 'write'
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Check out code
58+
uses: actions/checkout@v3
59+
60+
- name: Install dependencies
61+
run: npm ci
62+
working-directory: ui
63+
64+
- name: Run unit tests
65+
run: make test-unit
66+
working-directory: ui
67+
68+
integration-tests:
69+
# Permissions needed to get ID token for OIDC auth
70+
permissions:
71+
contents: 'read'
72+
id-token: 'write'
73+
runs-on: ubuntu-latest
74+
steps:
75+
- name: Check out code
76+
uses: actions/checkout@v3
77+
78+
- name: Install dependencies
79+
run: npm ci
80+
working-directory: ui
81+
82+
- name: Run integration tests
83+
run: make test-integration
84+
working-directory: ui

ui/.env.development

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ASSET_PREFIX=https://review.neuralmagic.com/guidellm-ui/dev/_next
2+
BASE_PATH=/guidellm-ui/dev
3+
NEXT_PUBLIC_FEATURES={"blocks":{"workloadDetails":false,"costSection":false}}
4+
NEXT_PUBLIC_USE_MOCK_API=true

ui/.env.production

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ASSET_PREFIX=https://guidellm.neuralmagic.com

ui/.env.staging

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ASSET_PREFIX=https://staging.guidellm.neuralmagic.com

ui/.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.vscode
3+
cypress.config.ts

ui/.eslintrc

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es6": true,
5+
"jest": true
6+
},
7+
"extends": [
8+
"airbnb-typescript",
9+
"airbnb/hooks",
10+
"eslint:recommended",
11+
"plugin:@typescript-eslint/eslint-recommended",
12+
"plugin:@typescript-eslint/recommended",
13+
"plugin:prettier/recommended",
14+
"next/core-web-vitals"
15+
],
16+
"ignorePatterns": [".vscode", "jest.config.js", "__mocks__"],
17+
"overrides": [
18+
{
19+
"files": ["*.mjs"],
20+
"parser": "espree", // Use the default JavaScript parser for `.mjs` files
21+
"parserOptions": {
22+
"sourceType": "module"
23+
}
24+
}
25+
],
26+
"parser": "@typescript-eslint/parser",
27+
"parserOptions": {
28+
"ecmaFeatures": {
29+
"jsx": true
30+
},
31+
"ecmaVersion": 2018,
32+
"sourceType": "module",
33+
"project": "./tsconfig.json"
34+
},
35+
"plugins": ["@typescript-eslint", "jest", "react", "import", "no-secrets"],
36+
"root": true,
37+
"rules": {
38+
"curly": ["error", "all"],
39+
"complexity": ["warn", { "max": 8 }],
40+
"import/order": [
41+
"error",
42+
{ "groups": [["builtin", "external", "internal"]], "newlines-between": "always" }
43+
],
44+
"import/no-extraneous-dependencies": [
45+
"error",
46+
{
47+
"devDependencies": [
48+
"**/*.test.ts",
49+
"**/*.test.tsx",
50+
"**/*.d.ts",
51+
"**/*.interfaces.ts",
52+
"**/*.setup.ts",
53+
"**/*.config.js",
54+
"**/*.config.mjs"
55+
],
56+
"optionalDependencies": false,
57+
"peerDependencies": false
58+
}
59+
],
60+
"no-secrets/no-secrets": ["error", { "additionalRegexes": {}, "ignoreContent": [] }]
61+
}
62+
}

ui/.gitignore

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# IDE
4+
/.idea
5+
/.vscode
6+
7+
# dependencies
8+
/node_modules
9+
/.pnp
10+
.pnp.js
11+
.yarn/install-state.gz
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
.eslintcache
27+
.npmrc
28+
.env.development.local
29+
.env.test.local
30+
.env.production.local
31+
32+
# debug
33+
npm-debug.log*
34+
yarn-debug.log*
35+
yarn-error.log*
36+
37+
# local env files
38+
.env*.local
39+
40+
# vercel
41+
.vercel
42+
43+
# typescript
44+
*.tsbuildinfo
45+
next-env.d.ts
46+
47+
# Ignore resources related to yalc temp files
48+
.yalc
49+
yalc.lock
50+
51+
# Ignore branch coverage badge
52+
.meta/badge-branches.svg
53+

ui/.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

ui/.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

ui/.prettierignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/node_modules
2+
.vscode
3+
/bin
4+
/build
5+
/public
6+
/.meta

ui/.prettierrc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"arrowParens": "always",
3+
"bracketSameLine": false,
4+
"bracketSpacing": true,
5+
"jsxBracketSameLine": false,
6+
"jsxSingleQuote": false,
7+
"printWidth": 100,
8+
"semi": true,
9+
"singleQuote": true,
10+
"tabWidth": 2,
11+
"trailingComma": "es5",
12+
"useTabs": false
13+
}

ui/DEVELOPING.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# GuideLLM UI
2+
3+
### Available Scripts
4+
5+
In the project directory, you can run:
6+
7+
#### `npm run dev`
8+
9+
Runs the app in the development mode.\
10+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11+
12+
The page will reload if you make edits.\
13+
You will also see any lint errors in the console.
14+
15+
#### `npm run build`
16+
17+
Builds the app for production to the `out` folder.\
18+
19+
#### `make test-unit`
20+
21+
Run unit test once on your local terminal.
22+
23+
#### `make test-integration`
24+
25+
Run integration test once on your local terminal.
26+
27+
#### `npx cypress run --headless`
28+
29+
Run end to end tests against localhost:3000
30+
31+
##### Tagging Tests
32+
33+
Reference [https://www.npmjs.com/package/jest-runner-groups](jest-runner-groups)
34+
Add @group with the tag in a docblock at the top of the test file to indicate which types of tests are contained within.
35+
Downside is that we can't distinguish between different types of tests in the same file.
36+
37+
```
38+
/**
39+
* Admin dashboard tests
40+
*
41+
* @group smoke
42+
* @group sanity
43+
* @group regression
44+
*/
45+
```
46+
47+
#### `make style`
48+
49+
Fix code styling issues.

ui/Makefile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
CHECKDIRS := src
2+
3+
4+
# Run checks on all files for the repo
5+
quality:
6+
@echo "Running quality checks";
7+
@# Run eslint checks
8+
npx eslint --max-warnings 10 $(CHECKDIRS)
9+
@# Run TypeScript checks
10+
npx tsc --noEmit
11+
12+
# Style the code according to accepted standards for the repo
13+
style:
14+
@echo "Running styling";
15+
@# Auto fix any eslint issues
16+
npx eslint --fix $(CHECKDIRS)
17+
18+
test-unit:
19+
@echo "Running unit tests";
20+
@# Run react tests
21+
npm run test:unit
22+
23+
test-integration:
24+
@echo "Running integration tests";
25+
@# Run react tests
26+
npm run test:integration

0 commit comments

Comments
 (0)