Skip to content

Commit

Permalink
server change bug squash, time slice button fix on server change
Browse files Browse the repository at this point in the history
  • Loading branch information
echo-dave committed Nov 20, 2023
1 parent 353fc23 commit 4f5cf00
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/getWebData.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const getWebData = (hostname, io) => {
// monitoringState[hostname] = response.length
// }
}
// if (response[0] !== 'ok') monitoringState[hostname] = 0
if (response[0] !== 'ok') monitoringState[hostname] = 0
})
}
dataLoop()
Expand Down
4 changes: 2 additions & 2 deletions clientWeb/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@
<meta name="description" content="Nodesysmon a simple system monitor" />
</svelte:head>
<div id="wrap" class="no-border">
<Header bind:metrics {subscribe} {unsubscribe} />
<Header bind:metrics bind:hostname {subscribe} {unsubscribe} {minutes} />

<div id="chartTimeScaleButtons" class="no-border">
<div class="left no-border">
<div id="time-buttons" class="no-border">
{#each time as timeElement}
<TimeScaleButton bind:minutes bind:hostname time={timeElement} {changeDataLength} />
<TimeScaleButton bind:minutes time={timeElement} {changeDataLength} />
{/each}
</div>
<span id="lineCharInfo">History for the last {minutes} minutes</span>
Expand Down
3 changes: 2 additions & 1 deletion clientWeb/src/routes/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
export let metrics
export let subscribe
export let unsubscribe
export let minutes
export let hostname
let hostmenutoggle = false
let currentHost
Expand Down Expand Up @@ -32,7 +33,7 @@
unsubscribe(currentHost)
console.log('unsub: ', currentHost)
subscribe(name)
let resp = await fetch(`/api/serverchange/${name}`)
let resp = await fetch(`/api/serverchange/${name}/${minutes * 30}`)
if (!resp.ok) throw new Error(resp.status)
resp = await resp.json()
resp.map((el) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nodesysmon",
"version": "0.7.1",
"version": "0.7.2",
"description": "Node simple system monitoring",
"main": "nodesysmon.js",
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export default async (thresholds) => {
res.status(200).json(data)
})

app.get('/api/serverchange/:host', async (req, res) => {
const data = await getHistory(300, req.params.host)
app.get('/api/serverchange/:host/:count', async (req, res) => {
const data = await getHistory(req.params.count, req.params.host)
if (monitoringState[req.params.host]) {
monitoringState[req.params.host] += 1
console.log('change: ', monitoringState)
Expand Down

0 comments on commit 4f5cf00

Please sign in to comment.