@shardus/monitor-client
Advanced tools
Comparing version 2.5.3 to 2.5.4
{ | ||
"name": "@shardus/monitor-client", | ||
"version": "2.5.3", | ||
"description": "", | ||
"main": "entry.js", | ||
"scripts": { | ||
"release": "np --no-tests --no-yarn", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://gitlab.com/shardus/enterprise/monitor-client.git" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"np": "^7.6.1", | ||
"prettier": "^2.7.1" | ||
} | ||
} | ||
"name": "@shardus/monitor-client", | ||
"version": "2.5.4", | ||
"description": "", | ||
"main": "entry.js", | ||
"scripts": { | ||
"release": "np --no-tests --no-yarn", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://gitlab.com/shardus/enterprise/monitor-client.git" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"np": "^7.6.1", | ||
"prettier": "^2.7.1" | ||
} | ||
} |
const INTERVAL = 10_000 | ||
const fetchChanges = async () => { | ||
@@ -8,5 +9,7 @@ const data = [] | ||
const appDataResponse = await requestWithToken('/api/app-versions') | ||
const appDataResponse = await requestWithToken(`${monitorServerUrl}/app-versions`) | ||
const appDataList = appDataResponse.data | ||
console.log('appDataList', appDataList) | ||
for(const appVersion in appDataList) { | ||
@@ -57,2 +60,3 @@ const count = appDataList[appVersion].nodeCount | ||
options: { | ||
animation: false, | ||
plugins: { | ||
@@ -59,0 +63,0 @@ tooltip: { |
@@ -9,3 +9,3 @@ var request = axios.default | ||
var monitorServerUrl = server.slice(-1) === '/' ? server + 'api' : server + '/api' | ||
// var monitorServerUrl = `http://54.93.204.116:3000/api` | ||
// var monitorServerUrl = `http://139.144.35.86:3000/api` | ||
@@ -12,0 +12,0 @@ console.log('monitor server url', monitorServerUrl) |
const socket = io() | ||
socket.on('connection', async () => { | ||
console.log('connection is made') | ||
socket.on('connection', async (err, data) => { | ||
console.log('connection is made...', err, data) | ||
}) | ||
@@ -46,5 +46,5 @@ | ||
if (maxHistory) maxHistory = parseInt(maxHistory) | ||
else maxHistory = 2880 // last 48 hours | ||
socket.on('connect', async () => { | ||
console.log(`Connected as ${socket.id}`) | ||
else maxHistory = 1440 // last 24 hours | ||
socket.on('connect', async (e, data) => { | ||
console.log(`Connected as ${socket.id}`, e, data) | ||
}) | ||
@@ -55,10 +55,10 @@ socket.on('old-data', async (data) => { | ||
let oldEventLines = data.split('\n') | ||
let startLineNumber = 0 | ||
for (let i = 0; i < oldEventLines.length; i++) { | ||
let line = oldEventLines[i] | ||
let splitted = line.split(" ") | ||
if (splitted[4] === 'started') { | ||
startLineNumber = i | ||
} | ||
} | ||
// for (let i = 0; i < oldEventLines.length; i++) { | ||
// let line = oldEventLines[i] | ||
// let splitted = line.split(" ") | ||
// if (splitted[4] === 'started') { | ||
// startLineNumber = i | ||
// } | ||
// } | ||
let startLineNumber = oldEventLines.length - maxHistory | ||
oldEventLines = oldEventLines.slice(startLineNumber + 1) | ||
@@ -79,2 +79,3 @@ oldEventLines = oldEventLines.filter(line => line.split(" ").length === 9) | ||
let cycle = parseInt(splittedData[8]) | ||
if (this.validateIPV4(ip) === false) continue | ||
let event = { | ||
@@ -112,2 +113,3 @@ name, | ||
} | ||
if (this.validateIPV4(ip) === false) return | ||
this.history.push(event) | ||
@@ -117,6 +119,6 @@ this.updateChart() | ||
console.log('Sync page loaded!') | ||
console.log('Node history timeline') | ||
let data = [this.trace] | ||
this.layout = { | ||
title: 'Node Sync Timeline', | ||
title: 'Nodes History', | ||
barmode: 'stack', | ||
@@ -132,2 +134,5 @@ xaxis: { | ||
}, | ||
yaxis: { | ||
automargin: true | ||
} | ||
}; | ||
@@ -143,2 +148,12 @@ | ||
}, | ||
// a function to check if the input string is a valid IPV4 ip address | ||
validateIPV4(ip) { | ||
let ipArr = ip.split('.') | ||
if (ipArr.length !== 4) return false | ||
for (let i = 0; i < ipArr.length; i++) { | ||
let num = parseInt(ipArr[i]) | ||
if (Number.isNaN(num) || num < 0 || num > 255) return false | ||
} | ||
return true | ||
}, | ||
async updateChart() { | ||
@@ -153,2 +168,3 @@ console.log('updating chart') | ||
async getReport() { | ||
console.log(this.history.map(event => event.ip + "__" + event.port)) | ||
this.yValue = this.history.map(event => { | ||
@@ -155,0 +171,0 @@ return `${event.ip}:${event.port}` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45
5108
2353337