|
|
@ -483,6 +483,14 @@ export default { |
|
|
|
console.log("User: " + data.user + " Token: " + data.token); |
|
|
|
this.$socket.client.emit("onevent", data.user); |
|
|
|
}, |
|
|
|
IsJsonString(str) { |
|
|
|
try { |
|
|
|
JSON.parse(str); |
|
|
|
} catch (e) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
}, |
|
|
|
async checktoken(value) { |
|
|
|
try { |
|
|
|
var token = value; |
|
|
@ -744,7 +752,11 @@ export default { |
|
|
|
created() { |
|
|
|
//var logintoken = new URL(location.href).searchParams.get("token"); |
|
|
|
var logintoken = new URL( |
|
|
|
<<<<<<< HEAD |
|
|
|
"https://api-client.swarmlab.io:8088/?token=08b677fbc99c39e100b5b64e90e1d7d77c3e3e7c" |
|
|
|
======= |
|
|
|
"https://api-client.swarmlab.io:8088/?token=7d01aaaf1c71ab27e6041fb157c9e46077240741" |
|
|
|
>>>>>>> b797d1044cf18e8173e1cfbe39db8c644e33ccb2 |
|
|
|
).searchParams.get("token"); |
|
|
|
this.logintoken = logintoken; |
|
|
|
// === We get the user + check for the token if exists |
|
|
@ -909,36 +921,7 @@ export default { |
|
|
|
* |
|
|
|
*/ |
|
|
|
/* |
|
|
|
async adhocEmit(val) { |
|
|
|
console.log("socket from server "+JSON.stringify(val)) |
|
|
|
this.issocket = 'open' |
|
|
|
this.$wait.start('myRunInstance1'); |
|
|
|
// render begin |
|
|
|
this.tryLLO = 'on' |
|
|
|
if(this.firstbootstrap === 0 ){ |
|
|
|
await this.bootsrapllo(); |
|
|
|
this.firstbootstrap = 1 |
|
|
|
} |
|
|
|
var output = log.data.out |
|
|
|
var mydinfunction = ` |
|
|
|
<div class="row"> |
|
|
|
<b-col class="" cols="12" sm="12" md="12" > |
|
|
|
${output} |
|
|
|
</b-col> |
|
|
|
</div>` |
|
|
|
|
|
|
|
try { |
|
|
|
let divascii = document.createElement('div'); |
|
|
|
divascii.setAttribute("class", "container-fluid w-100 p-3 llotry") |
|
|
|
divascii.innerHTML = mydinfunction |
|
|
|
this.addtask(divascii); |
|
|
|
}catch (ex) { |
|
|
|
console.log(" logi error1 "+JSON.stringify(ex)) |
|
|
|
return |
|
|
|
} |
|
|
|
this.$wait.end('myRunInstance1'); |
|
|
|
}, |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
async logdata(val) { |
|
|
|
console.log(" socket from logdata " + JSON.stringify(val)); |
|
|
|
// ------------------------------------- |
|
|
@ -976,15 +959,6 @@ export default { |
|
|
|
path: item, |
|
|
|
}); |
|
|
|
} |
|
|
|
/* |
|
|
|
this.log_path_lenght[item] = ltmp.filter(function(item1){ |
|
|
|
if (item1.tailed_path === item) { |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
return false; |
|
|
|
} |
|
|
|
}).length;/ |
|
|
|
*/ |
|
|
|
//console.log('l2 '+ this.log_path_lenght[item] ) |
|
|
|
} |
|
|
|
//console.log('l1 '+ JSON.stringify(this.log_path)) |
|
|
@ -995,11 +969,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 +978,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,8 +997,9 @@ 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); |
|
|
|
test.app_name = val.container_name; |
|
|
|
if (test.type == "out") { |
|
|
|
test.type = '<div class="outtype" >' + test.type + "</div>"; |
|
|
|
this.localDataOut.push(test); |
|
|
@ -1037,7 +1009,34 @@ 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("node") && !this.IsJsonString(val.log)) { |
|
|
|
var tmp2; |
|
|
|
var type; |
|
|
|
if (val.source.includes("stdout")) { |
|
|
|
// console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
|
|
|
//type = '<div class="outtype" >' + val.source + "</div>"; |
|
|
|
tmp2 = { |
|
|
|
message: val.log, |
|
|
|
timestamp: val.time, |
|
|
|
type: '<div class="outtype" >' + "out" + "</div>", |
|
|
|
process_id: "-", |
|
|
|
app_name: val.container_name, |
|
|
|
}; |
|
|
|
this.localDataOut.push(tmp2); |
|
|
|
this.localData.push(tmp2); |
|
|
|
} else if (val.source.includes("stderr")) { |
|
|
|
//type = '<div class="outtype" >' + val.source + "</div>"; |
|
|
|
tmp2 = { |
|
|
|
message: val.log, |
|
|
|
timestamp: val.time, |
|
|
|
type: '<div class="errtype" >' + "err" + "</div>", |
|
|
|
process_id: "-", |
|
|
|
app_name: val.container_name, |
|
|
|
}; |
|
|
|
this.localDataError.push(tmp2); |
|
|
|
this.localData.push(tmp2); |
|
|
|
} |
|
|
|
} else if (val.tag.includes("mongodb") && this.IsJsonString(val.log)) { |
|
|
|
// ========== push data for raw table ============ |
|
|
|
var tmp = JSON.parse(val.log); |
|
|
|
|
|
|
@ -1064,13 +1063,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 +1078,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); |
|
|
|