|
|
@ -483,6 +483,14 @@ export default { |
|
|
|
console.log("User: " + data.user + " Token: " + data.token); |
|
|
|
this.$socket.client.emit("onevent", data.user); |
|
|
|
}, |
|
|
|
async IsJsonString(str) { |
|
|
|
try { |
|
|
|
JSON.parse(str); |
|
|
|
} catch (e) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
}, |
|
|
|
async checktoken(value) { |
|
|
|
try { |
|
|
|
var token = value; |
|
|
@ -744,7 +752,7 @@ export default { |
|
|
|
created() { |
|
|
|
//var logintoken = new URL(location.href).searchParams.get("token"); |
|
|
|
var logintoken = new URL( |
|
|
|
"https://api-client.swarmlab.io:8088/?token=9312e5629b22cfdc7c5ca027be3cc85f91bbdb58" |
|
|
|
"https://api-client.swarmlab.io:8088/?token=f1b58f173301b2b8d052cac205d4438d283b1e33" |
|
|
|
).searchParams.get("token"); |
|
|
|
this.logintoken = logintoken; |
|
|
|
// === We get the user + check for the token if exists |
|
|
@ -995,11 +1003,6 @@ export default { |
|
|
|
// Lefos --- socket event to add the data to the right tables |
|
|
|
async logsend(val) { |
|
|
|
// ==== LEFOS |
|
|
|
// console.log(" socket message " + JSON.stringify(val)); |
|
|
|
|
|
|
|
// var log = val.log; |
|
|
|
// console.log(" LOG: " + JSON.parse(JSON.stringify(log))); |
|
|
|
|
|
|
|
//Check which data array to put as data to the tables |
|
|
|
this.checklogs(); |
|
|
|
|
|
|
@ -1009,10 +1012,12 @@ export default { |
|
|
|
|
|
|
|
val.container_id = '<div class="conid">' + val.container_id + "</div>"; |
|
|
|
// console.log("raw before.. " + val.log); |
|
|
|
|
|
|
|
// A bit of edit to fit perfectly into the table |
|
|
|
val.log = val.log.replace(/,/g, ", "); |
|
|
|
val.log = val.log.replace(/":/g, '": '); |
|
|
|
// console.log("raw after .. " + val.log); |
|
|
|
|
|
|
|
// Change color of source for ALL RAW table to be able to see the error logs easy |
|
|
|
if (val.source == "stdout") { |
|
|
|
val.source = '<div class="outtype" >' + val.source + "</div>"; |
|
|
@ -1026,7 +1031,7 @@ export default { |
|
|
|
this.rawdata.push(val); |
|
|
|
|
|
|
|
// Check if the log is by a node_service and change color of the type field |
|
|
|
if (val.log.includes("app_name")) { |
|
|
|
if (val.tag.includes("node") && this.IsJsonString(val.log)) { |
|
|
|
var test = JSON.parse(val.log); |
|
|
|
if (test.type == "out") { |
|
|
|
test.type = '<div class="outtype" >' + test.type + "</div>"; |
|
|
@ -1037,7 +1042,7 @@ export default { |
|
|
|
} |
|
|
|
this.localData.push(test); |
|
|
|
} //check if the log is by the mongodb and change color |
|
|
|
else if (val.container_name == "/mongo") { |
|
|
|
else if (val.tag.includes("mongodb")) { |
|
|
|
// ========== push data for raw table ============ |
|
|
|
var tmp = JSON.parse(val.log); |
|
|
|
|
|
|
@ -1064,13 +1069,13 @@ export default { |
|
|
|
timestamp: time, |
|
|
|
type: "<div class= 'outtype'>out</div>", |
|
|
|
process_id: "Unknown", |
|
|
|
app_name: "Mongo", |
|
|
|
app_name: val.container_name, |
|
|
|
}; |
|
|
|
|
|
|
|
this.localDataOut.push(tmp); |
|
|
|
this.localData.push(tmp); |
|
|
|
// console.log("HEY " + JSON.stringify(test)); |
|
|
|
} else if (val.container_name == "/redisserver") { |
|
|
|
} else if (val.tag.includes("redis")) { |
|
|
|
var tmplog = val; |
|
|
|
//timestamp |
|
|
|
var time = tmplog.time; |
|
|
@ -1079,7 +1084,7 @@ export default { |
|
|
|
timestamp: time, |
|
|
|
type: "<div class= 'outtype'>out</div>", |
|
|
|
process_id: "Unknown", |
|
|
|
app_name: "redis", |
|
|
|
app_name: val.container_name, |
|
|
|
}; |
|
|
|
|
|
|
|
this.localDataOut.push(tmp); |
|
|
|