Browse Source

error output ok

master
lefteris 4 years ago
parent
commit
96fb3bbd80
  1. 153
      src/components/doclive/runLlo.vue

153
src/components/doclive/runLlo.vue

@ -141,6 +141,26 @@
Clear Clear
</button> </button>
</div> </div>
<div class="input-group-append">
<button
class="btn btn-outline-warning"
round
type="button"
@click="Hidelog"
>
Hide
</button>
</div>
<div class="input-group-append">
<button
class="btn btn-outline-warning"
round
type="button"
@click="Refresh"
>
Force Refresh
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -181,7 +201,7 @@
</b-row> </b-row>
</div> </div>
<!-- col --> <!-- col -->
<div v-if="onEvent" class="logs"> <div v-show="onEvent" class="logs">
<h2>ON-event logs for all apps (Simplified - ALL)</h2> <h2>ON-event logs for all apps (Simplified - ALL)</h2>
<div class="input-group-append"> <div class="input-group-append">
<button <button
@ -195,16 +215,15 @@
</div> </div>
<div id="applogs" class="table2"> <div id="applogs" class="table2">
<vuetable <vuetable
ref="vuetable" ref="apptable"
:api-mode="false" :api-mode="false"
:data="localData"
:fields="fields" :fields="fields"
:css="css.table" :css="css.table"
> >
</vuetable> </vuetable>
</div> </div>
</div> </div>
<div v-if="mongoraw" class="logs"> <div v-show="mongoraw" class="logs">
<h2>ON-event logs for MongoDB only (RAW)</h2> <h2>ON-event logs for MongoDB only (RAW)</h2>
<div class="input-group-append"> <div class="input-group-append">
<button <button
@ -218,16 +237,15 @@
</div> </div>
<div id="mongologs" class="table2"> <div id="mongologs" class="table2">
<vuetable <vuetable
ref="vuetable" ref="mongotable"
:api-mode="false" :api-mode="false"
:data="mongodata"
:fields="fields2" :fields="fields2"
:css="css.table" :css="css.table"
> >
</vuetable> </vuetable>
</div> </div>
</div> </div>
<div v-if="raw" class="logs"> <div v-show="raw" class="logs">
<h2>ON-event logs (RAW - ALL)</h2> <h2>ON-event logs (RAW - ALL)</h2>
<div class="input-group-append"> <div class="input-group-append">
<button <button
@ -241,9 +259,8 @@
</div> </div>
<div id="rawlogs" class="table2"> <div id="rawlogs" class="table2">
<vuetable <vuetable
ref="vuetable" ref="rawtable"
:api-mode="false" :api-mode="false"
:data="rawdata"
:fields="fields3" :fields="fields3"
:css="css.table" :css="css.table"
> >
@ -280,7 +297,7 @@ export default {
{ {
name: "message", name: "message",
title: "Log", title: "Log",
width: "10%", width: "20%",
visible: true, visible: true,
dataClass: "center aligned", dataClass: "center aligned",
}, },
@ -314,16 +331,25 @@ export default {
name: "t", name: "t",
title: "Timestamp", title: "Timestamp",
visible: true, visible: true,
width: "30%",
}, },
{ {
name: "s", name: "s",
title: "Severity", title: "Severity",
visible: true, visible: true,
width: "5%",
},
{
name: "attr",
title: "Attributes",
width: "40%",
}, },
{ {
name: "c", name: "c",
title: "Components", title: "Components",
titleClass: "center aligned", titleClass: "center aligned",
width: "10%",
}, },
{ {
name: "id", name: "id",
@ -333,15 +359,14 @@ export default {
name: "ctx", name: "ctx",
visible: true, visible: true,
title: "Context", title: "Context",
width: "5%",
}, },
{ {
name: "msg", name: "msg",
title: "Message", title: "Message",
width: "10%",
}, },
{
name: "attr",
title: "Attributes",
},
// 'timestamp', // 'timestamp',
// 'type', // 'type',
// 'process_id', // 'process_id',
@ -351,18 +376,29 @@ export default {
{ {
name: "container_id", name: "container_id",
title: "Container_id", title: "Container_id",
width: "30%",
},
{
name: "log",
title: "Log",
width: "30%",
}, },
{ {
name: "container_name", name: "container_name",
title: "Container Name", title: "Container Name",
width: "15%",
}, },
{ {
name: "source", name: "source",
title: "Source", title: "Source",
width: "5%",
}, },
{ {
name: "log", name: "time",
title: "Log", title: "Time",
width: "20%",
}, },
], ],
log_path: [], log_path: [],
@ -391,14 +427,42 @@ export default {
code: [], code: [],
logdata: [], logdata: [],
mongodata: [], mongodata: [],
mongoerror: [],
mongoout: [],
localData: [], localData: [],
localDataError: [],
localDataOut: [],
rawdata: [], rawdata: [],
rawout: [],
rawerror: [],
mongoraw: false, mongoraw: false,
allraw: false, allraw: false,
raw: false, raw: false,
}; };
}, },
methods: { methods: {
Refresh() {
this.checklogs();
this.$refs.apptable.reload();
},
checklogs() {
if (this.logcheck.error && !this.logcheck.output) {
// console.log("Inside check");
this.$refs.apptable.setData(this.localDataError);
this.$refs.mongotable.setData(this.mongoerror);
this.$refs.rawtable.setData(this.rawerror);
} else if (this.logcheck.error && this.logcheck.output) {
// console.log("Inside check default");
this.$refs.apptable.setData(this.localData);
this.$refs.mongotable.setData(this.mongodata);
this.$refs.rawtable.setData(this.rawdata);
} else if (!this.logcheck.error && this.logcheck.output) {
this.$refs.apptable.setData(this.localDataOut);
this.$refs.mongotable.setData(this.mongoout);
this.$refs.rawtable.setData(this.rawout);
}
},
scroll(param) { scroll(param) {
if (param == 1) { if (param == 1) {
var container = this.$el.querySelector("#applogs"); var container = this.$el.querySelector("#applogs");
@ -460,11 +524,30 @@ export default {
allrawf() { allrawf() {
this.raw = true; this.raw = true;
}, },
Clearlog() { Hidelog() {
this.onEvent = false; this.onEvent = false;
this.mongoraw = false; this.mongoraw = false;
this.raw = false; this.raw = false;
}, },
Clearlog() {
// this.onEvent = false;
// this.mongoraw = false;
// this.raw = false;
this.localData = [];
this.localDataError = [];
this.localDataOut = [];
this.rawdata = [];
this.rawout = [];
this.rawerror = [];
this.mongodata = [];
this.mongoout = [];
this.mongoerror = [];
this.Refresh();
},
logview(item) { logview(item) {
//console.log('path ' + JSON.stringify(item)) //console.log('path ' + JSON.stringify(item))
if (this.logcheck.log) { if (this.logcheck.log) {
@ -659,7 +742,7 @@ export default {
created() { created() {
//var logintoken = new URL(location.href).searchParams.get("token"); //var logintoken = new URL(location.href).searchParams.get("token");
var logintoken = new URL( var logintoken = new URL(
"https://api-client.swarmlab.io:8088/?token=117ec26cc66cfba79b048cec800a610b00922b2a" "https://api-client.swarmlab.io:8088/?token=daa93d51084c246f1670222d702732345d68f6ec"
).searchParams.get("token"); ).searchParams.get("token");
this.logintoken = logintoken; this.logintoken = logintoken;
// === We get the user + check for the token if exists // === We get the user + check for the token if exists
@ -910,22 +993,32 @@ export default {
// Lefos --- socket event to add the data to the right tables // Lefos --- socket event to add the data to the right tables
async logsend(val) { async logsend(val) {
// ==== LEFOS // ==== LEFOS
console.log(" socket message " + JSON.stringify(val)); // console.log(" socket message " + JSON.stringify(val));
// var log = val.log; // var log = val.log;
// console.log(" LOG: " + JSON.parse(JSON.stringify(log))); // console.log(" LOG: " + JSON.parse(JSON.stringify(log)));
//Check which data array to put as data to the tables
this.checklogs();
var log = store.dispatch("pipelineLLO/addlog", { var log = store.dispatch("pipelineLLO/addlog", {
log: val, log: val,
}); });
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 // Change color of source for ALL RAW table to be able to see the error logs easy
if (val.source == "stdout") { if (val.source == "stdout") {
val.source = '<div class="outtype" >' + val.source + "</div>"; val.source = '<div class="outtype" >' + val.source + "</div>";
this.rawout.push(val);
} else { } else {
val.source = '<div class="errtype" >' + val.source + "</div>"; val.source = '<div class="errtype" >' + val.source + "</div>";
this.rawerror.push(val);
} }
val.container_id = '<div class="conid">' + val.container_id + "</div>";
this.rawdata.push(val); this.rawdata.push(val);
@ -934,18 +1027,23 @@ export default {
var test = JSON.parse(val.log); var test = JSON.parse(val.log);
if (test.type == "out") { if (test.type == "out") {
test.type = '<div class="outtype" >' + test.type + "</div>"; test.type = '<div class="outtype" >' + test.type + "</div>";
this.localDataOut.push(test);
} else if (test.type == "err") { } else if (test.type == "err") {
test.type = '<div class="errtype" >' + test.type + "</div>"; test.type = '<div class="errtype" >' + test.type + "</div>";
this.localDataError.push(test);
} }
this.localData.push(test); this.localData.push(test);
} //check if the log is by the mongodb and change color } //check if the log is by the mongodb and change color
else if (val.container_name == "/mongo") { else if (val.container_name == "/mongo") {
// ========== push data for raw table ============ // ========== push data for raw table ============
var tmp = JSON.parse(val.log); var tmp = JSON.parse(val.log);
if (tmp.s == "I") { if (tmp.s == "I") {
tmp.s = '<div class="outtype" >' + tmp.s + "</div>"; tmp.s = '<div class="outtype" >' + tmp.s + "</div>";
this.mongoout.push(tmp);
} else { } else {
tmp.s = '<div class="errtype" >' + tmp.s + "</div>"; tmp.s = '<div class="errtype" >' + tmp.s + "</div>";
this.mongoerror.push(tmp);
} }
tmp.t = '<div class="mongod">' + JSON.stringify(tmp.t) + "</div>"; tmp.t = '<div class="mongod">' + JSON.stringify(tmp.t) + "</div>";
this.mongodata.push(tmp); this.mongodata.push(tmp);
@ -965,6 +1063,8 @@ export default {
process_id: "Unknown", process_id: "Unknown",
app_name: "Mongo", app_name: "Mongo",
}; };
this.localDataOut.push(tmp);
this.localData.push(tmp); this.localData.push(tmp);
console.log("HEY " + JSON.stringify(test)); console.log("HEY " + JSON.stringify(test));
} else if (val.container_name == "/redisserver") { } else if (val.container_name == "/redisserver") {
@ -978,6 +1078,8 @@ export default {
process_id: "Unknown", process_id: "Unknown",
app_name: "redis", app_name: "redis",
}; };
this.localDataOut.push(tmp);
this.localData.push(tmp); this.localData.push(tmp);
} }
}, },
@ -988,6 +1090,7 @@ export default {
<style> <style>
.table2 { .table2 {
overflow: auto; overflow: auto;
/* overflow-anchor: none; */
max-height: 400px; max-height: 400px;
min-width: 100%; min-width: 100%;
} }
@ -1032,12 +1135,12 @@ button {
text-overflow: ellipsis; text-overflow: ellipsis;
padding: 5px; padding: 5px;
width: 120px; width: 120px;
/* position: relative; */ height: 100px;
display: inline-block; display: inline-block;
} }
.conid:hover { .conid:hover {
transition: 0.7s; transition: 0.7s;
width: 100%; width: 580px;
background-color: rgb(63, 61, 61); background-color: rgb(63, 61, 61);
color: #fff; color: #fff;
border-radius: 6px; border-radius: 6px;
@ -1048,14 +1151,14 @@ button {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
padding: 5px; padding: 5px;
width: 120px; width: 110px;
height: 100px; height: 140px;
/* position: relative; */ /* position: relative; */
display: inline-block; display: inline-block;
} }
.mongod:hover { .mongod:hover {
transition: 0.7s; transition: 0.7s;
width: 100%; width: 330px;
background-color: rgb(63, 61, 61); background-color: rgb(63, 61, 61);
color: #fff; color: #fff;
border-radius: 6px; border-radius: 6px;

Loading…
Cancel
Save