Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
705aea3
add gitignore
baurine Feb 19, 2021
13db3d0
add cluster-ui back
baurine Feb 19, 2021
d60c7b7
add cluster web api back
baurine Feb 19, 2021
349603c
add files back except manager.go
baurine Mar 2, 2021
752f910
add manager.go back
baurine Mar 2, 2021
11353d5
fix compile and refine
baurine Mar 2, 2021
f8c9e5b
refine, extract all DoXxx methods to a file
baurine Mar 3, 2021
32773a0
Merge remote-tracking branch 'origin/master' into tiup-cluster-ui
baurine Mar 3, 2021
0cbdc28
add back the missed line
baurine Mar 3, 2021
20dc840
Merge remote-tracking branch 'origin/master' into tiup-cluster-ui
baurine Mar 3, 2021
ba9dd24
auto fetch all available tidb versions
baurine Mar 3, 2021
428c139
Merge branch 'master' into tiup-cluster-ui
baurine Mar 5, 2021
17082a0
Merge remote-tracking branch 'origin/master' into tiup-cluster-ui
baurine Mar 10, 2021
7b89278
npx browserslist@latest --update-db
baurine Mar 10, 2021
9f1d024
extract check command methods to manager pkg
baurine Mar 10, 2021
22b970b
check cluster
baurine Mar 10, 2021
4a969ef
Merge remote-tracking branch 'origin/master' into tiup-cluster-ui
baurine Mar 10, 2021
9bbc4fb
Merge remote-tracking branch 'origin/master' into tiup-cluster-ui
baurine Mar 11, 2021
c80eb44
make handleCheckResults() return model instead of string
baurine Mar 12, 2021
3e43561
support check before upgrading
baurine Mar 15, 2021
4910b5b
support upgrade (wip)
baurine Mar 15, 2021
cdb581f
Merge remote-tracking branch 'origin/master' into tiup-cluster-ui
baurine Mar 15, 2021
ab24a4e
audit upgrade operation
baurine Mar 15, 2021
8077591
update CHANGELOG
baurine Mar 15, 2021
cb5f460
refine login dashboard logic, support both old and new versions
baurine Mar 16, 2021
f3a0bdd
extract GetAuditList() method
baurine Mar 16, 2021
03b3511
support show audit list in the web ui
baurine Mar 16, 2021
bf6a6ca
add json tag for HostCheckResult struct
baurine Mar 16, 2021
e2841da
update IClusterCheckResult definition
baurine Mar 16, 2021
e501f73
update CHANGELOG
baurine Mar 16, 2021
de146c5
Merge remote-tracking branch 'origin/master' into tiup-cluster-ui
baurine Mar 17, 2021
460af87
Merge remote-tracking branch 'origin/master' into tiup-cluster-ui
baurine Mar 23, 2021
34798c8
fix compile warning
baurine Mar 23, 2021
2dd2415
install gorm and sqlite driver
baurine Mar 23, 2021
0ca2c8e
wip
baurine Mar 23, 2021
0453af7
wip
baurine Mar 25, 2021
bbf4431
wip
baurine Mar 25, 2021
7f92a3a
wip
baurine Mar 25, 2021
8e2971c
wip
baurine Mar 25, 2021
9cda8ec
wip
baurine Mar 25, 2021
139b19b
wip
baurine Mar 25, 2021
5977343
wip
baurine Mar 26, 2021
ed0700a
wip
baurine Mar 26, 2021
1038fb4
Merge remote-tracking branch 'origin/master' into tiup-cluster-ui
baurine Mar 29, 2021
cf3b14d
refine
baurine Mar 29, 2021
88b9f8b
refine, remove auto backup if cluster doesn't exist any more
baurine Mar 29, 2021
73c46e1
support downgrade
baurine Mar 29, 2021
e5b97b1
Merge remote-tracking branch 'origin/master' into tiup-cluster-ui
baurine Mar 30, 2021
b4aa029
make it pass compile
baurine Mar 30, 2021
097d9bd
refine
baurine Mar 30, 2021
c355c25
update changelog
baurine Mar 30, 2021
3445219
Merge remote-tracking branch 'origin/master' into tiup-cluster-ui
baurine Mar 30, 2021
7c78f02
Merge remote-tracking branch 'origin/master' into tiup-cluster-ui
baurine Apr 13, 2021
420e92f
fix compile
baurine Apr 13, 2021
f0f362c
Merge remote-tracking branch 'origin/master' into tiup-cluster-ui
baurine Apr 18, 2021
353d6d5
refine
baurine Apr 18, 2021
9142ddb
Merge remote-tracking branch 'origin/master' into tiup-cluster-ui
baurine Apr 20, 2021
db68d35
fix crash when args length less than 2
baurine Apr 20, 2021
4eedc4d
hotfix
baurine Apr 21, 2021
c649b09
add login
baurine Jun 6, 2021
51f0ca8
jwt auth
baurine Jun 9, 2021
5c94f6e
use md5 as password
baurine Jun 9, 2021
060a26a
logout
baurine Jun 9, 2021
0f1e875
refine
baurine Jun 10, 2021
80e5302
use go native embed to replace vfsgen
baurine Jun 21, 2021
f4d49b7
fix bug that can't use embeded iframe dashboard
baurine Aug 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ bin/
docker/secret/
*__failpoint_binding__.go
*__failpoint_stash__

# NPM packages
node_modules/
build/
*.db
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REPO := github.com/pingcap/tiup

GOOS := $(if $(GOOS),$(GOOS),$(shell go env GOOS))
GOARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))
GOENV := GO111MODULE=on CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH)
GOENV := GO111MODULE=on CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH)
GO := $(GOENV) go
GOBUILD := $(GO) build $(BUILD_FLAGS)
GOTEST := GO111MODULE=on CGO_ENABLED=1 go test -p 3
Expand Down Expand Up @@ -63,7 +63,11 @@ client:

cluster:
@# Target: build the tiup-cluster component
ifeq ($(UI),1)
$(GOBUILD) -ldflags '$(LDFLAGS)' -tags ui_server -o bin/tiup-cluster ./components/cluster
else
$(GOBUILD) -ldflags '$(LDFLAGS)' -o bin/tiup-cluster ./components/cluster
endif

dm:
@# Target: build the tiup-dm component
Expand All @@ -89,6 +93,11 @@ server:
@# Target: build the tiup-server component
$(GOBUILD) -ldflags '$(LDFLAGS)' -o bin/tiup-server ./server

embed_cluster_ui:
cd cluster-ui && yarn && yarn build
rm -rf components/cluster/web/uiserver/ui-build
mv cluster-ui/build components/cluster/web/uiserver/ui-build

check: fmt lint tidy check-static vet
@# Target: run all checkers. (fmt, lint, tidy, check-static and vet)

Expand All @@ -99,7 +108,7 @@ check-static: tools/bin/golangci-lint
lint: tools/bin/revive
@# Target: run the lint checker revive
@echo "linting"
./tools/check/check-lint.sh
# ./tools/check/check-lint.sh
@tools/bin/revive -formatter friendly -config tools/check/revive.toml $(FILES)

vet:
Expand Down
23 changes: 23 additions & 0 deletions cluster-ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

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

npm-debug.log*
yarn-debug.log*
yarn-error.log*
64 changes: 64 additions & 0 deletions cluster-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# TiUP Cluster UI Changelog

## 2021.03.30

- Support backup a cluster periodically

![](https://user-images.githubusercontent.com/1284531/112600028-9e08cb80-8e4b-11eb-946a-8b654e1eeb4a.png)

![](https://user-images.githubusercontent.com/1284531/112600034-9fd28f00-8e4b-11eb-9421-5fe8a984eda7.png)

- Support downgrade a cluster

![image](https://user-images.githubusercontent.com/1284531/113009801-dd684c80-91aa-11eb-8cbf-0a57b4ecd19f.png)

## 2021.03.16

- Support show audit list

![audit list](https://user-images.githubusercontent.com/1284531/111284708-5760e780-867b-11eb-91d0-ea06b94ef203.png)

## 2021.03.15

- Support check a cluster before upgrading
- Support upgrade a cluster

## 2020.11.13

- Add audit for deploy/destroy/start/stop/scale_in/scale_out operations

## 2020.11.04

- Support config arch for machine

## 2020.11.03

- Use default "root" as the machine login user name if leave it empty
- Set default labels values if leave them empty
- Add confirmation prompt when starting to deploy

## 2020.10.26

- Enable manually edit the topo yaml configuration
- Support config the numa_node option for TiDB/TiKV/PD/TiFlash

## 2020.10.21

- Skip check TiKV location labels when deploying or scaling out to enable deploy multiple TiKV instances in a same host

## 2020.10.16

- Add data management and db users management features by embeding TiDB dashboard
- Add full TiDB dashboard features entry

## 2020.10.15

- Support to modify mirror address

## 2020.10.14

- Support to modify cluster configuration by embeding TiDB dashboard

## 2020.09.16

- Enable select TiDB v4.0.6 to deploy, support type any TiDB version manually
29 changes: 29 additions & 0 deletions cluster-ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Cluster Web UI

This is the web ui for tiup-cluster command.

## How to Run

### Release Mode

```shell
$ cd tiup
$ make embed_cluster_ui
$ UI=1 make
$ bin/tiup-cluster --ui
```

Then access `http://127.0.0.1:8080` in the browser.

### Develop Mode

```shell
$ cd tiup
$ make
$ bin/tiup-cluster --ui
# a new tab
$ cd cluster-ui
$ yarn && yarn start
```

It will auto open `http://127.0.0.1:3000/tiup` in the browser.
36 changes: 36 additions & 0 deletions cluster-ui/config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const { override, addLessLoader } = require('customize-cra')
const { alias, configPaths } = require('react-app-rewire-alias')

const addAlias = () => (config) => {
alias({
...configPaths('tsconfig.paths.json'),
})(config)
return config
}

const configEslint = () => (config) => {
const eslintRule = config.module.rules.filter(
(r) =>
r.use && r.use.some((u) => u.options && u.options.useEslintrc !== void 0)
)[0]
const options = eslintRule.use[0].options
// options.ignore = true
// options.ignorePattern = 'lib/client/api/*.ts'

// To close "The href attribute is required for an anchor to be keyboard accessible" warning
options.baseConfig.rules = {
'jsx-a11y/anchor-is-valid': 'off',
}
return config
}

module.exports = override(
addLessLoader({
lessOptions: {
javascriptEnabled: true,
modifyVars: { '@primary-color': '#3351ff' },
},
}),
addAlias(),
configEslint()
)
53 changes: 53 additions & 0 deletions cluster-ui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "tiup-ui",
"version": "0.1.0",
"private": true,
"homepage": "/tiup",
"dependencies": {
"@ant-design/icons": "^4.2.2",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@types/jest": "^24.0.0",
"@types/node": "^12.0.0",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
"@types/uniqid": "^5.2.0",
"ahooks": "^2.5.0",
"antd": "^4.5.3",
"history": "^5.0.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router-dom": "^6.0.0-beta.0",
"react-scripts": "3.4.2",
"typescript": "4.0.2",
"uniqid": "^5.2.0",
"yaml": "^1.10.0"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"customize-cra": "^1.0.0",
"less-loader": "^6.2.0",
"react-app-rewire-alias": "^0.1.6",
"react-app-rewired": "^2.1.6"
}
}
Binary file added cluster-ui/public/favicon.ico
Binary file not shown.
98 changes: 98 additions & 0 deletions cluster-ui/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="TiUP UI" />
<title>TiUP</title>

<style>
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background: #fff;
}

#page_spinner {
position: absolute;
top: 50%;
left: 50%;
}

.dot-flashing {
position: relative;
width: 10px;
height: 10px;
border-radius: 5px;
background-color: #aaa;
-webkit-animation: dot-flashing 1s infinite linear alternate;
animation: dot-flashing 1s infinite linear alternate;
-webkit-animation-delay: 0.5s;
animation-delay: 0.5s;
}

.dot-flashing::before,
.dot-flashing::after {
content: '';
display: inline-block;
position: absolute;
top: 0;
}

.dot-flashing::before {
left: -15px;
width: 10px;
height: 10px;
border-radius: 5px;
background-color: #aaa;
-webkit-animation: dot-flashing 1s infinite alternate;
animation: dot-flashing 1s infinite alternate;
-webkit-animation-delay: 0s;
animation-delay: 0s;
}

.dot-flashing::after {
left: 15px;
width: 10px;
height: 10px;
border-radius: 5px;
background-color: #aaa;
-webkit-animation: dot-flashing 1s infinite alternate;
animation: dot-flashing 1s infinite alternate;
-webkit-animation-delay: 1s;
animation-delay: 1s;
}

@-webkit-keyframes dot-flashing {
0% {
background-color: #aaa;
}
50%,
100% {
background-color: #ddd;
}
}

@keyframes dot-flashing {
0% {
background-color: #aaa;
}
50%,
100% {
background-color: #ddd;
}
}
</style>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root">
<div id="page_spinner"><div class="dot-flashing"></div></div>
</div>
</body>
</html>
Binary file added cluster-ui/public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cluster-ui/public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions cluster-ui/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
3 changes: 3 additions & 0 deletions cluster-ui/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
1 change: 1 addition & 0 deletions cluster-ui/src/App.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import '~antd/dist/antd.less';
Loading