Compare commits

..

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

@ -10,16 +10,30 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v3
uses: actions/setup-node@v1
with:
node-version: 18
cache: 'npm'
node-version: '14'
check-latest: true
# - name: Cache node modules
# uses: actions/cache@v2
# env:
# cache-name: cache-node-modules
# with:
# path: ~/.npm
# key: ${{ runner.os }}-node-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-node-${{ env.cache-name }}-
# ${{ runner.os }}-node-
# ${{ runner.os }}-
- name: Install dependencies
run: npm ci
run: yarn install
- name: Build
run: npm run build
run: yarn build
- name: Rename output dir
run: mv build sergate
- name: Make zip file

1
.gitignore vendored

@ -24,3 +24,4 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
package-lock.json

@ -1,52 +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)

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

24178
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -9,9 +9,6 @@
"ant design"
],
"private": true,
"engines": {
"node": ">=18"
},
"homepage": ".",
"bugs": {
"url": "https://github.com/krwu/ServerStatus-web/issues"
@ -23,15 +20,28 @@
"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"
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.15",
"@types/node": "^12.0.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"antd": "^3.26.20",
"babel-plugin-import": "^1.13.1",
"customize-cra": "^1.0.0",
"react": "^17.0.2",
"react-app-rewired": "^2.1.6",
"react-dom": "^17.0.2",
"react-intl-universal": "^2.4.2",
"react-scripts": "4.0.3",
"typescript": "^4.1.2",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-scripts eject"
},
"eslintConfig": {
@ -42,7 +52,7 @@
},
"browserslist": {
"production": [
">5%",
">0.2%",
"not dead",
"not op_mini all"
],
@ -53,21 +63,8 @@
]
},
"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"
},
"overrides": {
"@svgr/webpack": "$@svgr/webpack"
"@semantic-release/changelog": "^6.0.0",
"@semantic-release/git": "^10.0.0",
"semantic-release": "^18.0.0"
}
}

@ -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...">

@ -4,12 +4,8 @@
import intl from 'react-intl-universal';
import React, { ReactNode } from 'react';
import {
Row, Col, Progress, Tooltip, Alert,
Row, Col, Tag, Progress, Tooltip, Alert,
} from 'antd';
import {
CheckCircleFilled,
WarningFilled
} from '@ant-design/icons';
interface RawData {
name: string;
@ -37,9 +33,12 @@ 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 ? 'O N' : 'OFF'}</Tag>;
}
function transUptime(uptime: string): string {
@ -133,45 +132,45 @@ const ServerRow: React.FC<SergateData> = (props: SergateData) => {
return (
<div className="sergate">
<Row className="sr-head" justify="space-around" gutter={10}>
<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={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={0} sm={0} md={0} lg={1}>IPv6</Col>
<Col xs={5} sm={6} md={3} lg={2}>{intl.get('NAME')}</Col>
<Col xs={0} sm={0} md={2} lg={2}>{intl.get('TYPE')}</Col>
<Col xs={3} 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>
<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" justify="space-around" gutter={10}>
<Row key={server.host} className="sr-body" type="flex" justify="center" gutter={resGutter}>
<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={5} sm={6} md={3} lg={2}>{server.host || server.name}</Col>
<Col xs={0} sm={0} md={2} lg={2}>{server.type}</Col>
<Col xs={3} 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={0} lg={2}>{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" />
<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 className="sg-progress" strokeLinecap="square" strokeWidth={12} percent={parseFloat(((server.memory_used / server.memory_total) * 100).toFixed(1))} status="active" />
<Progress 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}>
<Col xs={3} 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" />
<Progress strokeWidth={12} percent={parseFloat(((server.hdd_used / server.hdd_total) * 100).toFixed(1))} status="active" />
</Tooltip>
</Col>
</Row>

@ -10,15 +10,12 @@ body {
.sergate {
margin: 16px 0;
}
.sergate .ant-row {
.sergate .ant-row-flex {
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;
}
@ -45,14 +42,6 @@ body {
text-align: center;
}
.sergate .anticon-check-circle {
color: #389e0d;
}
.sergate .anticon-warning {
color: #cf1322;
}
.ant-layout .footer {
position: fixed;
bottom: 0;
@ -84,20 +73,13 @@ body {
.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 reportWebVitals from './reportWebVitals';
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();
reportWebVitals();

@ -0,0 +1,15 @@
import { ReportHandler } from 'web-vitals';
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

@ -0,0 +1,5 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
Loading…
Cancel
Save