From 4d02d301b4b0e3e8fa26732865084f2d62751c62 Mon Sep 17 00:00:00 2001 From: lefteris Date: Tue, 9 Nov 2021 20:57:02 +0200 Subject: [PATCH] comments runllo --- src/components/doclive/runLlo.vue | 136 ++++-------------------------- 1 file changed, 18 insertions(+), 118 deletions(-) diff --git a/src/components/doclive/runLlo.vue b/src/components/doclive/runLlo.vue index 7189d0f..ecf2c6a 100644 --- a/src/components/doclive/runLlo.vue +++ b/src/components/doclive/runLlo.vue @@ -373,10 +373,12 @@ export default { }; }, methods: { + // ανανεώνει τα λογκς των πινάκων Refresh() { this.checklogs(); this.$refs.apptable.reload(); }, + // ελέγχει τα κριτήρια για το τι λογκς να εμφανίσει checklogs() { if (this.logcheck.error && !this.logcheck.output) { // console.log("Inside check"); @@ -394,6 +396,7 @@ export default { this.$refs.rawtable.setData(this.rawout); } }, + // για το bottom scrolling στους πίνακες scroll(param) { if (param == 1) { var container = this.$el.querySelector("#applogs"); @@ -408,11 +411,13 @@ export default { // container.scrollIntoView({ behavior: "smooth" }); // } }, + // παίρνει τα στοιχεία του user βάσει του token async getuser(token) { var data = await this.checktoken(token); console.log("User: " + data.user + " Token: " + data.token); this.$socket.client.emit("onevent", data.user); }, + // έλεγχος αν η δομή είναι κατάλληλη για json μετατροπή IsJsonString(str) { try { JSON.parse(str); @@ -421,6 +426,7 @@ export default { } return true; }, + // έλεγχος του token async checktoken(value) { try { var token = value; @@ -455,22 +461,28 @@ export default { console.error(e); } }, + // + // εφμάνιση πίνακα απλοποιημένος λογκς Hotlog() { - var logintoken = store.getters["pipelineLLO/gettoken"]; + // var logintoken = store.getters["pipelineLLO/gettoken"]; //call to start on event logs this.onEvent = true; }, + // εμφάνιση πίνακα λογκς της μονγκο mongorawf() { this.mongoraw = true; }, + // εμφάνιση όλων των λογκς σε raw allrawf() { this.raw = true; }, + // απόκρυψη των πινάκων Hidelog() { this.onEvent = false; this.mongoraw = false; this.raw = false; }, + // καθαρισμός των λογκς Clearlog() { // this.onEvent = false; // this.mongoraw = false; @@ -490,6 +502,7 @@ export default { this.Refresh(); }, + // logview(item) { //console.log('path ' + JSON.stringify(item)) if (this.logcheck.log) { @@ -508,73 +521,6 @@ export default { } } }, - async selectPath(path) { - console.log("path " + JSON.stringify(path)); - var statuslenght = this.log_path_lenght[path]; - Vue.set(this.log_path_lenghtstatus, path, statuslenght); - // ------------------------------------- - // send to AdhocView to view in code - // ------------------------------------- - this.$root.$emit("playground_log_in", path); - }, - async clearLog(path) { - console.log("path " + JSON.stringify(path)); - Vue.set(this.log_path_lenght, path, 0); - Vue.set(this.log_path_lenghtstatus, path, 0); - var log = store.dispatch("pipelineLLO/rmlog", { - path: path, - }); - }, - async setFilter() { - console.log(JSON.stringify(this.search)); - - var ddd8 = JSON.stringify(this.search.datestart); - ddd8 = ddd8.replace(/"/g, ""); //" - var datestart = DateTime.fromISO(ddd8, { zone: "Europe/Athens" }); - //console.log(datestart.zoneName); //=> 'Europe/Paris' - //console.log(datestart.toString()); //=> 'Europe/Paris' - - var ddd18 = JSON.stringify(this.search.dateend); - ddd18 = ddd18.replace(/"/g, ""); //" - var dateend = DateTime.fromISO(ddd18, { zone: "Europe/Athens" }); - - var restapi = "on"; - var logrestapi = await store.dispatch("pipelineLLO/setRestapi", { - restapi: restapi, - }); - var swarmlabname = new URL(location.href).searchParams.get( - "pipelinename" - ); - var log = await store.dispatch("pipelineLLO/get_log", { - datestart: datestart.toISODate(), - dateend: dateend.toISODate(), - swarmlabname: swarmlabname, - }); - var mongolog = store.getters["pipelineLLO/getmongolog"]; - console.log("paramp " + JSON.stringify(mongolog)); - - //this.$root.$emit('GREP_on_data',mongolog.data.data) - - // list files from data - this.log_path = [...new Set(mongolog.map((item) => item.tailed_path))]; - var loglenght = ""; - for (let item of this.log_path) { - loglenght = mongolog.filter((item1) => item1.tailed_path === item) - .length; - Vue.set(this.log_path_lenght, item, loglenght); - if (loglenght > this.loglenghttotal) { - // ------------------------------------- - // Save store - // ------------------------------------- - var ltotal1 = store.dispatch("pipelineLLO/taillog", { - path: item, - }); - } - } - }, - async resetFilter() { - console.log(JSON.stringify(this.logdata)); - }, async socketopen() { console.log("inside socketopen()"); this.$socket.client.open(); @@ -605,16 +551,7 @@ export default { this.$socket.client.close(); }, }, - computed: { - httpOptions() { - var token = store.getters["pipelineLLO/gettoken"]; - return { - headers: { - "Access-Control-Allow-Origin": "*", - }, - }; //table props -> :http-options="httpOptions" - }, - }, + computed: {}, beforeMount() { this.socketauthenticate(); console.log("send1"); @@ -683,6 +620,8 @@ export default { created() { //var logintoken = new URL(location.href).searchParams.get("token"); + + // ΕΔΩ ΠΡΠΕΕΙ ΝΑ ΑΛΛΑΧΤΕΙ ΤΟ URL ΩΣΤΕ ΝΑ ΚΑΝΕΙ AUTHENTICATION var logintoken = new URL( "https://api-client.swarmlab.io:8088/?token=de10ccdc027cd26161b3c1923098e436d56882f0" ).searchParams.get("token"); @@ -850,50 +789,11 @@ export default { */ /* */ - async logdata(val) { - console.log(" socket from logdata " + JSON.stringify(val)); - // ------------------------------------- - // Save store - // ------------------------------------- - var log = store.dispatch("pipelineLLO/addlog", { - log: val, - }); - // ------------------------------------- - // send to grep rungrep to view - // ------------------------------------- - this.$root.$emit("GREP_on_data", val); - // ------------------------------------- - // send to AdhocView to view in code - // ------------------------------------- - // this.$root.$emit('playground_log_in',val.value) - // ------------------------------------- - // send to AdhocView for socket status - // ------------------------------------- - this.$root.$emit("SERVER_socket_status", "on"); - var ltmp = store.getters["pipelineLLO/getlog"]; - //console.log('logtmpltmp '+ JSON.stringify(ltmp)) - this.log_path = [...new Set(ltmp.map((item) => item.tailed_path))]; - var loglenght = ""; - for (let item of this.log_path) { - //console.log('l1find '+ JSON.stringify(item)) - loglenght = ltmp.filter((item1) => item1.tailed_path === item).length; - Vue.set(this.log_path_lenght, item, loglenght); - if (loglenght > this.loglenghttotal) { - // ------------------------------------- - // Save store - // ------------------------------------- - var ltotal1 = store.dispatch("pipelineLLO/taillog", { - path: item, - }); - } - //console.log('l2 '+ this.log_path_lenght[item] ) - } - //console.log('l1 '+ JSON.stringify(this.log_path)) - }, async message(val) { console.log(" socket message " + JSON.stringify(val)); }, + // Lefos --- socket event to add the data to the right tables async logsend(val) { // ==== LEFOS