Compare commits

..

43 Commits

Author SHA1 Message Date
Kairee Wu 80df346ec3
Merge pull request #12 from krwu/dependabot/npm_and_yarn/webpack-5.82.0
build(deps): bump webpack from 5.75.0 to 5.82.0
4 years ago
dependabot[bot] da6726e223
build(deps): bump webpack from 5.75.0 to 5.82.0
Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to 5.82.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.75.0...v5.82.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
4 years ago
semantic-release-bot bed2cd0724 chore(release): 2.0.3 [skip ci]
## [2.0.3](https://github.com/krwu/ServerStatus-web/compare/v2.0.2...v2.0.3) (2023-03-07)

### Bug Fixes

* http-cache-semantics vulnerable ([dac1abc](dac1abc111))
4 years ago
kaireewu dac1abc111
fix: http-cache-semantics vulnerable 4 years ago
Kairee Wu 0394e1e410
Merge pull request #11 from krwu/dependabot/npm_and_yarn/json5-1.0.2
build(deps): bump json5 from 1.0.1 to 1.0.2
4 years ago
dependabot[bot] b3f50add57
build(deps): bump json5 from 1.0.1 to 1.0.2
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
4 years ago
Kairee Wu d25d7fa890
Merge pull request #10 from krwu/dependabot/npm_and_yarn/minimatch-and-recursive-readdir-3.1.2
build(deps): bump minimatch and recursive-readdir
4 years ago
dependabot[bot] 1dfa29f3d1
build(deps): bump minimatch and recursive-readdir
Bumps [minimatch](https://github.com/isaacs/minimatch) and [recursive-readdir](https://github.com/jergason/recursive-readdir). These dependencies needed to be updated together.

Updates `minimatch` from 3.0.4 to 3.1.2
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

Updates `recursive-readdir` from 2.2.2 to 2.2.3
- [Release notes](https://github.com/jergason/recursive-readdir/releases)
- [Changelog](https://github.com/jergason/recursive-readdir/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jergason/recursive-readdir/commits/v2.2.3)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
- dependency-name: recursive-readdir
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
4 years ago
Kairee Wu 3c2d44013e
Merge pull request #9 from krwu/dependabot/npm_and_yarn/loader-utils-2.0.4
build(deps): bump loader-utils from 2.0.3 to 2.0.4
4 years ago
dependabot[bot] 54b7548879
build(deps): bump loader-utils from 2.0.3 to 2.0.4
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 2.0.3 to 2.0.4.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v2.0.4/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v2.0.3...v2.0.4)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
4 years ago
Kairee Wu e419c00c50
Merge pull request #8 from krwu/dependabot/npm_and_yarn/loader-utils-2.0.3
build(deps): bump loader-utils from 2.0.2 to 2.0.3
4 years ago
dependabot[bot] 4872457bfb
build(deps): bump loader-utils from 2.0.2 to 2.0.3
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 2.0.2 to 2.0.3.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v2.0.3/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v2.0.2...v2.0.3)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
4 years ago
semantic-release-bot fab7d28d70 chore(release): 2.0.2 [skip ci]
## [2.0.2](https://github.com/krwu/ServerStatus-web/compare/v2.0.1...v2.0.2) (2022-09-13)

### Bug Fixes

* **npm:** potential security vulnerabilities ([10db0cb](10db0cbb2d))
4 years ago
Kairee Wu 10db0cbb2d
fix(npm): potential security vulnerabilities 4 years ago
kaireewu 35bdebe5d9
build(npm): upgrade dependencies [skip ci] 4 years ago
semantic-release-bot 33e6bfb1b5 chore(release): 2.0.1 [skip ci]
## [2.0.1](https://github.com/krwu/ServerStatus-web/compare/v2.0.0...v2.0.1) (2022-07-14)

### Performance Improvements

* clean unnecessary packages ([d5a1dd0](d5a1dd007c))
4 years ago
kaireewu d5a1dd007c
perf: clean unnecessary packages 4 years ago
kaireewu 556d0f31ff
build(react): upgrade to react 18 4 years ago
semantic-release-bot 487fd2b6c8 chore(release): 2.0.0 [skip ci]
# [2.0.0](https://github.com/krwu/ServerStatus-web/compare/v1.4.0...v2.0.0) (2022-06-14)

### Features

* upgrade dependencies ([eeff4c0](eeff4c0eaf))

### BREAKING CHANGES

* - react-scripts upgraded to v5
- semantic-release upgraded to v19
- dropped support for Node <= 15
4 years ago
kaireewu eeff4c0eaf
feat: upgrade dependencies
BREAKING CHANGE:
- react-scripts upgraded to v5
- semantic-release upgraded to v19
- dropped support for Node <= 15
4 years ago
semantic-release-bot e22bbe70ea chore(release): 1.4.0 [skip ci]
# [1.4.0](https://github.com/krwu/ServerStatus-web/compare/v1.3.0...v1.4.0) (2022-02-19)

### Features

* upgrade dependencies ([c9a4f11](c9a4f11286))
5 years ago
Kairee Wu c9a4f11286
feat: upgrade dependencies 5 years ago
semantic-release-bot 6e1968fd18 chore(release): 1.3.0 [skip ci]
# [1.3.0](https://github.com/krwu/ServerStatus-web/compare/v1.2.0...v1.3.0) (2021-09-22)

### Features

* bump antd version to 4.0 ([664003d](664003df1b))
5 years ago
Kairee Wu 664003df1b
feat: bump antd version to 4.0 5 years ago
semantic-release-bot 576ae9734c chore(release): 1.2.0 [skip ci]
# [1.2.0](https://github.com/krwu/ServerStatus-web/compare/v1.1.5...v1.2.0) (2021-09-22)

### Bug Fixes

* ignore local registry ([15158f4](15158f4c8d))
* serviceWorker cause building failed ([bc548af](bc548af585))

### Features

* **ui:** add index for each row ([1c0fbfe](1c0fbfe86e))
5 years ago
Kairee Wu bc548af585
fix: serviceWorker cause building failed 5 years ago
Kairee Wu 15158f4c8d
fix: ignore local registry 5 years ago
Kairee Wu 6ab4977fc2
build: remove husky 5 years ago
Kairee Wu 97658483ff
build: specific node version to 14 5 years ago
Kairee Wu 7616241682
build(npm): upgrade dependencies 5 years ago
Kairee Wu 1c0fbfe86e
feat(ui): add index for each row 5 years ago
Kairee Wu de2736e2b5
Merge pull request #5 from krwu/dependabot/npm_and_yarn/semantic-release-17.2.3
build(deps-dev): bump semantic-release from 15.14.0 to 17.2.3
6 years ago
dependabot[bot] 66692e56e2
build(deps-dev): bump semantic-release from 15.14.0 to 17.2.3
Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 15.14.0 to 17.2.3.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](https://github.com/semantic-release/semantic-release/compare/v15.14.0...v17.2.3)

Signed-off-by: dependabot[bot] <support@github.com>
6 years ago
Kairee Wu 08012b2054
build(npm): upgrade dependencies for development 6 years ago
semantic-release-bot a41e294cfe chore(release): 1.1.5 [skip ci]
## [1.1.5](https://github.com/krwu/ServerStatus-web/compare/v1.1.4...v1.1.5) (2020-11-05)

### Bug Fixes

* locale ('1 day' doesn't work), mobile style ('name' item size) ([cf5c3b6](cf5c3b6638))
6 years ago
Kairee Wu a4d17234d4
build(ci): switch from travis to github actions 6 years ago
Kairee Wu c11917cf30
Merge pull request #4 from wjy20030407/master
fix: locale ('1 day' doesn't work), mobile style ('name' item size)
6 years ago
Dreamy.WJY cf5c3b6638
fix: locale ('1 day' doesn't work), mobile style ('name' item size) 6 years ago
Kairee Wu 6d063b133e
chore(license): rename copying.txt to LICENSE [skip ci] 7 years ago
semantic-release-bot e542d1d06f chore(release): 1.1.4 [skip ci]
## [1.1.4](https://github.com/krwu/ServerStatus-web/compare/v1.1.3...v1.1.4) (2020-05-05)

### Bug Fixes

* display name with host or name from json ([a19256c](a19256c9e8)), closes [#2](https://github.com/krwu/ServerStatus-web/issues/2)
7 years ago
Kairee Wu 4aeeeb7245
style: fix eslint style issues 7 years ago
Kairee Wu a19256c9e8
fix: display name with host or name from json
See #2.
7 years ago
Kairee Wu 443dd4ee8f
build(ci): split build pipeline and deploy pipeline 7 years ago

@ -1 +0,0 @@
module.exports = {extends: ['@commitlint/config-conventional']}

@ -1,28 +0,0 @@
{
"env": {
"es6": true,
"node": true
},
"extends": [
"plugin:react/recommended",
"airbnb"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint"
],
"rules": {
}
}

@ -0,0 +1,31 @@
name: release
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Rename output dir
run: mv build sergate
- name: Make zip file
run: zip -r -9 sergate.zip ./sergate -x .gitignore
- name: Semantic release
run: npx semantic-release
env:
CI: true
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore vendored

@ -23,3 +23,4 @@
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
yarn.lock

@ -0,0 +1 @@
registry=https://registry.npmjs.org/

@ -4,7 +4,6 @@
"plugins": [ "plugins": [
"@semantic-release/commit-analyzer", "@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator", "@semantic-release/release-notes-generator",
"@semantic-release/npm",
[ [
"@semantic-release/changelog", "@semantic-release/changelog",
{ {
@ -15,7 +14,6 @@
"@semantic-release/git", "@semantic-release/git",
{ {
"assets": [ "assets": [
"package.json",
"CHANGELOG.md" "CHANGELOG.md"
], ],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
@ -32,4 +30,4 @@
] ]
], ],
"publicConfig": "next" "publicConfig": "next"
} }

@ -1,26 +0,0 @@
language: node_js
node_js:
- lts/*
branches:
only:
- master
script:
- npm run build
after_success:
- mv build sergate
- zip -r -9 sergate.zip ./sergate -x .gitignore
- npx semantic-release
before_deploy:
- openssl aes-256-cbc -K $encrypted_58cbb43e0460_key -iv $encrypted_58cbb43e0460_iv -in deploy_key.enc -out /tmp/deploy_key -d
- eval "$(ssh-agent -s)"
- chmod 600 /tmp/deploy_key
- ssh-add /tmp/deploy_key
- echo "$host_key" >> $HOME/.ssh/known_hosts
deploy:
provider: script
script: rsync -e "ssh -p $deploy_port" -rz --delete-after --exclude "json" --quiet $TRAVIS_BUILD_DIR/sergate/ $deploy_user@$deploy_host:/data/sites/sergate/
edge: true

@ -1,3 +1,79 @@
## [2.0.3](https://github.com/krwu/ServerStatus-web/compare/v2.0.2...v2.0.3) (2023-03-07)
### Bug Fixes
* http-cache-semantics vulnerable ([dac1abc](https://github.com/krwu/ServerStatus-web/commit/dac1abc1112c6a6388f691e7697bb0dc5fd93558))
## [2.0.2](https://github.com/krwu/ServerStatus-web/compare/v2.0.1...v2.0.2) (2022-09-13)
### Bug Fixes
* **npm:** potential security vulnerabilities ([10db0cb](https://github.com/krwu/ServerStatus-web/commit/10db0cbb2d37d2be7a43e9279c2c60099237c1fa))
## [2.0.1](https://github.com/krwu/ServerStatus-web/compare/v2.0.0...v2.0.1) (2022-07-14)
### Performance Improvements
* clean unnecessary packages ([d5a1dd0](https://github.com/krwu/ServerStatus-web/commit/d5a1dd007cecafe7b4461e98667410ae099b6e3d))
# [2.0.0](https://github.com/krwu/ServerStatus-web/compare/v1.4.0...v2.0.0) (2022-06-14)
### Features
* upgrade dependencies ([eeff4c0](https://github.com/krwu/ServerStatus-web/commit/eeff4c0eaf59122bc984be4ab3970dbaf72164d1))
### BREAKING CHANGES
* - react-scripts upgraded to v5
- semantic-release upgraded to v19
- dropped support for Node <= 15
# [1.4.0](https://github.com/krwu/ServerStatus-web/compare/v1.3.0...v1.4.0) (2022-02-19)
### Features
* upgrade dependencies ([c9a4f11](https://github.com/krwu/ServerStatus-web/commit/c9a4f11286bd6d4788a78853af81104940b62fff))
# [1.3.0](https://github.com/krwu/ServerStatus-web/compare/v1.2.0...v1.3.0) (2021-09-22)
### Features
* bump antd version to 4.0 ([664003d](https://github.com/krwu/ServerStatus-web/commit/664003df1bf2d2f4eed04cc0334dcb22db0baa31))
# [1.2.0](https://github.com/krwu/ServerStatus-web/compare/v1.1.5...v1.2.0) (2021-09-22)
### Bug Fixes
* ignore local registry ([15158f4](https://github.com/krwu/ServerStatus-web/commit/15158f4c8d1523f2d2983a5bbf164660113211be))
* serviceWorker cause building failed ([bc548af](https://github.com/krwu/ServerStatus-web/commit/bc548af585014c29f2621c98599d63c4955c83ee))
### Features
* **ui:** add index for each row ([1c0fbfe](https://github.com/krwu/ServerStatus-web/commit/1c0fbfe86ea034d2bda0c32cc861bef52accac7d))
## [1.1.5](https://github.com/krwu/ServerStatus-web/compare/v1.1.4...v1.1.5) (2020-11-05)
### Bug Fixes
* locale ('1 day' doesn't work), mobile style ('name' item size) ([cf5c3b6](https://github.com/krwu/ServerStatus-web/commit/cf5c3b6638400203f694d1776488057dfbf42e87))
## [1.1.4](https://github.com/krwu/ServerStatus-web/compare/v1.1.3...v1.1.4) (2020-05-05)
### Bug Fixes
* display name with host or name from json ([a19256c](https://github.com/krwu/ServerStatus-web/commit/a19256c9e83345ec18916ce7620e57461228face)), closes [#2](https://github.com/krwu/ServerStatus-web/issues/2)
## [1.1.3](https://github.com/krwu/ServerStatus-web/compare/v1.1.2...v1.1.3) (2020-04-09) ## [1.1.3](https://github.com/krwu/ServerStatus-web/compare/v1.1.2...v1.1.3) (2020-04-09)

@ -1,9 +0,0 @@
const { override, fixBabelImports } = require('customize-cra');
module.exports = override(
fixBabelImports('import', {
libraryName: 'antd',
libraryDirectory: 'es',
style: 'css',
}),
);

@ -1,2 +0,0 @@
\¯o²7]gŠþù‹É 3yºT0ØG´t~)ÜÜsõrü@¨mµŠùõ¥ÇJYA¨«Áлn4‚t!£ ß<1B>«==†ft2ŒM<C592>Ø.n¿D®õɲž`š}ÜñÄ´J°e¡-ñÖºM<C2BA>ð I~Ax•]Ԝ௢Õ<C2A2>Z^j„IaàÇ„>;âjÌ:Q—Þ]‘ǘmÿ˜»uQ\2<><32>4OáÃÚñÄÌ5úùžn‹=óG?Aen©Å•]6úJãÈðœ±T_*sôP¢¸ß}Õ­¹º²k{kq «Zí†déB<C3A9>ûC<C3BB>„mWujfíÅ<C3AD>ÊJ< ÉªŠ–Sy×<11>9è5}è-S<>CÕ‰fã<SÀç¼R½úÀ5Ÿ.I.¸{O—Úëì‚ó½\Ï“›dgW\’ë†
ýáy§câðpùÆ=ƒ8Ë;HU;µàÕ$V¾qbQQQ¬ôáîdî4œ vË÷Ÿõ$á¤!<1F>¦Cw<¿1dÉ©æaäŸøØ&Z’ì"Lv§„µÝÑкúó<ÆWa

43577
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,5 @@
{ {
"name": "serverstatus-webui", "name": "serverstatus-webui",
"version": "1.1.3",
"description": "It's a simple, clean webui for ServerStatus, built with react and Ant Design", "description": "It's a simple, clean webui for ServerStatus, built with react and Ant Design",
"keywords": [ "keywords": [
"ServerStatus", "ServerStatus",
@ -10,6 +9,9 @@
"ant design" "ant design"
], ],
"private": true, "private": true,
"engines": {
"node": ">=18"
},
"homepage": ".", "homepage": ".",
"bugs": { "bugs": {
"url": "https://github.com/krwu/ServerStatus-web/issues" "url": "https://github.com/krwu/ServerStatus-web/issues"
@ -21,33 +23,26 @@
"url": "https://github.com/krwu/ServerStatus-web.git" "url": "https://github.com/krwu/ServerStatus-web.git"
}, },
"dependencies": { "dependencies": {
"@types/jest": "^24.0.0", "@ant-design/icons": "^4.6.4",
"@types/node": "^12.12.22", "antd": "^4.0.0",
"@types/react": "^16.9.17", "react": "18",
"@types/react-dom": "^16.9.0", "react-dom": "18",
"antd": "^3.26.0", "react-intl-universal": "^2.5.3"
"babel-plugin-import": "^1.12.0",
"customize-cra": "^0.9.1",
"react": "^16.9.0",
"react-app-rewired": "^2.1.5",
"react-dom": "^16.9.0",
"react-intl-universal": "^2.2.2",
"react-scripts": "^3.4.1",
"typescript": "~3.7.2"
}, },
"scripts": { "scripts": {
"start": "react-app-rewired start", "start": "react-scripts start",
"build": "react-app-rewired build", "build": "react-scripts build",
"test": "react-app-rewired test", "eject": "react-scripts eject"
"eject": "react-scripts eject",
"cz": "git-cz"
}, },
"eslintConfig": { "eslintConfig": {
"extends": "react-app" "extends": [
"react-app",
"react-app/jest"
]
}, },
"browserslist": { "browserslist": {
"production": [ "production": [
">0.2%", ">5%",
"not dead", "not dead",
"not op_mini all" "not op_mini all"
], ],
@ -58,24 +53,21 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^8.3.5", "@babel/core": ">=7.0.0-0 <8.0.0",
"@commitlint/config-conventional": "^8.3.4", "@babel/plugin-syntax-flow": "^7.14.5",
"@semantic-release/changelog": "^3.0.4", "@babel/plugin-transform-react-jsx": "^7.14.9",
"@semantic-release/git": "^7.0.16", "@semantic-release/changelog": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^2.27.0", "@semantic-release/git": "^10.0.1",
"@typescript-eslint/parser": "^2.27.0", "@svgr/webpack": "^6.2.1",
"eslint": "^6.8.0", "@types/node": "^18.14.6",
"eslint-config-airbnb": "^18.1.0", "@types/react": "18",
"eslint-plugin-import": "^2.20.2", "@types/react-dom": "18",
"eslint-plugin-jsx-a11y": "^6.2.3", "babel-plugin-import": "^1.13.1",
"eslint-plugin-react": "^7.19.0", "react-scripts": "^5.0.1",
"eslint-plugin-react-hooks": "^2.5.1", "semantic-release": "^20.1.1",
"husky": "^4.2.5", "typescript": "^4.1.2"
"semantic-release": "^15.13.24"
}, },
"husky": { "overrides": {
"hooks": { "@svgr/webpack": "$@svgr/webpack"
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
} }
} }

@ -5,10 +5,7 @@
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" /> <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" /> <meta name="theme-color" content="#000000" />
<meta <meta name="description" content="Web site created using create-react-app" />
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="logo192.png" /> <link rel="apple-touch-icon" href="logo192.png" />
<!-- <!--
manifest.json provides metadata used when your web app is installed on a manifest.json provides metadata used when your web app is installed on a
@ -24,7 +21,12 @@
work correctly both with client-side routing and a non-root public URL. work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. Learn how to configure a non-root public URL by running `npm run build`.
--> -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flag-icon-css@3.3.0/css/flag-icon.min.css" integrity="sha256-NkXMfPcpoih3/xWDcrJcAX78pHpfwxkhNj0bAf8AMTs=" crossorigin="anonymous"> <link
crossorigin="anonymous"
integrity="sha384-jjBocnsQb7zTYSozEemReuje+/6FUtVswDdIPdDMA6SVLBCt51rVkrz/V/sTnKOu"
href="https://lib.baomitu.com/flag-icon-css/3.5.0/css/flag-icon.min.css"
rel="stylesheet"
/>
<title>ServerStatus</title> <title>ServerStatus</title>
</head> </head>
<body> <body>

@ -0,0 +1 @@
@import '~antd/dist/antd.css';

@ -3,6 +3,7 @@ import "./App.css";
import intl from "react-intl-universal"; import intl from "react-intl-universal";
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import { Layout, Row, Col, Spin } from "antd"; import { Layout, Row, Col, Spin } from "antd";
import ServerRow from "./ServerRow"; import ServerRow from "./ServerRow";
require("intl/locale-data/jsonp/en.js"); require("intl/locale-data/jsonp/en.js");
@ -62,7 +63,7 @@ const App: React.FC = () => {
<div className="logo">ServerStatus</div> <div className="logo">ServerStatus</div>
</Header> </Header>
<Content style={{ background: "#fff" }}> <Content style={{ background: "#fff" }}>
<Row type="flex" justify="center"> <Row justify="center">
<Col xs={24} sm={23} md={23} lg={22} xl={20} xxl={16}> <Col xs={24} sm={23} md={23} lg={22} xl={20} xxl={16}>
{initDone ? ( {initDone ? (
<Spin size="large" spinning={!isOnline} tip="Loading..."> <Spin size="large" spinning={!isOnline} tip="Loading...">

@ -1,6 +1,15 @@
/* eslint-disable no-param-reassign */
/* eslint-disable no-unused-vars */
/* eslint-disable camelcase */
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import React, { ReactNode } from 'react'; import React, { ReactNode } from 'react';
import { Row, Col, Tag, Progress, Tooltip, Alert } from 'antd'; import {
Row, Col, Progress, Tooltip, Alert,
} from 'antd';
import {
CheckCircleFilled,
WarningFilled
} from '@ant-design/icons';
interface RawData { interface RawData {
name: string; name: string;
@ -28,133 +37,155 @@ interface SergateData {
updated?: string; updated?: string;
} }
const resGutter = { xs: 8, sm: 16, md: 24, lg: 32 };
function onlineTag(online: boolean, label: string): React.ReactElement { function onlineTag(online: boolean, label: string): React.ReactElement {
return <Tag color={ online ? '#87d068' : '#f50'}>{ online ? 'ON' : 'OFF' }</Tag> //return <Tag color={online ? '#87d068' : '#f50'}>{online ? 'O N' : 'OFF'}</Tag>;
return online ? <CheckCircleFilled /> : <WarningFilled />;
} }
function transUptime(uptime: string): string { function transUptime(uptime: string): string {
uptime = uptime || ''; uptime = uptime || '';
return uptime.replace('days', intl.get('DAYS')); return uptime.replace(/days|day/, intl.get('DAYS'));
} }
function networkUnit(network: number): string { function networkUnit(network: number): string {
network = network || 0; network = network || 0;
if (network < 1000) { if (network < 1000) {
return network.toFixed(0) + 'B'; return `${network.toFixed(0)}B`;
} else if (network < 1000*1000) { } if (network < 1000 * 1000) {
return (network / 1000).toFixed(0) + 'K'; return `${(network / 1000).toFixed(0)}K`;
} else {
return (network / 1000 / 1000).toFixed(0) + 'M';
} }
return `${(network / 1000 / 1000).toFixed(0)}M`;
} }
function bytesToSize(bytes: number, precision: number = 1, si: number = 0) { function bytesToSize(bytes: number, precision: number = 1, si: number = 0) {
const kilobyte = si === 0 ? 1024 : 1000; const kilobyte = si === 0 ? 1024 : 1000;
const megabyte = kilobyte * kilobyte; const megabyte = kilobyte * kilobyte;
const gigabyte = megabyte * kilobyte; const gigabyte = megabyte * kilobyte;
const terabyte = gigabyte * kilobyte; const terabyte = gigabyte * kilobyte;
bytes = bytes || 0; bytes = bytes || 0;
bytes *= 1024 bytes *= 1024;
if ( bytes >= 0 && bytes < kilobyte) { if (bytes >= 0 && bytes < kilobyte) {
return bytes + 'B'; return `${bytes}B`;
} }
if (bytes >= kilobyte && bytes < megabyte) { if (bytes >= kilobyte && bytes < megabyte) {
return (bytes / kilobyte).toFixed(precision) + 'K'; return `${(bytes / kilobyte).toFixed(precision)}K`;
} }
if (bytes >= megabyte && bytes < gigabyte) { if (bytes >= megabyte && bytes < gigabyte) {
return (bytes / megabyte).toFixed(precision) + 'M'; return `${(bytes / megabyte).toFixed(precision)}M`;
} }
if (bytes >= gigabyte && bytes < terabyte) { if (bytes >= gigabyte && bytes < terabyte) {
return (bytes / gigabyte).toFixed(precision) + 'G'; return `${(bytes / gigabyte).toFixed(precision)}G`;
} }
return (bytes / terabyte).toFixed(precision) + 'T'; return `${(bytes / terabyte).toFixed(precision)}T`;
} }
function memTips(props: RawData): ReactNode { function memTips(props: RawData): ReactNode {
const { memory_used, memory_total, swap_used, swap_total } = props; const {
return (<dl> memory_used, memory_total, swap_used, swap_total,
<dt>Mem:</dt> } = props;
<dd>{bytesToSize(memory_used)}/{bytesToSize(memory_total)}</dd> return (
<dt>Swap:</dt> <dl>
<dd>{bytesToSize(swap_used)}/{bytesToSize(swap_total)}</dd> <dt>Mem:</dt>
</dl>); <dd>
{bytesToSize(memory_used)}
/
{bytesToSize(memory_total)}
</dd>
<dt>Swap:</dt>
<dd>
{bytesToSize(swap_used)}
/
{bytesToSize(swap_total)}
</dd>
</dl>
);
} }
function formatDateTime(time: Date) { function formatDateTime(time: Date) {
const year = time.getFullYear(); const year = time.getFullYear();
const month = ((time.getMonth() + 1) + '').padStart(2, '0'); const month = (`${time.getMonth() + 1}`).padStart(2, '0');
const day = (time.getDate() + '').padStart(2, '0'); const day = (`${time.getDate()}`).padStart(2, '0');
const hour = (time.getHours() + '').padStart(2, '0'); const hour = (`${time.getHours()}`).padStart(2, '0');
const minute = (time.getMinutes() + '').padStart(2, '0'); const minute = (`${time.getMinutes()}`).padStart(2, '0');
const second = (time.getSeconds() + '').padStart(2, '0'); const second = (`${time.getSeconds()}`).padStart(2, '0');
return `${year}-${month}-${day} ${hour}:${minute}:${second}`; return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
} }
const Flag: React.FC<{ loc: string}> = ({ loc }) => ( interface FlagProps {
<i className={`flag-icon flag-icon-${loc.toLowerCase()}`}></i> loc: string
) }
const Flag: React.FC<FlagProps> = ({ loc }: FlagProps) => (
<i className={`flag-icon flag-icon-${loc.toLowerCase()}`} />
);
const ServerRow: React.FC<SergateData> = (props) => { const ServerRow: React.FC<SergateData> = (props: SergateData) => {
let { servers, updated } = props; let { servers, updated } = props;
servers = servers || []; servers = servers || [];
updated = updated || '0'; updated = updated || '0';
let updatedInt = parseInt(updated) * 1000; const updatedInt = parseInt(updated, 10) * 1000;
let updatedTime = formatDateTime(new Date(updatedInt)); const updatedTime = formatDateTime(new Date(updatedInt));
let idx = 1;
return (<div className="sergate">
<Row className="sr-head" type="flex" justify="space-around" gutter={8}> return (
<Col xs={3} sm={3} md={1} lg={1}>IPv4</Col> <div className="sergate">
<Col xs={0} sm={0} md={0} lg={1}>IPv6</Col> <Row className="sr-head" justify="space-around" gutter={10}>
<Col xs={3} sm={3} md={3} lg={2}>{intl.get('NAME')}</Col> <Col xs={3} sm={3} md={1} lg={1}>IPv4</Col>
<Col xs={3} sm={3} md={2} lg={2}>{intl.get('TYPE')}</Col> <Col xs={0} sm={0} md={1} lg={1}>IPv6</Col>
<Col xs={3} sm={2} md={2} lg={2}>{intl.get('LOC')}</Col> <Col xs={5} sm={4} md={2} lg={2}>{intl.get('NAME')}</Col>
<Col xs={3} sm={4} md={3} lg={2}>{intl.get('UPTIME')}</Col> <Col xs={0} sm={2} md={2} lg={2}>{intl.get('TYPE')}</Col>
<Col xs={0} sm={0} md={0} lg={2}>{intl.get('LOAD')}</Col> <Col xs={2} sm={2} md={1} lg={1}>{intl.get('LOC')}</Col>
<Col xs={0} sm={0} md={4} lg={3}>{intl.get('NETWORK')}</Col> <Col xs={4} sm={4} md={3} lg={2}>{intl.get('UPTIME')}</Col>
<Col xs={3} sm={3} md={3} lg={3}>{intl.get('CPU')}</Col> <Col xs={0} sm={0} md={0} lg={1}>{intl.get('LOAD')}</Col>
<Col xs={3} sm={3} md={3} lg={3}>{intl.get('RAM')}</Col> <Col xs={0} sm={0} md={5} lg={4}>{intl.get('NETWORK')}</Col>
<Col xs={3} sm={3} md={3} lg={3}>{intl.get('HDD')}</Col> <Col xs={3} sm={3} md={3} lg={3}>{intl.get('CPU')}</Col>
</Row> <Col xs={3} sm={3} md={3} lg={3}>{intl.get('RAM')}</Col>
{servers && servers.length > 0 ? servers.map(server => ( <Col xs={4} sm={3} md={3} lg={3}>{intl.get('HDD')}</Col>
<Row key={server.host} className="sr-body" type="flex" justify="center" gutter={resGutter}>
<Col xs={3} sm={3} md={1} lg={1}>{ onlineTag(server.online4, 'IPv4') }</Col>
<Col xs={0} sm={0} md={0} lg={1}>{ onlineTag(server.online6, 'IPv6') }</Col>
<Col xs={3} sm={3} md={3} lg={2}>{ server.host }</Col>
<Col xs={3} sm={3} md={2} lg={2}>{ server.type }</Col>
<Col xs={3} sm={2} md={2} lg={2}><Flag loc={ server.location } /></Col>
<Col xs={3} sm={4} md={3} lg={2}>{ transUptime(server.uptime) }</Col>
<Col xs={0} sm={0} md={0} lg={2}>{ server.load }</Col>
<Col xs={0} sm={0} md={4} lg={3}>{ networkUnit(server.network_rx) }↓ | ↑{ networkUnit(server.network_tx)}</Col>
<Col xs={3} sm={3} md={3} lg={3}>
<Progress strokeWidth={12} percent={server.cpu} status="active" />
</Col>
<Col xs={3} sm={3} md={3} lg={3}>
<Tooltip placement="left" title={memTips(server)}>
<Progress strokeWidth={12} percent={parseFloat((server.memory_used / server.memory_total * 100).toFixed(1))} status="active" />
</Tooltip>
</Col>
<Col xs={3} sm={3} md={3} lg={3}>
<Tooltip placement="left" title={bytesToSize(server.hdd_used*1024) + '/' + bytesToSize(server.hdd_total*1024)}>
<Progress strokeWidth={12} percent={parseFloat((server.hdd_used / server.hdd_total * 100).toFixed(1))} status="active" />
</Tooltip>
</Col>
</Row> </Row>
)) : <Alert {servers && servers.length > 0 ? servers.map((server) => (
showIcon={true} <Row key={server.host} className="sr-body" justify="space-around" gutter={10}>
type="info" <span className="col-num">{idx++}</span>
message={intl.get('LOADING')} <Col xs={3} sm={3} md={1} lg={1}>{onlineTag(server.online4, 'IPv4')}</Col>
description={intl.get('WAIT')} <Col xs={0} sm={0} md={1} lg={1}>{onlineTag(server.online6, 'IPv6')}</Col>
/>} <Col xs={5} sm={4} md={2} lg={2}>{server.host || server.name}</Col>
{updatedInt > 0 && <Alert className="lastUpdated" type="info" message={intl.get('LAST_UPDATE', {updatedTime})} />} <Col xs={0} sm={2} md={2} lg={2}>{server.type}</Col>
</div>) <Col xs={2} sm={2} md={1} lg={1}><Flag loc={server.location} /></Col>
}; <Col xs={4} sm={4} md={3} lg={2}>{transUptime(server.uptime)}</Col>
<Col xs={0} sm={0} md={0} lg={1}>{server.load}</Col>
<Col xs={0} sm={0} md={5} lg={4}>
{networkUnit(server.network_rx)}
↓ | ↑
{networkUnit(server.network_tx)}
</Col>
<Col xs={3} sm={3} md={3} lg={3}>
<Progress className="sg-progress" strokeLinecap="square" strokeWidth={12} percent={server.cpu} status="active" />
</Col>
<Col xs={3} sm={3} md={3} lg={3}>
<Tooltip placement="left" title={memTips(server)}>
<Progress className="sg-progress" strokeLinecap="square" strokeWidth={12} percent={parseFloat(((server.memory_used / server.memory_total) * 100).toFixed(1))} status="active" />
</Tooltip>
</Col>
<Col xs={4} sm={3} md={3} lg={3}>
<Tooltip placement="left" title={`${bytesToSize(server.hdd_used * 1024)}/${bytesToSize(server.hdd_total * 1024)}`}>
<Progress className="sg-progress" strokeLinecap="square" strokeWidth={12} percent={parseFloat(((server.hdd_used / server.hdd_total) * 100).toFixed(1))} status="active" />
</Tooltip>
</Col>
</Row>
)) : (
<Alert
showIcon
type="info"
message={intl.get('LOADING')}
description={intl.get('WAIT')}
/>
)}
{updatedInt > 0 && <Alert className="lastUpdated" type="info" message={intl.get('LAST_UPDATE', { updatedTime })} />}
</div>
);
};
export default ServerRow; export default ServerRow;

@ -1,7 +1,6 @@
body { body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
'Segoe UI Emoji', 'Segoe UI Symbol';
} }
.logo { .logo {
color: #fff; color: #fff;
@ -11,9 +10,15 @@ body {
.sergate { .sergate {
margin: 16px 0; margin: 16px 0;
} }
.sergate .ant-row {
position: relative;
flex-wrap: nowrap;
}
.sergate .sg-progress .ant-progress-outer {
margin-right: calc(-3em - 8px);
padding-right: calc(3em + 8px);
}
.sr-head { .sr-head {
font-weight: bold;
padding-top: 8px; padding-top: 8px;
padding-bottom: 8px; padding-bottom: 8px;
} }
@ -26,12 +31,28 @@ body {
padding-bottom: 8px; padding-bottom: 8px;
border-top: 1px solid #ebebeb; border-top: 1px solid #ebebeb;
} }
.col-num {
position: absolute;
width: 16px;
line-height: 40px;
left: -16px;
top: 0;
text-align: right;
}
.sergate .lastUpdated { .sergate .lastUpdated {
margin-top: 16px; margin-top: 16px;
text-align: center; text-align: center;
} }
.sergate .anticon-check-circle {
color: #389e0d;
}
.sergate .anticon-warning {
color: #cf1322;
}
.ant-layout .footer { .ant-layout .footer {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
@ -54,19 +75,29 @@ body {
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.logo {
text-align: center;
}
.sr-head { .sr-head {
font-size: 0.8rem; font-size: 0.8rem;
} }
.sr-body .ant-col { .sr-body .ant-col {
font-size: 0.8rem; font-size: 0.8rem;
} }
.sergate .ant-tag {
margin-right: 0;
}
}
@media (max-width: 900px) {
.sergate .ant-col .ant-progress-outer { .sergate .ant-col .ant-progress-outer {
display: none; display: none;
} }
.sergate .ant-col .ant-progress-text { .sergate .ant-col .ant-progress-text {
margin-left: 0; margin-left: 0;
} }
.sergate .ant-tag {
margin-right:0; .sr-head {
font-size: 12px;
} }
} }

@ -1,12 +1,17 @@
import React from 'react'; import { StrictMode } from 'react';
import ReactDOM from 'react-dom'; import { createRoot } from 'react-dom/client';
import './index.css'; import './index.css';
import App from './App'; import App from './App';
import * as serviceWorker from './serviceWorker'; // import reportWebVitals from './reportWebVitals';
ReactDOM.render(<App />, document.getElementById('root')); const el = document.getElementById('root');
if (el === null) {
throw new Error('root container missing in index.html');
}
const root = createRoot(el);
root.render(<StrictMode><App /></StrictMode>);
// If you want your app to work offline and load faster, you can change // If you want to start measuring performance in your app, pass a function
// unregister() to register() below. Note this comes with some pitfalls. // to log results (for example: reportWebVitals(console.log))
// Learn more about service workers: https://bit.ly/CRA-PWA // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
serviceWorker.unregister(); // reportWebVitals();

@ -1,143 +0,0 @@
// This optional code is used to register a service worker.
// register() is not called by default.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a page, after all the
// existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.
// To learn more about the benefits of this model and instructions on how to
// opt-in, read https://bit.ly/CRA-PWA
const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);
type Config = {
onSuccess?: (registration: ServiceWorkerRegistration) => void;
onUpdate?: (registration: ServiceWorkerRegistration) => void;
};
export function register(config?: Config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(
(process as { env: { [key: string]: string } }).env.PUBLIC_URL,
window.location.href
);
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
return;
}
window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) {
// This is running on localhost. Let's check if a service worker still exists or not.
checkValidServiceWorker(swUrl, config);
// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://bit.ly/CRA-PWA'
);
});
} else {
// Is not localhost. Just register service worker
registerValidSW(swUrl, config);
}
});
}
}
function registerValidSW(swUrl: string, config?: Config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
if (installingWorker == null) {
return;
}
installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) {
// At this point, the updated precached content has been fetched,
// but the previous service worker will still serve the older
// content until all client tabs are closed.
console.log(
'New content is available and will be used when all ' +
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
);
// Execute callback
if (config && config.onUpdate) {
config.onUpdate(registration);
}
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
console.log('Content is cached for offline use.');
// Execute callback
if (config && config.onSuccess) {
config.onSuccess(registration);
}
}
}
};
};
})
.catch(error => {
console.error('Error during service worker registration:', error);
});
}
function checkValidServiceWorker(swUrl: string, config?: Config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl)
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type');
if (
response.status === 404 ||
(contentType != null && contentType.indexOf('javascript') === -1)
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => {
window.location.reload();
});
});
} else {
// Service worker found. Proceed as normal.
registerValidSW(swUrl, config);
}
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.'
);
});
}
export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister();
});
}
}

@ -1,25 +1,26 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es5",
"lib": [ "lib": [
"dom", "dom",
"dom.iterable", "dom.iterable",
"esnext" "esnext"
], ],
"allowJs": true, "allowJs": true,
"skipLibCheck": true, "skipLibCheck": true,
"esModuleInterop": true, "esModuleInterop": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"strict": true, "strict": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"module": "esnext", "noFallthroughCasesInSwitch": true,
"moduleResolution": "node", "module": "esnext",
"resolveJsonModule": true, "moduleResolution": "node",
"isolatedModules": true, "resolveJsonModule": true,
"noEmit": true, "isolatedModules": true,
"jsx": "react" "noEmit": true,
}, "jsx": "react-jsx"
"include": [ },
"src" "include": [
] "src"
} ]
}

Loading…
Cancel
Save