Skip to content

Commit

Permalink
refactor(ui): cleanup after refactoring UI (pingcap#1334)
Browse files Browse the repository at this point in the history
* remove original ui folder

* rename ui-new to ui
  • Loading branch information
baurine authored Jul 16, 2022
1 parent e8c4fcc commit 14c133e
Show file tree
Hide file tree
Showing 1,152 changed files with 85 additions and 54,046 deletions.
1 change: 0 additions & 1 deletion .github/autolabeler.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
area/frontend:
- /ui
- /ui-new
area/backend:
- *.go
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
with:
node-version: '16'
cache: 'pnpm'
cache-dependency-path: 'ui-new/pnpm-lock.yaml'
cache-dependency-path: 'ui/pnpm-lock.yaml'
- uses: actions/setup-go@v3
with:
go-version: '1.15'
Expand All @@ -77,7 +77,7 @@ jobs:
- name: Check format
run: |
pnpm fmt-check || (echo "::error ::Please format your code by using 'pnpm fmt-fix'"; exit 1)
working-directory: ui-new
working-directory: ui
- name: Build UI
run: |
make ui
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
with:
node-version: '16'
cache: 'pnpm'
cache-dependency-path: 'ui-new/pnpm-lock.yaml'
cache-dependency-path: 'ui/pnpm-lock.yaml'
- uses: actions/setup-go@v3
with:
go-version: "1.15"
Expand All @@ -47,7 +47,7 @@ jobs:
run: |
make ui
- name: Pack UI assets for release
working-directory: ui-new/packages/tidb-dashboard-for-op/dist
working-directory: ui/packages/tidb-dashboard-for-op/dist
run: |
zip -r ../static-assets.zip .
- name: Create release
Expand All @@ -66,7 +66,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ui-new/packages/tidb-dashboard-for-op/static-assets.zip
asset_path: ./ui/packages/tidb-dashboard-for-op/static-assets.zip
asset_name: static-assets.zip
asset_content_type: application/zip
- name: Generate embedded UI assets
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
with:
node-version: '16'
cache: 'pnpm'
cache-dependency-path: 'ui-new/pnpm-lock.yaml'
cache-dependency-path: 'ui/pnpm-lock.yaml'
- name: Load cypress cache
uses: actions/cache@v3
id: cypress-cache
Expand Down Expand Up @@ -191,7 +191,7 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./ui-new/packages/tidb-dashboard-for-op/.nyc_output/out.json
files: ./ui/packages/tidb-dashboard-for-op/.nyc_output/out.json
fail_ci_if_error: true
flags: e2e_test
verbose: true
8 changes: 4 additions & 4 deletions .github/workflows/upload-e2e-snapshots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
with:
node-version: '16'
cache: 'pnpm'
cache-dependency-path: 'ui-new/pnpm-lock.yaml'
cache-dependency-path: 'ui/pnpm-lock.yaml'
- uses: actions/setup-go@v3
with:
go-version: "1.15"
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
UI: 1
FEATURE_VERSION: ${{ matrix.feature_version }}
- name: Delete Previous Snapshots
run: rm -rf ${{ github.workspace }}/ui-new/packages/tidb-dashboard-for-op/cypress/snapshots
run: rm -rf ${{ github.workspace }}/ui/packages/tidb-dashboard-for-op/cypress/snapshots
- name: Run E2E Features Test
run: make e2e_test_specify
env:
Expand All @@ -112,10 +112,10 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: e2e-video-${{ matrix.feature_version }}
path: ${{ github.workspace }}/ui-new/packages/tidb-dashboard-for-op/cypress/videos/**/*
path: ${{ github.workspace }}/ui/packages/tidb-dashboard-for-op/cypress/videos/**/*
- name: Upload snapshots artifact
uses: actions/upload-artifact@v2
if: always()
with:
name: e2e-snapshots-${{ matrix.feature_version }}
path: ${{ github.workspace }}/ui-new/packages/tidb-dashboard-for-op/cypress/snapshots/**/*
path: ${{ github.workspace }}/ui/packages/tidb-dashboard-for-op/cypress/snapshots/**/*
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The followings are required for developing TiDB Dashboard:

```bash
# In tidb-dashboard directory:
cd ui-new
cd ui
pnpm i # install all dependencies
pnpm dev
```
Expand All @@ -81,7 +81,7 @@ The followings are required for developing TiDB Dashboard:
When back-end server and front-end server are both started, E2E tests can be run by:

```bash
cd ui-new/packages/tidb-dashboard-for-op
cd ui/packages/tidb-dashboard-for-op
pnpm open:cypress
```

Expand Down Expand Up @@ -120,7 +120,7 @@ This is a rough outline of what a contributor's workflow looks like:
- Frontend:

```bash
# In ui-new directory:
# In ui directory:
pnpm fmt
```

Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,28 @@ e2e_test:

.PHONY: e2e_compat_features_test
e2e_compat_features_test:
cd ui-new &&\
cd ui &&\
pnpm i &&\
cd packages/tidb-dashboard-for-op &&\
pnpm run:e2e-test:compat-features --env FEATURE_VERSION=$(FEATURE_VERSION) TIDB_VERSION=$(TIDB_VERSION)

.PHONY: e2e_common_features_test
e2e_common_features_test:
cd ui-new &&\
cd ui &&\
pnpm i &&\
cd packages/tidb-dashboard-for-op &&\
pnpm run:e2e-test:common-features --env TIDB_VERSION=$(TIDB_VERSION)

.PHONY: e2e_without_ngm_test
e2e_without_ngm_test:
cd ui-new &&\
cd ui &&\
pnpm i &&\
cd packages/tidb-dashboard-for-op &&\
pnpm run:e2e-test:without-ngm --env TIDB_VERSION=$(TIDB_VERSION) WITHOUT_NGM=$(WITHOUT_NGM)

.PHONY: e2e_test_specify
e2e_test_specify:
cd ui-new &&\
cd ui &&\
pnpm i &&\
cd packages/tidb-dashboard-for-op &&\
pnpm run:e2e-test:specify --env TIDB_VERSION=$(TIDB_VERSION) -- --spec $(E2E_SPEC)
Expand All @@ -91,12 +91,12 @@ dev: lint default

.PHONY: ui_deps
ui_deps: install_tools
cd ui-new &&\
cd ui &&\
pnpm i

.PHONY: ui
ui: ui_deps
cd ui-new &&\
cd ui &&\
pnpm build

.PHONY: go_generate
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Thank you to all the people who already contributed to TiDB Dashboard!
## Architecture

This repository contains both Dashboard HTTP API and Dashboard UI. Dashboard HTTP API is placed in
`pkg/` directory, written in Golang. Dashboard UI is placed in `ui-new/` directory, powered by React.
`pkg/` directory, written in Golang. Dashboard UI is placed in `ui/` directory, powered by React.

TiDB Dashboard can also be integrated into PD, as follows:

Expand Down
2 changes: 1 addition & 1 deletion scripts/distro/write_strings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -euo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
PROJECT_DIR=$(cd "$DIR/../.."; pwd)

TARGET="${PROJECT_DIR}/ui-new/packages/tidb-dashboard-for-op/src/uilts/distro/strings_res.json"
TARGET="${PROJECT_DIR}/ui/packages/tidb-dashboard-for-op/src/uilts/distro/strings_res.json"

echo "+ Write distro strings"
cd "$PROJECT_DIR"
Expand Down
2 changes: 1 addition & 1 deletion scripts/embed_ui_assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set -euo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
PROJECT_DIR=$(cd "$DIR/.."; pwd)

UI_ASSETS_DIR=$PROJECT_DIR/ui-new/packages/tidb-dashboard-for-op/dist
UI_ASSETS_DIR=$PROJECT_DIR/ui/packages/tidb-dashboard-for-op/dist

export GOBIN=$PROJECT_DIR/bin
export PATH=$GOBIN:$PATH
Expand Down
10 changes: 0 additions & 10 deletions ui-new/.eslintrc.js

This file was deleted.

15 changes: 0 additions & 15 deletions ui-new/.gitignore

This file was deleted.

16 changes: 0 additions & 16 deletions ui-new/.prettierignore

This file was deleted.

5 changes: 0 additions & 5 deletions ui-new/.prettierrc

This file was deleted.

3 changes: 0 additions & 3 deletions ui-new/go.mod

This file was deleted.

39 changes: 0 additions & 39 deletions ui-new/package.json

This file was deleted.

18 changes: 0 additions & 18 deletions ui-new/tsconfig.json

This file was deleted.

File renamed without changes.
9 changes: 0 additions & 9 deletions ui/.env.development

This file was deleted.

9 changes: 0 additions & 9 deletions ui/.env.production

This file was deleted.

14 changes: 3 additions & 11 deletions ui/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
module.exports = {
extends: ['react-app', 'plugin:cypress/recommended'],
ignorePatterns: ['lib/client/api/*.ts'],
extends: ['react-app'],
rules: {
'react/react-in-jsx-scope': 'error',
'jsx-a11y/anchor-is-valid': 'off',
'jsx-a11y/alt-text': 'off',
'import/no-anonymous-default-export': 'off',
'react-hooks/exhaustive-deps': [
'warn',
{
additionalHooks:
'^use(Async|AsyncFn|AsyncRetry|UpdateEffect|IsomorphicLayoutEffect|DeepCompareEffect|ShallowCompareEffect)$',
},
],
'no-script-url': 'off',
},
'react/jsx-no-target-blank': 'off'
}
}
33 changes: 4 additions & 29 deletions ui/.gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
dist
build

.eslintcache

# testing
coverage
Expand All @@ -19,22 +13,3 @@ cypress/integration/1-getting-started
cypress/integration/2-advanced-examples
.nyc_output
*.log

# production
build/
dist/
.rpt2_cache

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

.eslintcache
Loading

0 comments on commit 14c133e

Please sign in to comment.