mirror of
https://github.com/smartyellow/status.git
synced 2025-01-18 21:47:58 +00:00
Dashboard (WIP)
Signed-off-by: Romein van Buren <romein@vburen.nl>
This commit is contained in:
parent
002df5cfb1
commit
d691ca7f85
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ node_modules
|
|||||||
config.custom.js
|
config.custom.js
|
||||||
config.temp.js
|
config.temp.js
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
/gui/dashboard/build/
|
||||||
|
22
builddashboard.js
Normal file
22
builddashboard.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { build: viteBuild } = require('vite');
|
||||||
|
const { svelte } = require('@sveltejs/vite-plugin-svelte');
|
||||||
|
|
||||||
|
module.exports = () => viteBuild({
|
||||||
|
root: __dirname + '/gui/dashboard',
|
||||||
|
base: '.',
|
||||||
|
plugins: [ svelte() ],
|
||||||
|
build: {
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
assetFileNames: '[hash].[ext]',
|
||||||
|
entryFileNames: '[hash].js',
|
||||||
|
chunkFileNames: '[hash].js',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
outDir: __dirname + '/gui/dashboard/build',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports();
|
1
gui/dashboard/app.svelte
Normal file
1
gui/dashboard/app.svelte
Normal file
@ -0,0 +1 @@
|
|||||||
|
<h1>here comes the dashboard</h1>
|
12
gui/dashboard/index.html
Normal file
12
gui/dashboard/index.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Status dashboard</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="outlet"></div>
|
||||||
|
<script type="module" src="./index.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
7
gui/dashboard/index.js
Normal file
7
gui/dashboard/index.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import App from './app.svelte';
|
||||||
|
|
||||||
|
const app = new App({
|
||||||
|
target: document.getElementById('outlet'),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default app;
|
14
index.js
14
index.js
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
const { fork } = require('child_process');
|
const { fork } = require('child_process');
|
||||||
const { processOutage } = require('./lib/processoutage');
|
const { processOutage } = require('./lib/processoutage');
|
||||||
|
const buildDashboard = require('./builddashboard');
|
||||||
|
const fs = require('fs').promises;
|
||||||
|
|
||||||
const guiCluster = 'web service status';
|
const guiCluster = 'web service status';
|
||||||
const icons = {
|
const icons = {
|
||||||
@ -117,13 +119,14 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
init: ({ server, settings }) => {
|
init: async ({ server, settings }) => {
|
||||||
settings.autotestInterval = Number(settings.autotestInterval);
|
settings.autotestInterval = Number(settings.autotestInterval);
|
||||||
if (Number.isNaN(settings.autotestInterval)) {
|
if (Number.isNaN(settings.autotestInterval)) {
|
||||||
server.warn('status: settings.autotestInterval is not a number. Using default value 10.');
|
server.warn('status: settings.autotestInterval is not a number. Using default value 10.');
|
||||||
settings.autotestInterval = 10;
|
settings.autotestInterval = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await buildDashboard();
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -529,6 +532,15 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ route: '/statusdashboard',
|
||||||
|
method: 'get',
|
||||||
|
handler: async (req, res) => {
|
||||||
|
res.send(
|
||||||
|
(await fs.readFile(__dirname + '/gui/dashboard/build/index.html')).toString()
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
};
|
};
|
||||||
|
30
package.json
Normal file
30
package.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "status",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Display status dashboard",
|
||||||
|
"main": "index.js",
|
||||||
|
"directories": {
|
||||||
|
"lib": "lib"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "node builddashboard"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/smartyellow/status.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"status"
|
||||||
|
],
|
||||||
|
"author": "Romein van Buren",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/smartyellow/status/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/smartyellow/status#readme",
|
||||||
|
"devDependencies": {
|
||||||
|
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.49",
|
||||||
|
"svelte": "^3.49.0",
|
||||||
|
"vite": "^2.9.13"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user