Browse Source

add logs

master
zeus 4 years ago
parent
commit
9603a7ba60
  1. 0
      dist/css/app.28af1641.css
  2. 2
      dist/index.html
  3. 2
      dist/js/app.18300ceb.js
  4. 1
      dist/js/app.18300ceb.js.map
  5. 2
      dist/js/app.45012763.js
  6. 1
      dist/js/app.45012763.js.map
  7. 69
      src-local/llo/new.js
  8. 82
      src/components/mynetwork/AdhocView.vue
  9. 41
      src/components/mynetwork/mytable.vue
  10. 31
      src/store/modules/create_pipelineLLO.js

0
dist/css/app.2301b4fb.css → dist/css/app.28af1641.css

2
dist/index.html

@ -1 +1 @@
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Vue App</title><link href="/css/app.2301b4fb.css" rel="preload" as="style"><link href="/css/chunk-vendors.e469b508.css" rel="preload" as="style"><link href="/js/app.45012763.js" rel="preload" as="script"><link href="/js/chunk-vendors.d8d18fe6.js" rel="preload" as="script"><link href="/css/chunk-vendors.e469b508.css" rel="stylesheet"><link href="/css/app.2301b4fb.css" rel="stylesheet"></head><body><div id="app"></div><script src="/js/chunk-vendors.d8d18fe6.js"></script><script src="/js/app.45012763.js"></script></body></html>
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Vue App</title><link href="/css/app.28af1641.css" rel="preload" as="style"><link href="/css/chunk-vendors.e469b508.css" rel="preload" as="style"><link href="/js/app.18300ceb.js" rel="preload" as="script"><link href="/js/chunk-vendors.d8d18fe6.js" rel="preload" as="script"><link href="/css/chunk-vendors.e469b508.css" rel="stylesheet"><link href="/css/app.28af1641.css" rel="stylesheet"></head><body><div id="app"></div><script src="/js/chunk-vendors.d8d18fe6.js"></script><script src="/js/app.18300ceb.js"></script></body></html>

2
dist/js/app.18300ceb.js

File diff suppressed because one or more lines are too long

1
dist/js/app.18300ceb.js.map

File diff suppressed because one or more lines are too long

2
dist/js/app.45012763.js

File diff suppressed because one or more lines are too long

1
dist/js/app.45012763.js.map

File diff suppressed because one or more lines are too long

69
src-local/llo/new.js

@ -811,6 +811,75 @@ app.get('/getstoragestatus', (req, res, next) => {
});
app.get('/getlogs', (req, res, next) => {
var RES = new Object();
var instancejson = JSON.parse(req.query["container"])
var instance = instancejson.container
//console.log(JSON.stringify(instancejson))
var showexec = `docker logs ${instance}`
log = spawn(showexec, {
shell: true,
//cwd: services_path,
detached: false,
stdio: 'pipe'
});
log.stdout.on('data', function (data) {
var n = {}
n.data = data.toString()
io.emit('message_out', n);
});
log.stderr.on('data', function (data) {
var n = {}
n.data = data.toString()
io.emit('message_err', n);
});
log.on('close', function (code) {
var n = {}
n.data = code
io.emit('message_close', n);
RES.error = false
RES.error_msg = "ok"
RES.data = code;
res.json(RES)
});
/*
exec(showexec, (err, stdout, stderr) => {
if (err) {
return;
}
if (stdout) {
var string = stdout.toString().split('\n');
var datajson1 = ''
for(var i = 0; i < string.length; i++) {
datajson1 += JSON.parse(JSON.stringify(string[i]));
}
//var datajson = JSON.parse(JSON.stringify(datajson1));
var datajson = datajson1
//var datajson = JSON.parse(string);
var n = {}
//n.data = `${string}`
n.data = `${datajson}`
io.emit('message_close', n);
RES.error = false
RES.error_msg = "ok"
RES.data = datajson;
res.json(RES)
}else{
var found = 'no'
RES.error = false
RES.error_msg = "ok"
RES.data = 'no network';
res.json(RES)
}
}); // exec(showexec1
*/
});
app.get('/getnetworks', (req, res, next) => {
var RES = new Object();

82
src/components/mynetwork/AdhocView.vue

@ -4,41 +4,46 @@
<img class="avatar border-white" src="@/assets/img/code-128.png" alt="...">
</div>
<b-container fluid class="bv-example-row">
<div class=" col text-center">
<v-wait for="myRunInstance1">
<template slot="waiting">
<div>
<img src="@/assets/loading.gif" width="50" height="50" />
Lab_Instance...
</div>
</template>
</v-wait>
<button type="button"
round
class="btn btn-outline-danger btn-sm"
v-if="extenderror"
@click="runextenderror()">
Error: max depth exceeded</button>
<button type="button"
round
class="btn btn-outline-warning btn-sm"
v-if="tryConsole"
@click="clear()">
Clear</button>
<button type="button"
round
class="btn btn-outline-info btn-sm"
disabled
>
Console</button>
<button type="button"
round
class="btn btn-outline-info btn-sm"
v-if="cmOptions.keyMap == 'sublime'"
@click="infoFilter">
i</button>
<div class=" col text-center">
<v-wait for="myRunInstance1">
<template slot="waiting">
<div>
<img src="@/assets/loading.gif" width="50" height="50" />
Lab_Instance...
</div>
</template>
</v-wait>
<button type="button"
round
class="btn btn-outline-danger btn-sm"
v-if="extenderror"
@click="runextenderror()">
Error: max depth exceeded</button>
<button type="button"
round
class="btn btn-outline-warning btn-sm"
v-if="tryConsole"
@click="clear()">
Clear</button>
<button type="button"
round
class="btn btn-outline-info btn-sm"
disabled
>
Console</button>
<button type="button"
round
class="btn btn-outline-info btn-sm"
v-if="cmOptions.keyMap == 'sublime'"
@click="infoFilter">
i</button>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="codemirror" >
<codemirror
ref="myCm"
@ -50,11 +55,10 @@
@input="onCmCodeChange"
></codemirror>
</div>
</b-col>
</b-row>
</b-container>
</div>
</div>
</b-container>
</card>
</template>
<script>
@ -422,8 +426,6 @@ export default {
<style>
.CodeMirror {
font-family: monospace;
height: 550px;
}

41
src/components/mynetwork/mytable.vue

@ -53,6 +53,14 @@
@click="onAction('container-connect')"
>
Connect</button>
<button
v-else
class="btn btn-outline-secondary"
round
type="button"
disabled
>
Connect</button>
<button
v-if="hybridshowdata.Names"
class="btn btn-outline-danger"
@ -61,7 +69,35 @@
@click="onAction('container-stop')"
>
Stop</button>
<button
v-else
class="btn btn-outline-secondary"
round
type="button"
disabled
>
stop</button>
</div>
<div class="input-group-append">
<button
v-if="hybridshowdata.Names"
class="btn btn-outline-warning"
round
type="button"
@click="onAction('container-logs')"
>
Logs</button>
<button
v-else
class="btn btn-outline-secondary"
round
type="button"
disabled
>
Logs</button>
</div>
</div>
</b-container>
<b-container fluid>
@ -423,6 +459,11 @@ export default {
//console.log('start ' + JSON.stringify(log))
//console.log('startobj ' + JSON.stringify(obj))
////console.log(this.$socket.client.connect())
}else if(action == 'container-logs'){
var log = await store.dispatch("pipelineLLO/getlogs",{
container:this.hybridshowdata.ID
})
console.log('logs---------- ' + JSON.stringify(this.hybridshowdata))
}else if(action == 'container-connect'){
var log = await store.dispatch("pipelineLLO/getmountinfo",{
instance:this.hybridshowdata.Names

31
src/store/modules/create_pipelineLLO.js

@ -430,6 +430,37 @@ export default {
}
}
},
async getlogs({commit,rootGetters}, value) {
//console.log('value '+JSON.stringify(value))
try {
var token = value.token
var params = {
container: value
}
var options = {
params: params,
headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` },
};
var sock_server_l = ApiConfig.url_80+'/getlogs'
var p = await axios.get(sock_server_l,options);
//var p = await axios.get('https://localhost:3000/getservicesinfo',options);
return p
//console.log(JSON.stringify(p))
//console.log(value.token)
//console.log(value.swarmlabname)
} catch (e) {
if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){
//console.log('error '+JSON.stringify(e))
window.location.href = 'https://api-login.swarmlab.io:8089';
}else{
var R = {
ERROR_str: e,
ERROR: 'yes'
}
return R;
}
}
},
async getserviceshybridstatus({commit,rootGetters}, value) {
//console.log('value '+JSON.stringify(value))

Loading…
Cancel
Save