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. 14
      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) => { app.get('/getnetworks', (req, res, next) => {
var RES = new Object(); var RES = new Object();

14
src/components/mynetwork/AdhocView.vue

@ -13,6 +13,8 @@
</div> </div>
</template> </template>
</v-wait> </v-wait>
<button type="button" <button type="button"
round round
class="btn btn-outline-danger btn-sm" class="btn btn-outline-danger btn-sm"
@ -39,6 +41,9 @@
i</button> i</button>
</div> </div>
<div class="row">
<div class="col-12">
<div class="codemirror" > <div class="codemirror" >
<codemirror <codemirror
ref="myCm" ref="myCm"
@ -50,11 +55,10 @@
@input="onCmCodeChange" @input="onCmCodeChange"
></codemirror> ></codemirror>
</div> </div>
</b-col> </div>
</b-row> </div>
</b-container>
</b-container>
</card> </card>
</template> </template>
<script> <script>
@ -422,8 +426,6 @@ export default {
<style> <style>
.CodeMirror { .CodeMirror {
font-family: monospace; font-family: monospace;
height: 550px; height: 550px;
} }

41
src/components/mynetwork/mytable.vue

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

Loading…
Cancel
Save