Browse Source

search

master
zeus 4 years ago
parent
commit
286493634c
  1. 96
      package-lock.json
  2. 3
      package.json
  3. 9
      src/components/doclive/AdhocView.vue
  4. 254
      src/components/doclive/runLlo.vue
  5. 82
      src/store/modules/create_pipelineLLO.js

96
package-lock.json

@ -16,7 +16,9 @@
"bootstrap-vue": "^2.19.0",
"express": "^4.17.1",
"file-saver": "^2.0.5",
"import": "^0.0.6",
"jszip": "^3.5.0",
"luxon": "^1.25.0",
"mkdirp": "^0.5.5",
"multilang-extract-comments": "^0.3.3",
"socket.io": "^3.0.3",
@ -27,6 +29,7 @@
"vue-socket.io-extended": "^4.0.5",
"vue-sweetalert2": "^4.1.1",
"vue-template-compiler": "^2.6.12",
"vue2-datepicker": "^3.8.2",
"vuex": "^3.6.0"
},
"devDependencies": {
@ -4907,6 +4910,11 @@
"node": ">=0.10"
}
},
"node_modules/date-format-parse": {
"version": "0.2.6",
"resolved": "https://registry.npmjs.org/date-format-parse/-/date-format-parse-0.2.6.tgz",
"integrity": "sha512-sdxnYAWmLopeb+6Hmw+vo3or4OCJOnh4+YoJ9p+Id3o2EnNP0INpTqx7wr8UregfMpgaSZAH473R/ytiaB3gVg=="
},
"node_modules/de-indent": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz",
@ -7218,6 +7226,20 @@
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
},
"node_modules/import": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/import/-/import-0.0.6.tgz",
"integrity": "sha1-0Ot534aqJnfG22FXilISswMeYEI=",
"dependencies": {
"optimist": "0.3.x"
},
"bin": {
"import": "import"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/import-cwd": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz",
@ -8201,6 +8223,14 @@
"yallist": "^3.0.2"
}
},
"node_modules/luxon": {
"version": "1.25.0",
"resolved": "https://registry.npmjs.org/luxon/-/luxon-1.25.0.tgz",
"integrity": "sha512-hEgLurSH8kQRjY6i4YLey+mcKVAWXbDNlZRmM6AgWDJ1cY3atl8Ztf5wEY7VBReFbmGnwQPz7KYJblL8B2k0jQ==",
"engines": {
"node": "*"
}
},
"node_modules/make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@ -9181,6 +9211,14 @@
"node": ">=4"
}
},
"node_modules/optimist": {
"version": "0.3.7",
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz",
"integrity": "sha1-yQlBrVnkJzMokjB00s8ufLxuwNk=",
"dependencies": {
"wordwrap": "~0.0.2"
}
},
"node_modules/ora": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/ora/-/ora-3.4.0.tgz",
@ -13243,6 +13281,17 @@
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
"dev": true
},
"node_modules/vue2-datepicker": {
"version": "3.8.2",
"resolved": "https://registry.npmjs.org/vue2-datepicker/-/vue2-datepicker-3.8.2.tgz",
"integrity": "sha512-GUoNLyzPl3Xi7ruSQFF59BzMXWuflxzP9yM3P4ARz9GfhzLLFgYVLAEkJi6DNQU7zozBMzz+VNIQDwPaDNMo6Q==",
"dependencies": {
"date-format-parse": "^0.2.6"
},
"peerDependencies": {
"vue": "^2.5.0"
}
},
"node_modules/vuex": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.0.tgz",
@ -14275,6 +14324,14 @@
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
"dev": true
},
"node_modules/wordwrap": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
"integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/worker-farm": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz",
@ -18508,6 +18565,11 @@
"assert-plus": "^1.0.0"
}
},
"date-format-parse": {
"version": "0.2.6",
"resolved": "https://registry.npmjs.org/date-format-parse/-/date-format-parse-0.2.6.tgz",
"integrity": "sha512-sdxnYAWmLopeb+6Hmw+vo3or4OCJOnh4+YoJ9p+Id3o2EnNP0INpTqx7wr8UregfMpgaSZAH473R/ytiaB3gVg=="
},
"de-indent": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz",
@ -20369,6 +20431,14 @@
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
},
"import": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/import/-/import-0.0.6.tgz",
"integrity": "sha1-0Ot534aqJnfG22FXilISswMeYEI=",
"requires": {
"optimist": "0.3.x"
}
},
"import-cwd": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz",
@ -21142,6 +21212,11 @@
"yallist": "^3.0.2"
}
},
"luxon": {
"version": "1.25.0",
"resolved": "https://registry.npmjs.org/luxon/-/luxon-1.25.0.tgz",
"integrity": "sha512-hEgLurSH8kQRjY6i4YLey+mcKVAWXbDNlZRmM6AgWDJ1cY3atl8Ztf5wEY7VBReFbmGnwQPz7KYJblL8B2k0jQ=="
},
"make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@ -21938,6 +22013,14 @@
}
}
},
"optimist": {
"version": "0.3.7",
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz",
"integrity": "sha1-yQlBrVnkJzMokjB00s8ufLxuwNk=",
"requires": {
"wordwrap": "~0.0.2"
}
},
"ora": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/ora/-/ora-3.4.0.tgz",
@ -25368,6 +25451,14 @@
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
"dev": true
},
"vue2-datepicker": {
"version": "3.8.2",
"resolved": "https://registry.npmjs.org/vue2-datepicker/-/vue2-datepicker-3.8.2.tgz",
"integrity": "sha512-GUoNLyzPl3Xi7ruSQFF59BzMXWuflxzP9yM3P4ARz9GfhzLLFgYVLAEkJi6DNQU7zozBMzz+VNIQDwPaDNMo6Q==",
"requires": {
"date-format-parse": "^0.2.6"
}
},
"vuex": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.0.tgz",
@ -26186,6 +26277,11 @@
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
"dev": true
},
"wordwrap": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
"integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc="
},
"worker-farm": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz",

3
package.json

@ -18,7 +18,9 @@
"bootstrap-vue": "^2.19.0",
"express": "^4.17.1",
"file-saver": "^2.0.5",
"import": "^0.0.6",
"jszip": "^3.5.0",
"luxon": "^1.25.0",
"mkdirp": "^0.5.5",
"multilang-extract-comments": "^0.3.3",
"socket.io": "^3.0.3",
@ -29,6 +31,7 @@
"vue-socket.io-extended": "^4.0.5",
"vue-sweetalert2": "^4.1.1",
"vue-template-compiler": "^2.6.12",
"vue2-datepicker": "^3.8.2",
"vuex": "^3.6.0"
},
"devDependencies": {

9
src/components/doclive/AdhocView.vue

@ -441,8 +441,13 @@ export default {
// from runLLO
this.$root.$on('playground_log_in', (path) => {
//this.$nextTick(function () {
var logtmp = store.getters['pipelineLLO/getlog'];
//console.log('logtmp '+ JSON.stringify(logtmp))
var restapi = store.getters['pipelineLLO/getrestapi'];
if(restapi == "off"){ // rest off ara socket
var logtmp = store.getters['pipelineLLO/getlog'];
}else if(restapi == "on"){ // rest on ara read from rest not from socket
var logtmp = store.getters['pipelineLLO/getmongolog'];
}
console.log('logtmp-roi '+ JSON.stringify(logtmp))
var itemlog = ''
this.code = ''
itemlog = logtmp.filter(item1 => item1.tailed_path === path);

254
src/components/doclive/runLlo.vue

@ -7,90 +7,142 @@
</div>
<div class="row">
<div class="col-6">
<div class="input-group input-group-sm sm-6">
<input type="text"
class="form-control"
aria-label="Small" aria-describedby="inputGroup-sizing-sm"
placeholder="Filter your LOG searches by tags"
v-model="search.tag"
@keyup.enter="setFilter"
>
</div>
</div> <!-- col -->
<div class="col-6">
<div class="input-group input-group-sm sm-6">
<!-- --------------------------------------------------------- -->
<!-- -------- date satrt----------------------------------- -->
<!-- --------------------------------------------------------- -->
<div class="input-group input-group-sm mb-3">
<div class="input-group-prepend">
<button class="btn btn-outline-secondary"
type="button"
>Start date </button>
</div>
<date-picker
type="date"
autocomplete="off"
v-model="search.datestart"
format="YYYY-MM-DD"
lang="en"
>
</date-picker>
</div>
</div>
</div> <!-- col -->
<div class="input-group input-group-sm sm-6">
<input type="text"
class="form-control"
aria-label="Small" aria-describedby="inputGroup-sizing-sm"
placeholder="Filter your LOG searches by files"
v-model="search.file"
@keyup.enter="setFilter"
>
</div>
<div class="col-6">
<div class="input-group input-group-sm sm-6">
<!-- --------------------------------------------------------- -->
<!-- -------- date ----------------------------------- -->
<!-- --------------------------------------------------------- -->
<div class="input-group input-group-sm mb-3">
<div class="input-group-prepend">
<button class="btn btn-outline-secondary"
type="button"
>End date </button>
</div>
<date-picker
type="date"
autocomplete="off"
v-model="search.dateend"
format="YYYY-MM-DD"
lang="en"
>
</date-picker>
<div class="input-group-append">
<button
class="btn btn-outline-primary"
round
type="button"
@click="setFilter">
Go</button>
</div>
</div>
</div>
</div> <!-- col -->
</div> <!-- row -->
<div class="row">
<div class="col-12">
<div class="col-6">
<div class="input-group input-group-sm sm-6">
<div class="input-group-prepend">
<button
class="btn btn-outline-secondary"
round
type="button"
>
Search
</button>
</div>
<input type="text"
class="form-control"
aria-label="Small" aria-describedby="inputGroup-sizing-sm"
placeholder="Search"
v-model="search.app"
@keyup.enter="setFilter"
>
<div class="input-group-append">
<button
class="btn btn-outline-primary"
round
type="button"
@click="setFilter">
Go</button>
<div class="form-control custom-control custom-switch custom-control-inline">
<input type="checkbox" class="custom-control-input" id="log_logerror"
v-model="logcheck.error"
>
<label class="custom-control-label" for="log_logerror">Error</label>
</div>
<div class="form-control custom-control custom-switch custom-control-inline">
<input type="checkbox" class="custom-control-input" id="log_output"
v-model="logcheck.output"
data-size="large"
data-toggle="toggle"
>
<label class="custom-control-label" for="log_output">Output</label>
</div>
<div class="form-control custom-control custom-switch custom-control-inline">
<input type="checkbox" class="custom-control-input" id="log_log"
v-model="logcheck.log"
>
<label class="custom-control-label" for="log_log">Log</label>
</div>
</div>
</div>
</div> <!-- col -->
<div class="input-group-append">
<button class="btn btn-outline-secondary"
round
type="button"
@click="resetFilter">
Reset</button>
<div class="col-5">
<div class="input-group input-group-sm sm-5 justify-content-end ">
<div class="input-group-prepend">
<div class="input-group-append">
<button
class="btn btn-outline-warning"
round
type="button"
@click="Clearlog">
Clear</button>
</div>
<div class="input-group-append">
<button
class="btn btn-outline-primary"
round
type="button"
@click="Hotlog">
Hot_log</button>
</div>
</div>
</div>
</div>
</div> <!-- col -->
<div class="col-1">
</div> <!-- col -->
</div> <!-- row -->
<div class="row">
<div class="row rowlog overflow-auto">
<div class="col-12"
v-for="item in log_path"
>
<b-row
class="border-bottom"
v-if="logview(item) === true"
>
<b-col cols="2">
<span class="badge badge-danger badge-pill"
style="cursor: pointer"
@click="clearLog(item)"
@click="clearLog()"
>Clear</span>
</b-col>
@ -124,9 +176,13 @@ import {mapState, mapGetters, mapActions,dispatch} from 'vuex'
import Vue from 'vue'
import store from '@/store/index'
import JSZip from 'jszip';
import DatePicker from 'vue2-datepicker'
import 'vue2-datepicker/index.css';
import { DateTime } from "luxon";
import FileSaver from 'file-saver';
export default {
components: {
DatePicker
},
data () {
return {
@ -135,10 +191,18 @@ export default {
log_path_lenghtstatus:[],
loglenghttotal:32,
search: {
tag: "",
file: "",
app: ""
},
datestart: "",
dateend: "",
log: "",
output: "",
error: ""
},
logcheck: {
log: true,
error: true,
output: true
},
selected: [],
showlloedit:true,
issocket:'close',
socketdata:'',
@ -148,6 +212,37 @@ export default {
}
},
methods: {
Hotlog() {
this.Clearlog()
var restapi = "off"
var logrestapi = store.dispatch("pipelineLLO/setRestapi",{
restapi:restapi
})
},
Clearlog() {
var log = store.dispatch("pipelineLLO/RMmongolog")
this.log_path = []
//var mongolog = store.getters['pipelineLLO/getmongolog'];
//console.log("rmmongolog "+JSON.stringify(mongolog))
},
logview(item) {
//console.log('path ' + JSON.stringify(item))
if(this.logcheck.log){
if(item.endsWith('-log')){
return true;
}
}
if(this.logcheck.error){
if(item.endsWith('-error')){
return true;
}
}
if(this.logcheck.output){
if(item.endsWith('-output')){
return true;
}
}
},
async selectPath(path) {
console.log('path ' + JSON.stringify(path))
var statuslenght = this.log_path_lenght[path]
@ -167,7 +262,42 @@ export default {
},
async setFilter() {
console.log(JSON.stringify(this.logdata))
console.log(JSON.stringify(this.search))
var dd = this.search.datestart
console.log(dd)
console.log('new '+DateTime.fromISO(dd))
console.log('new1 '+DateTime.fromObject(dd).toISODate())
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",{
search:this.search,
swarmlabname:swarmlabname
})
var mongolog = store.getters['pipelineLLO/getmongolog'];
console.log("paramp "+JSON.stringify(mongolog))
//var mlog = mongolog.data.data
//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))
@ -515,5 +645,9 @@ export default {
font-family: monospace;
height: 750px;
}
.rowlog {
display: flex; /* equal height of the children */
height: 470px;
}
</style>

82
src/store/modules/create_pipelineLLO.js

@ -8,9 +8,21 @@ export default {
token: '',
llo: {},
log: [],
socketid:''
mongolog: [],
socketid:'',
restapi:'off'
},
getters: {
getrestapi (state, container) {
//console.log("js1 get "+JSON.stringify(state.llo))
return state.restapi
//return state.log
},
getmongolog (state, container) {
//console.log("js1 get "+JSON.stringify(state.llo))
return state.mongolog
//return state.log
},
getlog (state, container) {
//console.log("js1 get "+JSON.stringify(state.llo))
return state.log
@ -33,6 +45,10 @@ export default {
//console.log("js1 set "+JSON.stringify(data))
state.log.push(data);
},
setrestapi (state, data) {
//console.log("js1 set "+JSON.stringify(data))
state.restapi=data
},
set_token (state, data) {
//console.log("js1 set "+JSON.stringify(data))
state.token=data;
@ -54,6 +70,16 @@ export default {
console.log("js1 setrmrmrmrmrmrmrmrm "+JSON.stringify(state.log))
//state.log = filterlog;
},
setmongolog (state, data) {
//console.log("js1 set "+JSON.stringify(data))
state.mongolog.push(data);
//state.log.push(data);
},
rmmongolog (state, data) {
//console.log("js1 set "+JSON.stringify(data))
state.mongolog = [];
//state.log.push(data);
},
setllo (state, data) {
//console.log("js1 set "+JSON.stringify(data))
@ -65,6 +91,9 @@ export default {
}
},
actions: {
RMmongolog({commit}, value) {
commit('rmmongolog')
},
addlog({commit}, value) {
//console.log("container "+value)
var tt = {}
@ -73,6 +102,10 @@ export default {
tt.date = value.log.date
commit('add_log', tt)
},
setRestapi({commit}, value) {
//console.log("container "+value)
commit('setrestapi', value.restapi)
},
settoken({commit}, value) {
//console.log("container "+value)
commit('set_token', value.token)
@ -101,7 +134,38 @@ export default {
return p;
} catch (e) {
if(e.error == "invalid_token"){
if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){
window.location.href = 'https://api-login.swarmlab.io:8089';
}else{
var R = {
ERROR_str: e,
ERROR: 'yes'
}
return R;
}
}
},
async get_log({commit,rootGetters}, value) {
try {
var token = store.getters['pipelineLLO/gettoken'];
let p = await axios.get("https://factory.swarmlab.io:55527/get_log", {
timeout: 45000,
params: {
token: token,
start: value.search.datestart,
end: value.search.dateend,
swarmlabname: value.swarmlabname
}
});
//var p = value.code
console.log("paramp-------------------------- "+JSON.stringify(value))
store.dispatch('pipelineLLO/set_mongolog', p)
return p;
} catch (e) {
if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){
window.location.href = 'https://api-login.swarmlab.io:8089';
}else{
var R = {
@ -143,6 +207,20 @@ export default {
}
}
},
set_mongolog({commit}, value) {
//console.log("container "+value)
//commit('setmongolog', value)
for (let item of value.data.data) {
//console.log(JSON.stringify(item))
var itemobj = {}
itemobj.message = item.message
itemobj.tailed_path = item.tailed_path
itemobj.date = item.time
//console.log('vvvvvvvvvvvvvvvvvvvvvvvv '+JSON.stringify(itemobj))
commit('setmongolog', itemobj)
}
},
setScriptllo({commit}, value) {
//console.log("container "+value)
commit('setllo', value)

Loading…
Cancel
Save