Browse Source

search and service option

master
lefteris 4 years ago
parent
commit
3d7235b6dd
  1. 6
      src/App.vue
  2. 108
      src/components/doclive/AdhocView.vue
  3. 21
      src/components/doclive/runLlo.vue

6
src/App.vue

@ -157,10 +157,4 @@ body {
.menoutext { .menoutext {
font-family: "Lato", sans-serif !important; font-family: "Lato", sans-serif !important;
} }
thead {
background-color: #f8f9fa;
position: sticky;
top: 0;
}
</style> </style>

108
src/components/doclive/AdhocView.vue

@ -18,48 +18,63 @@
> >
online online
</button> </button>
<div v-if="socketonline"> <div v-if="socketonline"></div>
<button <button
type="button" type="button"
round round
disable
class="btn btn-outline-info btn-sm" class="btn btn-outline-info btn-sm"
v-if="socketonline" v-else
@click="showHistory" @click="socketconnect"
> >
{{ this.alllogs }} socket disconnected
</button> </button>
</div>
</b-col>
<b-col cols="3">
<div class="input-group input-group-sm sm-3">
<div v-if="socketonline" class="search-wrapper">
<label class="filters" for="search">Search a log:</label>
<input
id="search"
type="text"
v-model="searchparam"
placeholder="Log"
/>
</div>
<label class="filters" for="list">Pick a service:</label>
<select class="filters" id="list" v-model="selected">
<option selected value="All">All</option>
<option v-for="item in this.items" v-bind:value="item.name">
{{ item.name }}
</option>
</select>
<button <button
type="button" type="button"
round round
disable disable
class="btn btn-outline-info btn-sm" class="btn btn-outline-info btn-sm"
v-if="socketonline" v-if="socketonline"
@click="showChart" @click="showHistory"
> >
{{ this.chartbut }} {{ this.alllogs }}
</button> </button>
</div> </div>
</b-col>
<b-col cols="5">
<div class="input-group input-group-sm d-flex justify-content-end">
<button <button
type="button" type="button"
round round
disable
class="btn btn-outline-info btn-sm" class="btn btn-outline-info btn-sm"
v-else v-if="socketonline"
@click="socketconnect" @click="showChart"
> >
socket disconnected {{ this.chartbut }}
</button> </button>
</div> </div>
</b-col>
<b-col cols="3">
<div class="input-group input-group-sm sm-3"></div>
</b-col>
<b-col cols="5">
<div
class="input-group input-group-sm d-flex justify-content-end"
></div>
<div class="input-group input-group-sm d-flex justify-content-end"> <div class="input-group input-group-sm d-flex justify-content-end">
<div class="input-group-append"> <div class="input-group-append">
<button <button
@ -89,6 +104,8 @@
:show-sort-icons="true" :show-sort-icons="true"
:multi-sort="multiSort" :multi-sort="multiSort"
:per-page="perpage" :per-page="perpage"
:append-params="extraparams"
table-height="300px"
pagination-path="links.pagination" pagination-path="links.pagination"
detail-row-id="id" detail-row-id="id"
wrapper-class="vuetable-wrapper" wrapper-class="vuetable-wrapper"
@ -209,6 +226,11 @@ export default {
}, },
data() { data() {
return { return {
items: [],
extraparams: {
logtext: "",
},
searchparam: "",
chartstatus: false, chartstatus: false,
chartbut: "Show HighChart", chartbut: "Show HighChart",
chartOptions: { chartOptions: {
@ -240,12 +262,13 @@ export default {
title: "Log", title: "Log",
sortField: "message", sortField: "message",
visible: true, visible: true,
width: "45%%",
}, },
{ {
name: "timestamp", name: "timestamp",
title: "Time", title: "Time",
sortField: "time", sortField: "time",
width: "20%", width: "25%",
visible: true, visible: true,
}, },
{ {
@ -256,13 +279,16 @@ export default {
}, },
{ {
name: "process_id", name: "process_id",
title: "P_ID",
visible: true, visible: true,
width: "5%",
}, },
{ {
name: "app_name", name: "app_name",
visible: true, visible: true,
sortField: "app_name", sortField: "app_name",
title: '<span class="orange"></span>App Name', title: '<span class="orange"></span>App Name',
width: "15%",
}, },
// 'timestamp', // 'timestamp',
// 'type', // 'type',
@ -314,7 +340,7 @@ export default {
}, },
}, },
], ],
alllogs: "Show app logs", alllogs: "Search",
socketonline: false, socketonline: false,
tryConsole: false, tryConsole: false,
history: false, history: false,
@ -385,7 +411,7 @@ export default {
LearningObject: "", LearningObject: "",
showllo: true, showllo: true,
showlloedit: true, showlloedit: true,
selected: "sublime", selected: "All",
options: [ options: [
{ text: "vim", value: "vim" }, { text: "vim", value: "vim" },
{ text: "sublime", value: "sublime" }, { text: "sublime", value: "sublime" },
@ -481,13 +507,26 @@ export default {
this.chartbut = "Show HighChart"; this.chartbut = "Show HighChart";
} }
}, },
async getServices() {
await axios.get("http://localhost:3000/services").then((res) => {
res.data.forEach((val) => {
//console.log(val);
this.items.push({
name: val,
});
});
// this.items.push({
// name: "All",
// });
});
},
showHistory() { showHistory() {
this.extraparams.logtext = this.searchparam;
this.extraparams.selected = this.selected;
if (this.history == false) { if (this.history == false) {
this.history = true; this.history = true;
this.alllogs = "Hide app logs";
} else { } else {
this.alllogs = "Show app logs"; this.$refs.vuetable.refresh();
this.history = false;
} }
}, },
onPaginationData(paginationData) { onPaginationData(paginationData) {
@ -740,11 +779,13 @@ export default {
).searchParams.get("token"); ).searchParams.get("token");
this.swarmlabname = new URL(location.href).searchParams.get("pipelinename"); this.swarmlabname = new URL(location.href).searchParams.get("pipelinename");
this.getServices();
}, },
}; };
</script> </script>
<style scoped> <style sc oped>
h2 { h2 {
background-color: dimgray; background-color: dimgray;
padding: 10px; padding: 10px;
@ -756,11 +797,6 @@ h2 {
padding-top: 50px; padding-top: 50px;
max-width: 100%; max-width: 100%;
} }
.table3 {
min-height: 320px;
max-width: 100%;
overflow: auto;
}
.CodeMirror { .CodeMirror {
font-family: monospace; font-family: monospace;
max-width: 900px; max-width: 900px;
@ -788,4 +824,12 @@ h2 {
.pagi { .pagi {
height: 40px; height: 40px;
} }
#search {
padding: 0px 5px 5px 5px;
margin: 0px 0px 10px 10px;
}
.filters {
margin: 0px 0px 0px 10px;
}
</style> </style>

21
src/components/doclive/runLlo.vue

@ -257,12 +257,13 @@
Scroll to Bottom Scroll to Bottom
</button> </button>
</div> </div>
<div id="rawlogs" class="table2"> <div id="rawlogs">
<vuetable <vuetable
ref="rawtable" ref="rawtable"
:api-mode="false" :api-mode="false"
:fields="fields3" :fields="fields3"
:css="css.table" :css="css.table"
table-height="400px"
> >
</vuetable> </vuetable>
</div> </div>
@ -376,29 +377,28 @@ export default {
{ {
name: "container_id", name: "container_id",
title: "Container_id", title: "Container_id",
width: "30%", width: "13%",
}, },
{ {
name: "log", name: "log",
title: "Log", title: "Log",
width: "30%", width: "40%",
}, },
{ {
name: "container_name", name: "container_name",
title: "Container Name", title: "Container Name",
width: "15%", width: "17%",
}, },
{ {
name: "source", name: "source",
title: "Source", title: "Source",
width: "5%", width: "8%",
}, },
{ {
name: "time", name: "time",
title: "Time", title: "Time",
width: "20%", width: "22%",
}, },
], ],
log_path: [], log_path: [],
@ -742,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=daa93d51084c246f1670222d702732345d68f6ec" "https://api-client.swarmlab.io:8088/?token=82309bbfc2fb9d86bc45e60f347c6d1f8f11f677"
).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
@ -1066,7 +1066,7 @@ export default {
this.localDataOut.push(tmp); 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") {
var tmplog = val; var tmplog = val;
//timestamp //timestamp
@ -1141,8 +1141,9 @@ button {
.conid:hover { .conid:hover {
transition: 0.7s; transition: 0.7s;
width: 580px; width: 580px;
background-color: rgb(63, 61, 61); background-color: rgb(49, 49, 49);
color: #fff; color: #fff;
position: relative;
border-radius: 6px; border-radius: 6px;
padding: 5px; padding: 5px;
} }

Loading…
Cancel
Save