Browse Source

add jupyter

master
zeus 3 years ago
parent
commit
510cb1d3cf
  1. 2
      dist/index.html
  2. 2
      dist/js/app.9d5ec349.js
  3. 1
      dist/js/app.9d5ec349.js.map
  4. 2
      dist/js/app.a717f732.js
  5. 1
      dist/js/app.a717f732.js.map
  6. 31
      src-local/llo/new.js
  7. 27
      src/App.vue
  8. 19
      src/components/mynetwork/availablemicroservices.vue
  9. 1
      src/components/mynetwork/dockerservices.vue
  10. 13
      src/components/mynetwork/myconnect-server.vue
  11. 63
      src/components/mynetwork/mytable.vue
  12. 63
      src/store/modules/create_pipelineLLO.js

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.10423c10.css" rel="preload" as="style"><link href="/css/chunk-vendors.e469b508.css" rel="preload" as="style"><link href="/js/app.a717f732.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.10423c10.css" rel="stylesheet"></head><body><div id="app"></div><script src="/js/chunk-vendors.d8d18fe6.js"></script><script src="/js/app.a717f732.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.10423c10.css" rel="preload" as="style"><link href="/css/chunk-vendors.e469b508.css" rel="preload" as="style"><link href="/js/app.9d5ec349.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.10423c10.css" rel="stylesheet"></head><body><div id="app"></div><script src="/js/chunk-vendors.d8d18fe6.js"></script><script src="/js/app.9d5ec349.js"></script></body></html>

2
dist/js/app.9d5ec349.js

File diff suppressed because one or more lines are too long

1
dist/js/app.9d5ec349.js.map

File diff suppressed because one or more lines are too long

2
dist/js/app.a717f732.js

File diff suppressed because one or more lines are too long

1
dist/js/app.a717f732.js.map

File diff suppressed because one or more lines are too long

31
src-local/llo/new.js

@ -761,6 +761,37 @@ app.get('/getservicesinfo', (req, res, next) => {
});
app.get('/getjupyterinfo', (req, res, next) => {
var RES = new Object();
RES.instance = req.query["instance"]
var showexec = `docker exec ${RES.instance} /bin/sh -c "jupyter notebook list"`
//console.log(JSON.stringify(showexec))
exec(showexec, (err, stdout, stderr) => {
if (err) {
console.error(`exec error: ${err}`);
return;
}
if (stdout) {
var string = stdout.toString()
RES.error = false
RES.error_msg = "ok"
RES.test = string;
//RES.data = found;
res.json(RES)
}else{
var found = 'no'
RES.error = false
RES.error_msg = "ok"
RES.test = 'no';
//RES.data = found;
res.json(RES)
}
});
});
app.get('/getmountinfo', (req, res, next) => {
var RES = new Object();

27
src/App.vue

@ -235,6 +235,12 @@
<b-list-group-item variant="light" name="Settings" class="ti-pencil-alt m-subm-listgroup list-group-item list-group-item-action" v-on:click="setActive('settings','profile_settings')" style="cursor: pointer;" :class="{ active: isActiveSub('profile_settings') }" @click="hybrid('connect-server')"> Settings</b-list-group-item>
</b-collapse>
<!-- Menou container -->
<b-list-group-item v-b-toggle.hybrid-container variant="light" name="Local" class="ti-package list-group-item list-group-item-action" v-on:click="setActive('container','')" style="cursor: pointer;" :class="{ active: isActive('container') }" @click="hybrid('bootstrap')" > Instances</b-list-group-item>
<b-collapse id="hybrid-container" class="m-subm" accordion="m-sidebar" role="tabpanel">
<b-list-group-item variant="light" name="Container" class="ti-harddrives m-subm-listgroup list-group-item list-group-item-action" v-on:click="setActive('container','hybrid_container')" style="cursor: pointer;" :class="{ active: isActiveSub('hybrid_container') }" @click="hybrid('bootstrap')"> Container</b-list-group-item>
</b-collapse>
<!-- Menou hybrid -->
<b-list-group-item v-b-toggle.hybrid-hybrid variant="light" name="Local" class="ti-loop list-group-item list-group-item-action" v-on:click="setActive('hybrid','')" style="cursor: pointer;" :class="{ active: isActive('hybrid') }" @click="hybrid('manage_service')" > Hybrid/Public</b-list-group-item>
@ -245,12 +251,6 @@
</b-collapse>
<!-- Menou container -->
<b-list-group-item v-b-toggle.hybrid-container variant="light" name="Local" class="ti-package list-group-item list-group-item-action" v-on:click="setActive('container','')" style="cursor: pointer;" :class="{ active: isActive('container') }" @click="hybrid('bootstrap')" > Instances</b-list-group-item>
<b-collapse id="hybrid-container" class="m-subm" accordion="m-sidebar" role="tabpanel">
<b-list-group-item variant="light" name="Container" class="ti-harddrives m-subm-listgroup list-group-item list-group-item-action" v-on:click="setActive('container','hybrid_container')" style="cursor: pointer;" :class="{ active: isActiveSub('hybrid_container') }" @click="hybrid('bootstrap')"> Container</b-list-group-item>
</b-collapse>
<!-- Menou private -->
@ -320,6 +320,14 @@
</b-collapse>
<!-- Menou container -->
<b-list-group-item v-b-toggle.hybrid-container1 variant="light" name="Local" class="ti-package list-group-item list-group-item-action" v-on:click="setActive('container','')" style="cursor: pointer;" :class="{ active: isActive('container') }" @click="hybrid('bootstrap')" title="Instances"> </b-list-group-item>
<b-collapse id="hybrid-container1" class="m-subm" accordion="m-sidebar" role="tabpanel">
<b-list-group-item variant="light" name="Container" class="ti-harddrives m-subm-listgroup list-group-item list-group-item-action" v-on:click="setActive('container','hybrid_container')" style="cursor: pointer;" :class="{ active: isActiveSub('hybrid_container') }" @click="hybrid('bootstrap')" title="Show all containers"> </b-list-group-item>
</b-collapse>
<!-- Menou hybrid -->
<b-list-group-item v-b-toggle.hybrid-hybrid1 variant="light" name="Local" class="ti-loop list-group-item list-group-item-action" v-on:click="setActive('hybrid','')" style="cursor: pointer;" :class="{ active: isActive('hybrid') }" @click="hybrid('manage_service')" title="Hybrid" > </b-list-group-item>
@ -329,13 +337,6 @@
</b-collapse>
<!-- Menou container -->
<b-list-group-item v-b-toggle.hybrid-container1 variant="light" name="Local" class="ti-package list-group-item list-group-item-action" v-on:click="setActive('container','')" style="cursor: pointer;" :class="{ active: isActive('container') }" @click="hybrid('bootstrap')" title="Instances"> </b-list-group-item>
<b-collapse id="hybrid-container1" class="m-subm" accordion="m-sidebar" role="tabpanel">
<b-list-group-item variant="light" name="Container" class="ti-harddrives m-subm-listgroup list-group-item list-group-item-action" v-on:click="setActive('container','hybrid_container')" style="cursor: pointer;" :class="{ active: isActiveSub('hybrid_container') }" @click="hybrid('bootstrap')" title="Show all containers"> </b-list-group-item>
</b-collapse>
<!-- Menou private -->
<b-list-group-item v-b-toggle.hybrid-private1 variant="light" name="Private" class="ti-home list-group-item list-group-item-action" v-on:click="setActive('private','')" style="cursor: pointer;" :class="{ active: isActive('private') }" @click="hybrid('services')" title="Private"> </b-list-group-item>

19
src/components/mynetwork/availablemicroservices.vue

@ -536,9 +536,27 @@ export default {
this.refreshVuetable()
}else if(action == 'run-item' ){
var filterju = `microservice-jupyter`
var grepju = new RegExp(filterju);
if(grepju.test(data.swarmlabname)){
this.viewhybridoptions = false
let value = {}
value.swarmlabname = data.swarmlabname
value.index = index
value.size = this.hybridoptions.size
value.port = this.hybridoptions.port
this.$root.$emit('hybrid_start_instance', value)
Vue.set(this.testactionrowindex, value.swarmlabname, value.index)
console.log('inf git 2 '+ JSON.stringify(data.swarmlabname))
}else{
this.viewhybridoptions = true
this.hybridoptions.swarmlabname = data.swarmlabname
this.hybridoptions.index = index
console.log('inf git 1 '+ JSON.stringify(this.hybridoptions))
/*
console.log('RUN 1 '+ JSON.stringify(data.swarmlabname))
// run on mytable.vue
@ -546,6 +564,7 @@ export default {
Vue.set(this.testactionrowindex, data.swarmlabname, index)
Vue.nextTick( () => this.$refs.vuetable.refresh())
*/
}
Vue.nextTick( () => this.$refs.vuetable.refresh())
}else if(action == 'down-item' ){
this.hybridoptions.swarmlabname = data.swarmlabname

1
src/components/mynetwork/dockerservices.vue

@ -326,6 +326,7 @@ export default {
async onAction (action, data, index) {
this.actionrowindex = index
this.$root.$emit('hybrid_show_info',data)
console.log('index '+JSON.stringify(data))
//console.log('index '+this.actionrowindex)
if(action == 'view-item' ){
}else if(action == 'delete-item' ){

13
src/components/mynetwork/myconnect-server.vue

@ -60,18 +60,18 @@
> Load Settings
</button>
</div>
<!--
<div class="input-group-prepend">
<button
class="ti-widget btn btn-outline-info"
round
type="button"
title="Save config"
@click="onAction('save')"
> Save Settings
@click="onAction('vpn')"
> Create vpn
</button>
</div>
-->
</div>
</div>
<div class="col-1">
@ -309,6 +309,11 @@ export default {
reverseButtons: true,
focusCancel: true
})
}else if(action == 'vpn'){
var log = await store.dispatch("pipelineLLO/create_vpn",{
value:this.CONFIG
})
console.log('start vpn ' + JSON.stringify(log))
}else if(action == 'save'){
var log = await store.dispatch("pipelineLLO/create_config",{
token:this.token,

63
src/components/mynetwork/mytable.vue

@ -34,15 +34,14 @@
</button>
</div>
<div class="input-group-prepend">
<!--
<button
v-if="webinterface"
class="btn btn-outline-success"
round
type="button"
@click="onAction('start')"
@click="onAction('startweb')"
>
Start</button>
-->
Web</button>
</div>
<div class="input-group-prepend">
<button
@ -259,6 +258,8 @@ export default {
selectedNetworks:[],
localNetworkoptions:[],
localNetworkdefault:'',
webinterface: false,
webinterface_port: '',
STATUS:{},
CONFIG:{
'status':'',
@ -299,6 +300,17 @@ export default {
this.$root.$on('hybrid_show_info', (data) => {
this.$nextTick(function () {
this.hybridshowdata = data
var filterju = `microservice-jupyter`
var grepju = new RegExp(filterju);
if(grepju.test(data.Networks)){
this.webinterface = true
this.webinterface_port = data.Ports
console.log(JSON.stringify(this.webinterface_port))
}else{
this.webinterface = false
this.webinterface_port = ''
}
this.addNetworkMenou = false
this.localNetworks = []
this.selectedNetworks = []
@ -488,6 +500,49 @@ export default {
container:this.hybridshowdata.ID
})
// console.log('logs---------- ' + JSON.stringify(this.hybridshowdata))
}else if(action == 'startweb'){
var log = await store.dispatch("pipelineLLO/getjupyterinfo",{
instance:this.hybridshowdata.Names
})
if(log.data.test){
//get token
var splitted = log.data.test.split('?token=');
var jutoken = splitted[1];
//cut from home dir
var splitted1 = jutoken.split(' ');
var jutokenok = splitted1[0];
var juurl = this.webinterface_port.split('->');
// trim it
var juurlok = juurl[0].trim();
//build url
var openuerlju = `http://${juurlok}/?token=${jutokenok}`
//console.log('jupyter '+ JSON.stringify(jutokenok))
//console.log('jupyter '+ JSON.stringify(openuerlju))
var info=`<h5>You can connect to the same contained process multiple times simultaneously, from different sessions.<br>
<br>
<b>Click
<a class="text-info" href="${openuerlju}" target="_blank">here to open</a></span>
</b>
<br>
<br>
`
this.$swal({
type: 'Info',
title: 'Info!',
icon:'info',
html: info,
showCloseButton: true,
showLoaderOnConfirm: false,
allowOutsideClick: false,
cancelButtonText: 'No, cancel!',
showCancelButton: false,
showLoaderOnConfirm: false,
reverseButtons: true,
focusCancel: true,
confirmButtonText: 'Ok!'
})
}
}else if(action == 'container-connect'){
var log = await store.dispatch("pipelineLLO/getmountinfo",{
instance:this.hybridshowdata.Names

63
src/store/modules/create_pipelineLLO.js

@ -305,6 +305,37 @@ export default {
return R;
}
}
},
async getjupyterinfo({commit,rootGetters}, value) {
//console.log('value '+JSON.stringify(value))
try {
var token = value.token
var params = {
instance: value.instance
}
var options = {
params: params,
headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` },
};
var sock_server_l = ApiConfig.url_80+'/getjupyterinfo'
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 getmountinfo({commit,rootGetters}, value) {
//console.log('value '+JSON.stringify(value))
@ -1136,6 +1167,38 @@ export default {
}
}
},
async create_vpn ({commit,rootGetters}, value) {
try {
var token = rootGetters['pipelineLLO/gettoken']
var params = {
wg: value.value
}
var options = {
headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` },
};
var p = await axios.post('https://api.swarmlab.io/addwghybridiserver',params,options);
if(p.error == "invalid_token"){
console.log(p)
//console.log(JSON.stringify(p))
}else{
}
//console.log(value.token)
//console.log(value.swarmlabname)
//console.log(JSON.stringify(p))
return p
} 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 hybrid_servicelog({commit,rootGetters}, value) {
try {
var token = value.token

Loading…
Cancel
Save