Compare commits

..

No commits in common. 'master' and 'v1.1.3' have entirely different histories.

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

@ -0,0 +1,28 @@
{
"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": {
}
}

@ -1,31 +0,0 @@
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,4 +23,3 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock

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

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

@ -0,0 +1,26 @@
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,79 +1,3 @@
## [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)

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

@ -0,0 +1,2 @@
\¯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

43431
package-lock.json generated

File diff suppressed because it is too large Load Diff

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

@ -5,7 +5,10 @@
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
@ -21,12 +24,7 @@
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`.
-->
<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"
/>
<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">
<title>ServerStatus</title>
</head>
<body>

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

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

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

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

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

@ -0,0 +1,143 @@
// 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,26 +1,25 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": [
"src"
]
}

Loading…
Cancel
Save