Browse Source

admin

master
zeus 3 years ago
parent
commit
7337fe30a7
  1. 2
      dist/index.html
  2. 2
      dist/js/app.52e9c83b.js
  3. 1
      dist/js/app.52e9c83b.js.map
  4. 2
      dist/js/app.fe2236d7.js
  5. 1
      dist/js/app.fe2236d7.js.map
  6. 14
      run.yml
  7. 54
      src-local/llo/new.js
  8. 2
      src/App.vue
  9. 10
      src/components/mynetwork/availablemicroservices.vue
  10. 4
      src/components/mynetwork/mytable.vue
  11. 56
      src/config/index-web.js
  12. 31
      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.25658f84.css" rel="preload" as="style"><link href="/css/chunk-vendors.e469b508.css" rel="preload" as="style"><link href="/js/app.fe2236d7.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.25658f84.css" rel="stylesheet"></head><body><div id="app"></div><script src="/js/chunk-vendors.d8d18fe6.js"></script><script src="/js/app.fe2236d7.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.25658f84.css" rel="preload" as="style"><link href="/css/chunk-vendors.e469b508.css" rel="preload" as="style"><link href="/js/app.52e9c83b.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.25658f84.css" rel="stylesheet"></head><body><div id="app"></div><script src="/js/chunk-vendors.d8d18fe6.js"></script><script src="/js/app.52e9c83b.js"></script></body></html>

2
dist/js/app.52e9c83b.js

File diff suppressed because one or more lines are too long

1
dist/js/app.52e9c83b.js.map

File diff suppressed because one or more lines are too long

2
dist/js/app.fe2236d7.js

File diff suppressed because one or more lines are too long

1
dist/js/app.fe2236d7.js.map

File diff suppressed because one or more lines are too long

14
run.yml

@ -100,6 +100,20 @@ services:
networks:
hybrid-net:
swarmlabadmin:
container_name: 'swarmlabadmin'
image: 'hub.swarmlab.io:5480/venus-admin:latest'
entrypoint: /bin/bash -c "tail -f /dev/null"
user: root
network_mode: host
cap_add:
- NET_ADMIN
- SYS_MODULE
volumes:
- /lib/modules:/lib/modules
- ${nodepath}/src-local/instance:/instance
networks:
hybrid-net:

54
src-local/llo/new.js

@ -1679,6 +1679,60 @@ try {
});
app.get('/chown', (req, res, next) => {
var RES = new Object();
var mypath1 = process.cwd()
var runuser = process.env.USER || ""
RES.instance = req.query["instance"]
RES.error = false
RES.error_msg = "ok"
//var showexec = `docker exec swarmlabadmin /bin/bash -c "chown -R ${runuser}:${runuser} /instance/${RES.instance}/${RES.instance}"`
var showexec = `docker exec swarmlabadmin /bin/bash -c "chown -R root:root /instance/${RES.instance}/${RES.instance}"`
//console.log(showexec)
try {
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);
n.start = `${RES.instance}`
RES.error = false
RES.error_msg = 'ok'
RES.data = n.data
res.json(RES)
});
} catch (error) {
console.log('Error:', error);
RES.error = true
RES.error_msg = error
RES.data = 'no'
res.json(RES)
}
});
app.get('/runbackup', (req, res, next) => {
var RES = new Object();
var mypath = process.cwd()

2
src/App.vue

@ -262,7 +262,7 @@
<!-- Menou private -->
<b-list-group-item v-b-toggle.hybrid-private 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')" > Private/Local</b-list-group-item>
<b-list-group-item v-b-toggle.hybrid-private variant="light" name="Private" class="ti-home list-group-item list-group-item-action" v-on:click="setActive('private','hybrid_microservice')" style="cursor: pointer;" :class="{ active: isActive('private') }" @click="hybrid('microservice')" > Private/Local</b-list-group-item>
<b-collapse id="hybrid-private" class="m-subm" accordion="m-sidebar" role="tabpanel">
<b-list-group-item variant="light" name="Container" class="ti-harddrive m-subm-listgroup list-group-item list-group-item-action" v-on:click="setActive('private','hybrid_private')" style="cursor: pointer;" :class="{ active: isActiveSub('hybrid_private') }" @click="hybrid('services')"> LabRoom</b-list-group-item>

10
src/components/mynetwork/availablemicroservices.vue

@ -586,11 +586,7 @@ export default {
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
@ -657,6 +653,12 @@ export default {
value.index = this.hybridoptions.index
value.size = this.hybridoptions.size
value.port = this.hybridoptions.port
var log = await store.dispatch("pipelineLLO/chown",{
token:this.token,
instance:this.hybridoptions.swarmlabname
})
//console.log('chown '+ JSON.stringify(this.hybridoptions.swarmlabname))
//console.log('chownlog '+ JSON.stringify(log))
this.$root.$emit('hybrid_start_instance', value)
Vue.set(this.testactionrowindex, value.swarmlabname, value.index)
//Vue.nextTick( () => this.$refs.vuetable.refresh())

4
src/components/mynetwork/mytable.vue

@ -1341,7 +1341,7 @@ info +='This permits the docker user on the local machine to connect to X window
//this.hybridshowdata = {}
},
async message_out(val) {
console.log(" socket out "+JSON.stringify(val))
//console.log(" socket out "+JSON.stringify(val))
//search for error in mongoserver must run sudo chown
this.$root.$emit('hybrid_log_in',val)
// refresh adhocview.vue on console await
@ -1350,7 +1350,7 @@ info +='This permits the docker user on the local machine to connect to X window
this.hybridshowdata = {}
},
async message_err(val) {
console.log(" socket err "+JSON.stringify(val))
//console.log(" socket err "+JSON.stringify(val))
var extenderror = new RegExp('error checking context');
if(extenderror.test(val.data)){
var cwdpath = val.cwdpath

56
src/config/index-web.js

@ -51,7 +51,7 @@ export const ApiConfigWEB = [
"app": true,
"url": 'http',
"port": "8001/tcp",
"ttyd": false,
"ttyd": true,
"ttydport": "3787/tcp",
"ttydurl": 'http'
},
@ -81,5 +81,59 @@ export const ApiConfigWEB = [
"ttyd": true,
"ttydport": "3787/tcp",
"ttydurl": 'http'
},
{
"name": "microservice-nodejs",
"app": false,
"url": 'http',
"port": "80/tcp",
"ttyd": true,
"ttydport": "3787/tcp",
"ttydurl": 'http'
},
{
"name": "microservice-nginx",
"app": false,
"url": 'http',
"port": "80/tcp",
"ttyd": true,
"ttydport": "3787/tcp",
"ttydurl": 'http'
},
{
"name": "microservice-ipterm",
"app": false,
"url": 'http',
"port": "80/tcp",
"ttyd": true,
"ttydport": "3787/tcp",
"ttydurl": 'http'
},
{
"name": "microservice-firefox",
"app": false,
"url": 'http',
"port": "80/tcp",
"ttyd": true,
"ttydport": "3787/tcp",
"ttydurl": 'http'
},
{
"name": "microservice-haproxy",
"app": false,
"url": 'http',
"port": "80/tcp",
"ttyd": true,
"ttydport": "3787/tcp",
"ttydurl": 'http'
},
{
"name": "microservice-snmpsim",
"app": false,
"url": 'http',
"port": "80/tcp",
"ttyd": true,
"ttydport": "3787/tcp",
"ttydurl": 'http'
}
];

31
src/store/modules/create_pipelineLLO.js

@ -398,6 +398,37 @@ export default {
return R;
}
}
},
async chown({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+'/chown'
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 runbackup({commit,rootGetters}, value) {
//console.log('value '+JSON.stringify(value))

Loading…
Cancel
Save