You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2259 lines
89 KiB
2259 lines
89 KiB
<template>
|
|
<card class="card-user" style="max-height:100%">
|
|
<div class="author">
|
|
<img class="avatar border-white" src="@/assets/img/docker.png" alt="...">
|
|
</div>
|
|
|
|
<v-wait for="myRunInstanceeditor">
|
|
<template slot="waiting">
|
|
<div>
|
|
<img src="@/assets/loading.gif" />
|
|
Enter Editor...
|
|
</div>
|
|
</template>
|
|
</v-wait>
|
|
|
|
<b-container fluid class="bv-example-row">
|
|
<div class="row text-center">
|
|
<div class="col-12">
|
|
<b><span class="text-muted">View and Manage your</span> <span class="text-info">Running Instances</span></b>
|
|
</div>
|
|
</div>
|
|
|
|
<br>
|
|
<div class="row">
|
|
<div class="col-5">
|
|
<div class="input-group input-group-sm sm-3">
|
|
<div class="input-group-prepend">
|
|
<button
|
|
v-if="$socket.disconnected"
|
|
class="ti-unlink btn btn-outline-danger"
|
|
round
|
|
type="button"
|
|
title="You are disconnected from Swarmlab-hybrid"
|
|
disabled
|
|
>
|
|
</button>
|
|
<button
|
|
v-else
|
|
class="ti-link btn btn-outline-success"
|
|
round
|
|
type="button"
|
|
title="You are connected swarmlab-hybrid"
|
|
@click="onAction('shareinfo')"
|
|
>
|
|
</button>
|
|
</div>
|
|
<div class="input-group-prepend">
|
|
<button
|
|
v-if="webinterface"
|
|
class="btn btn-outline-success"
|
|
round
|
|
type="button"
|
|
@click="onAction('startweb')"
|
|
>
|
|
Web</button>
|
|
<button
|
|
v-if="webinterfacegeneric && hybridshowdata.Names"
|
|
class="btn btn-info"
|
|
round
|
|
type="button"
|
|
@click="onAction('startwebgeneric')"
|
|
>
|
|
{{ webinterfacegeneric_text }}</button>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="input-group-prepend">
|
|
<button
|
|
v-if="hybridshowdata.Names"
|
|
class="btn btn-outline-success"
|
|
round
|
|
type="button"
|
|
@click="onAction('container-connect')"
|
|
>
|
|
Connect</button>
|
|
<button
|
|
v-else
|
|
class="btn btn-outline-secondary"
|
|
round
|
|
type="button"
|
|
disabled
|
|
>
|
|
Connect</button>
|
|
<button
|
|
v-if="webinterfacegenericedit && hybridshowdata.Names"
|
|
class="btn btn-outline-info"
|
|
round
|
|
type="button"
|
|
@click="onAction('basedireditor')"
|
|
>
|
|
Editor</button>
|
|
<button
|
|
v-if="hybridshowdata.Names"
|
|
class="btn btn-outline-danger"
|
|
round
|
|
type="button"
|
|
@click="onAction('container-stop')"
|
|
>
|
|
Stop</button>
|
|
<button
|
|
v-else
|
|
class="btn btn-outline-secondary"
|
|
round
|
|
type="button"
|
|
disabled
|
|
>
|
|
stop</button>
|
|
<button
|
|
v-if="actionrowindexconsole"
|
|
class="btn btn-warning"
|
|
round
|
|
type="button"
|
|
@click="onAction('container-logsclose')"
|
|
>
|
|
Close Console</button>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div> <!-- col -->
|
|
<div class="col-1">
|
|
<div class="input-group input-group-sm sm-3">
|
|
<div class="input-group-prepend float-center">
|
|
<!--
|
|
<button
|
|
v-if="webinterfacegenericedit && hybridshowdata.Names"
|
|
class="btn btn-outline-success"
|
|
round
|
|
type="button"
|
|
@click="onAction('basedireditor')"
|
|
>
|
|
Editor</button>
|
|
-->
|
|
</div>
|
|
</div>
|
|
</div> <!-- col -->
|
|
<div class="col-1">
|
|
</div> <!-- col -->
|
|
<div class="col-5">
|
|
<div class="input-group input-group-sm sm-3">
|
|
<div class="input-group-prepend float-right">
|
|
<button
|
|
v-if="actionrowindex && hybridshowdata.Names"
|
|
class="ti-more-alt btn btn-secondary btn-sm"
|
|
title="More Options..."
|
|
round
|
|
@click="runmore('off')">
|
|
</button>
|
|
<button
|
|
v-if="actionrowindexselect && hybridshowdata.Names"
|
|
class="ti-more btn btn-outline-info btn-sm"
|
|
round
|
|
title="More Options..."
|
|
@click="runmore('on')">
|
|
</button>
|
|
<button
|
|
v-if="actionrowindex && hybridshowdata.Names"
|
|
class="btn btn-outline-info"
|
|
round
|
|
type="button"
|
|
@click="onAction('basedir')"
|
|
>
|
|
Persistent Data</button>
|
|
</div>
|
|
<div class="input-group-prepend float-right">
|
|
<button
|
|
v-if="actionrowindex && hybridshowdata.Names"
|
|
class="btn btn-outline-warning"
|
|
round
|
|
type="button"
|
|
@click="onAction('basebackup')"
|
|
>
|
|
Backup</button>
|
|
</div>
|
|
<div class="input-group-prepend float-right">
|
|
<button
|
|
v-if="actionrowindex && hybridshowdata.Names"
|
|
class="btn btn-outline-success"
|
|
round
|
|
type="button"
|
|
@click="onAction('basebackupview')"
|
|
>
|
|
BrowseBackups</button>
|
|
</div>
|
|
<div class="input-group-append">
|
|
<button
|
|
v-if="!actionrowindexconsole && actionrowindex && hybridshowdata.Names"
|
|
class="btn btn-outline-warning"
|
|
round
|
|
type="button"
|
|
@click="onAction('container-logs')"
|
|
>
|
|
Logs</button>
|
|
<button
|
|
v-if="actionrowindexconsole && actionrowindex && hybridshowdata.Names"
|
|
class="btn btn-warning"
|
|
round
|
|
type="button"
|
|
@click="onAction('container-logsclose')"
|
|
>
|
|
Logs</button>
|
|
</div>
|
|
</div>
|
|
</div> <!-- col -->
|
|
|
|
</div> <!-- row -->
|
|
|
|
|
|
<div class="row"
|
|
v-if="webinterfacegeneric && webinterfacegeneric_menou1 && hybridshowdata.Names"
|
|
>
|
|
<div class="col-12">
|
|
<hr>
|
|
</div>
|
|
</div>
|
|
<div class="row"
|
|
v-if="webinterfacegeneric && webinterfacegeneric_menou1 && hybridshowdata.Names"
|
|
>
|
|
<div class="col-5">
|
|
<div class="input-group input-group-sm sm-3">
|
|
|
|
<!-- menou 1 --------------------------- -->
|
|
<div class="input-group-prepend">
|
|
<a :href="webinterfacegeneric_menou1_url" :target="webinterfacegeneric_menou1_url_target1"
|
|
v-if="webinterfacegeneric && webinterfacegeneric_menou1 && hybridshowdata.Names && !webinterfacegeneric_menou1typelog"
|
|
class="btn btn-outline-secondary"
|
|
role="button"> {{ webinterfacegeneric_menou1_text }}
|
|
</a>
|
|
<button
|
|
v-if="webinterfacegeneric && webinterfacegeneric_menou1 && hybridshowdata.Names && webinterfacegeneric_menou1typelog && !webinterfacegeneric_menou1typelog_active"
|
|
class="btn btn-outline-secondary"
|
|
round
|
|
type="button"
|
|
@click="guilogs(1)"
|
|
>
|
|
{{ webinterfacegeneric_menou1_text }}
|
|
</button>
|
|
|
|
<button
|
|
v-if="webinterfacegeneric && webinterfacegeneric_menou1 && hybridshowdata.Names && webinterfacegeneric_menou1typelog && webinterfacegeneric_menou1typelog_active"
|
|
class="btn btn-outline-warning"
|
|
round
|
|
type="button"
|
|
@click="guilogsclose(1)"
|
|
>
|
|
{{ webinterfacegeneric_menou1_text }}
|
|
</button>
|
|
</div>
|
|
|
|
<!-- menou 2 --------------------------- -->
|
|
<div class="input-group-prepend">
|
|
<a :href="webinterfacegeneric_menou2_url" :target="webinterfacegeneric_menou1_url_target2"
|
|
v-if="webinterfacegeneric && webinterfacegeneric_menou2 && hybridshowdata.Names && !webinterfacegeneric_menou2typelog"
|
|
class="btn btn-outline-secondary"
|
|
role="button"> {{ webinterfacegeneric_menou2_text }}
|
|
</a>
|
|
|
|
<button
|
|
v-if="webinterfacegeneric && webinterfacegeneric_menou2 && hybridshowdata.Names && webinterfacegeneric_menou2typelog && !webinterfacegeneric_menou2typelog_active"
|
|
class="btn btn-outline-secondary"
|
|
round
|
|
type="button"
|
|
@click="guilogs(2)"
|
|
>
|
|
{{ webinterfacegeneric_menou2_text }}
|
|
</button>
|
|
|
|
<button
|
|
v-if="webinterfacegeneric && webinterfacegeneric_menou2 && hybridshowdata.Names && webinterfacegeneric_menou2typelog && webinterfacegeneric_menou2typelog_active"
|
|
class="btn btn-outline-warning"
|
|
round
|
|
type="button"
|
|
@click="guilogsclose(2)"
|
|
>
|
|
{{ webinterfacegeneric_menou2_text }}
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<!-- menou 3 --------------------------- -->
|
|
<div class="input-group-prepend">
|
|
<a :href="webinterfacegeneric_menou3_url" :target="webinterfacegeneric_menou1_url_target3"
|
|
v-if="webinterfacegeneric && webinterfacegeneric_menou3 && hybridshowdata.Names && !webinterfacegeneric_menou3typelog"
|
|
class="btn btn-outline-secondary"
|
|
role="button"> {{ webinterfacegeneric_menou3_text }}
|
|
</a>
|
|
|
|
<button
|
|
v-if="webinterfacegeneric && webinterfacegeneric_menou3 && hybridshowdata.Names && webinterfacegeneric_menou3typelog && !webinterfacegeneric_menou3typelog_active"
|
|
class="btn btn-outline-secondary"
|
|
round
|
|
type="button"
|
|
@click="guilogs(3)"
|
|
>
|
|
{{ webinterfacegeneric_menou3_text }}
|
|
</button>
|
|
|
|
<button
|
|
v-if="webinterfacegeneric && webinterfacegeneric_menou3 && hybridshowdata.Names && webinterfacegeneric_menou3typelog && webinterfacegeneric_menou3typelog_active"
|
|
class="btn btn-outline-warning"
|
|
round
|
|
type="button"
|
|
@click="guilogsclose(3)"
|
|
>
|
|
{{ webinterfacegeneric_menou3_text }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</b-container>
|
|
|
|
<b-container fluid>
|
|
<div class="row" >
|
|
<div class="col-2 text-info" >
|
|
ID
|
|
</div>
|
|
<div class="col-3 text-muted" >
|
|
{{ hybridshowdata.ID }}
|
|
</div>
|
|
<div class="col-2 text-info" >
|
|
Image
|
|
</div>
|
|
<div class="col-4 text-muted" >
|
|
{{ hybridshowdata.Image }}
|
|
</div>
|
|
</div> <!-- row -->
|
|
<div class="row" >
|
|
<div class="col-2 text-info" >
|
|
Names
|
|
</div>
|
|
<div class="col-3 text-muted" >
|
|
{{ hybridshowdata.Names }}
|
|
</div>
|
|
<div class="col-2 text-info" >
|
|
RunningFor
|
|
</div>
|
|
<div class="col-4 text-muted" >
|
|
{{ hybridshowdata.RunningFor }}
|
|
</div>
|
|
</div> <!-- row -->
|
|
<div class="row" >
|
|
|
|
<div class="col-2 text-info" >
|
|
Status
|
|
</div>
|
|
<div class="col-3 text-muted" >
|
|
{{ hybridshowdata.Status }}
|
|
</div>
|
|
|
|
<div class="col-2 text-info" >
|
|
CreatedAt
|
|
</div>
|
|
<div class="col-4 text-muted" >
|
|
{{ hybridshowdata.CreatedAt }}
|
|
</div>
|
|
</div> <!-- row -->
|
|
<div class="row" >
|
|
<!-- menou networks -->
|
|
<div class="col-2 text-info"
|
|
v-if="actionrowindex"
|
|
>
|
|
<button
|
|
v-if="hybridshowdata.Networks&&addNetworkMenou==false"
|
|
class="btn btn-primary btn-sm"
|
|
round
|
|
type="button"
|
|
@click="addNetwork(hybridshowdata,'on')"
|
|
>
|
|
Networks</button>
|
|
<button
|
|
v-if="hybridshowdata.Networks&&addNetworkMenou==true"
|
|
class="btn btn-outline-warning btn-sm"
|
|
round
|
|
type="button"
|
|
@click="addNetwork(hybridshowdata,'off')"
|
|
>
|
|
Networks</button>
|
|
</div>
|
|
<div class="col-2 text-info"
|
|
v-else
|
|
>
|
|
Networks
|
|
</div>
|
|
<!-- menou networks -->
|
|
|
|
<div class="col-3 text-muted" >
|
|
{{ hybridshowdata.Networks }}
|
|
</div>
|
|
|
|
<div class="col-2 text-info" >
|
|
Ports
|
|
</div>
|
|
<div class="col-4 text-muted" >
|
|
{{ hybridshowdata.Ports }}
|
|
</div>
|
|
</div> <!-- row -->
|
|
<!--
|
|
'{"ID":"{{ .ID }}", "Image": "{{ .Image }}", "Names":"{{ .Names }}", "Ports":"{{.Ports}}",
|
|
"Networks":"{{.Networks}}", "Status":"{{.Status}}","RunningFor":"{{.RunningFor}}","CreatedAt":"{{.CreatedAt}}"}'
|
|
-->
|
|
</b-container>
|
|
|
|
<!-- Networks -->
|
|
|
|
<div class="card border-success bg-light mb-3" style="max-width: 100%;"
|
|
v-if="addNetworkMenou==true"
|
|
>
|
|
<div class="card-header"></div>
|
|
<div class="card-body text-info">
|
|
<div class="row">
|
|
<div class="col-6 text-info">
|
|
<h5 class="card-title">Select network</h5>
|
|
</div>
|
|
<div class="col-6 text-info">
|
|
Connect a running container to multiple networks
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-6 text-info">
|
|
<b-form-select v-model="selectedNetworks" :options="localNetworkoptions" multiple :select-size="4"></b-form-select>
|
|
<div class="mt-3">Selected: <strong>{{ selectedNetworks }}</strong></div>
|
|
</div>
|
|
<div class="col-6 text-info">
|
|
<img class="border-white img-thumbnail" src="@/assets/img/dockernetwork.png" alt="...">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-6 text-info">
|
|
<button
|
|
class="btn btn-warning btn-sm"
|
|
round
|
|
type="button"
|
|
@click="updateNetwork(hybridshowdata,'update')"
|
|
>
|
|
Update</button>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</card>
|
|
</template>
|
|
<script>
|
|
import store from '@/store/index'
|
|
import {mapState, mapGetters, mapActions,dispatch} from 'vuex'
|
|
import Vue from 'vue'
|
|
import card from '@/components/Card.vue'
|
|
import {ApiConfig} from "@/config/index";
|
|
import {ApiConfigGUI} from "@/config/index-gui";
|
|
import {ApiConfigWEB} from "@/config/index-web";
|
|
import {ApiConfigEDIT} from "@/config/index-editor";
|
|
import { extend } from 'vee-validate';
|
|
import { required, alpha_num } from 'vee-validate/dist/rules';
|
|
|
|
// No message specified.
|
|
extend('alpha_num', alpha_num);
|
|
|
|
// Override the default message.
|
|
extend('required', {
|
|
...required,
|
|
message: 'This field is required'
|
|
});
|
|
|
|
export default {
|
|
components: {
|
|
card
|
|
},
|
|
props: {
|
|
},
|
|
data() {
|
|
return{
|
|
actionrowindexconsole: false,
|
|
actionrowindex: false,
|
|
actionrowindexselect: true,
|
|
addNetworkMenou:false,
|
|
localNetworks:[],
|
|
selectedNetworks:[],
|
|
localNetworkoptions:[],
|
|
localNetworkdefault:'',
|
|
webinterface: false,
|
|
webinterfacegeneric: false,
|
|
webinterfacegeneric_text: 'openGui',
|
|
webinterfacegeneric_menou1_url_target1: '_blank',
|
|
webinterfacegeneric_menou1_url_target2: '_blank',
|
|
webinterfacegeneric_menou1_url_target3: '_blank',
|
|
|
|
webinterfacegeneric_menou_exec: '',
|
|
webinterfacegeneric_menou_basedir: '',
|
|
swarmlab_services_type: 'swarmlab',
|
|
|
|
webinterfacegeneric_menou1: false,
|
|
webinterfacegeneric_menou1_text: '',
|
|
webinterfacegeneric_menou1_url: '',
|
|
webinterfacegeneric_menou1typelog: false,
|
|
webinterfacegeneric_menou1typelog_active: false,
|
|
webinterfacegeneric_menou1typedir: '',
|
|
webinterfacegeneric_menou1typedir_log: '',
|
|
|
|
webinterfacegeneric_menou2: false,
|
|
webinterfacegeneric_menou2_text: '',
|
|
webinterfacegeneric_menou2_url: '',
|
|
webinterfacegeneric_menou2typelog: false,
|
|
webinterfacegeneric_menou2typelog_active: false,
|
|
webinterfacegeneric_menou2typedir: '',
|
|
webinterfacegeneric_menou2typedir_log: '',
|
|
|
|
webinterfacegeneric_menou3: false,
|
|
webinterfacegeneric_menou3_text: '',
|
|
webinterfacegeneric_menou3_url: '',
|
|
webinterfacegeneric_menou3typelog: false,
|
|
webinterfacegeneric_menou3typelog_active: false,
|
|
webinterfacegeneric_menou3typedir: '',
|
|
webinterfacegeneric_menou3typedir_log: '',
|
|
|
|
webinterfacegenericedit: false,
|
|
webinterface_port: '',
|
|
STATUS:{},
|
|
editor_instance:{
|
|
'start':'',
|
|
'port':''
|
|
},
|
|
CONFIG:{
|
|
'status':'',
|
|
'workerkey':'',
|
|
'swarmlab_public_wgkey':'',
|
|
'server_ip':'',
|
|
'allowed_ips':'',
|
|
'wg_port':'',
|
|
'wg_ip':'',
|
|
'swarm_ip':'',
|
|
'privatekey':'',
|
|
'publickey':'',
|
|
'workerkey':'',
|
|
'privatekey':'',
|
|
'publickey':'',
|
|
'server_ip':''
|
|
},
|
|
CONFIGallowed_ips:'',
|
|
swarmlabnamecustomstart:{},
|
|
swarmlabnamecustomdata:{},
|
|
swarmlabnamecustom:'',
|
|
swarmlabnamecustomservice:'',
|
|
swarmlabnamecustomuser:'',
|
|
swarmlabname:'swarmlab-sec',
|
|
swarmlabname_port:'',
|
|
swarmlabname_size:3,
|
|
swarmlabname_git:'',
|
|
// run on
|
|
hybridshowdata:{},
|
|
hybridshowdata_user:{},
|
|
hybridshowdatashare:{},
|
|
issocket:'close',
|
|
setFilter: {},
|
|
searchFor: {},
|
|
resetFilter: {}
|
|
|
|
}
|
|
},
|
|
beforeMount () {
|
|
this.socketopen();
|
|
this.socketauthenticate()
|
|
//console.log('send')
|
|
},
|
|
mounted() {
|
|
this.$root.$on('hybrid_show_info', (data) => {
|
|
(async () => {
|
|
// -------------- new menou
|
|
this.actionrowindex = false
|
|
this.actionrowindexselect = true
|
|
this.addNetworkMenou = false
|
|
this.actionrowindexconsole = false
|
|
this.$root.$emit('hybrid_show_instance_images','images')
|
|
// -------------- new menou
|
|
|
|
this.webinterface = false
|
|
this.webinterfacegeneric = false
|
|
this.webinterfacegenericedit = false
|
|
// this.$nextTick(function () {
|
|
this.hybridshowdata = data
|
|
var filterju = `microservice-jupyter`
|
|
var grepju = new RegExp(filterju);
|
|
if(grepju.test(data.Networks) && grepju.test(data.Names)){
|
|
this.webinterface = true
|
|
this.webinterface_port = data.Ports
|
|
}else{
|
|
this.webinterface = false
|
|
this.webinterface_port = ''
|
|
}
|
|
var urlgeniGUIEDITOR = this.hybridshowdata.Names.split('_');
|
|
// EDITOR
|
|
for(var i = 0; i < ApiConfigEDIT.length; i++) {
|
|
var obGUIEDIT = ApiConfigEDIT[i];
|
|
if(obGUIEDIT.name == urlgeniGUIEDITOR[0]){
|
|
this.webinterfacegenericedit = true
|
|
}
|
|
}
|
|
|
|
//EDITORcustom
|
|
var strbase = '_masterservice_1'
|
|
var sRegExInput1 = new RegExp(strbase, 'g');
|
|
var getcustomnames = this.hybridshowdata.Names.replace(sRegExInput1 ,'');
|
|
var logdatacustom = await store.dispatch("pipelineLLO/getinstallcustom",{
|
|
token:this.token,
|
|
instance:getcustomnames
|
|
})
|
|
//console.log(logdatacustom.data);
|
|
if(logdatacustom.data && logdatacustom.data.data){
|
|
this.hybridshowdata_user = JSON.parse(logdatacustom.data.data)
|
|
console.log(this.hybridshowdata_user);
|
|
var urlgeniGUIEDITOR = this.hybridshowdata.Names.split('_');
|
|
this.webinterfacegenericedit = true
|
|
var urlgeniGUI = this.hybridshowdata_user.servicedata.baseservice
|
|
this.swarmlab_services_type = 'custom'
|
|
}else{
|
|
var urlgeniGUItmp = this.hybridshowdata.Names.split('_');
|
|
var urlgeniGUI = urlgeniGUItmp[0]
|
|
this.swarmlab_services_type = 'swarmlab'
|
|
}
|
|
// GUI firefox
|
|
for(var i = 0; i < ApiConfigGUI.length; i++) {
|
|
var obGUI = ApiConfigGUI[i];
|
|
if(obGUI.name == urlgeniGUI){
|
|
this.webinterfacegeneric = true
|
|
this.webinterfacegeneric_text = obGUI.menou
|
|
this.webinterfacegeneric_menou_exec = obGUI.exec
|
|
//console.log(obGUI.name);
|
|
if(this.hybridshowdata_user.servicedata && this.swarmlab_services_type == 'custom'){
|
|
var baseservicetmp1 = this.hybridshowdata_user.servicedata.user.split('@')
|
|
var baseservicecustom = `${baseservicetmp1[0]}-${this.hybridshowdata_user.servicedata.service}`
|
|
this.webinterfacegeneric_menou_basedir = `community/${this.hybridshowdata_user.servicedata.user}_${this.hybridshowdata_user.servicedata.service}_${this.hybridshowdata_user.servicedata.baseservice}/${baseservicecustom}`
|
|
}else{
|
|
var baseservicetmp1 = this.hybridshowdata.Names.split('_')
|
|
this.webinterfacegeneric_menou_basedir = `instance/${baseservicetmp1[0]}/${baseservicetmp1[0]}`
|
|
}
|
|
|
|
if(obGUI.menou1){
|
|
this.webinterfacegeneric_menou1 = true
|
|
this.webinterfacegeneric_menou1_text = obGUI.menou1
|
|
this.webinterfacegeneric_menou1_url = `${obGUI.menou1server}/${this.webinterfacegeneric_menou_basedir}/${obGUI.menou1url}`
|
|
this.webinterfacegeneric_menou1_url_target1 = urlgeniGUI+'_1'
|
|
if(obGUI.menou1type == 'log'){
|
|
this.webinterfacegeneric_menou1typelog = true
|
|
this.webinterfacegeneric_menou1typedir = `${this.webinterfacegeneric_menou_basedir}/${obGUI.menou2url}`
|
|
}
|
|
|
|
}
|
|
if(obGUI.menou2){
|
|
this.webinterfacegeneric_menou2 = true
|
|
this.webinterfacegeneric_menou2_text = obGUI.menou2
|
|
this.webinterfacegeneric_menou2_url = `${obGUI.menou2server}/${this.webinterfacegeneric_menou_basedir}/${obGUI.menou2url}`
|
|
this.webinterfacegeneric_menou1_url_target2 = urlgeniGUI+'_2'
|
|
if(obGUI.menou2type){
|
|
if(obGUI.menou2type == 'log'){
|
|
this.webinterfacegeneric_menou2typelog = true
|
|
this.webinterfacegeneric_menou2typedir = `${this.webinterfacegeneric_menou_basedir}/${obGUI.menou2url}`
|
|
}
|
|
}
|
|
}
|
|
if(obGUI.menou3){
|
|
this.webinterfacegeneric_menou3 = true
|
|
this.webinterfacegeneric_menou3_text = obGUI.menou3
|
|
this.webinterfacegeneric_menou3_url = `${obGUI.menou3server}/${this.webinterfacegeneric_menou_basedir}/${obGUI.menou3url}`
|
|
this.webinterfacegeneric_menou1_url_target2 = urlgeniGUI+'_3'
|
|
if(obGUI.menou3type == 'log'){
|
|
this.webinterfacegeneric_menou3typelog = true
|
|
this.webinterfacegeneric_menou3typedir = `${this.webinterfacegeneric_menou_basedir}/${obGUI.menou2url}`
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
this.addNetworkMenou = false
|
|
this.localNetworks = []
|
|
this.selectedNetworks = []
|
|
this.localNetworkoptions = []
|
|
this.localNetworkdefault = ''
|
|
//console.log(JSON.stringify(this.hybridshowdata))
|
|
// })
|
|
})();
|
|
})
|
|
|
|
// from available services socket run here
|
|
this.$root.$on('hybrid_start_instance', (data) => {
|
|
this.swarmlabname = data.swarmlabname
|
|
if(data.size){
|
|
this.swarmlabname_size = data.size
|
|
}
|
|
if(data.port){
|
|
this.swarmlabname_port = data.port
|
|
}
|
|
//console.log('RUN exec '+JSON.stringify(this.swarmlabname))
|
|
this.onAction('start')
|
|
})
|
|
// from available servicescustom socket run here
|
|
this.$root.$on('hybrid_start_instance_custom', (data) => {
|
|
this.swarmlabnamecustomdata = data.baseservicedata
|
|
//this.hybridoptions.baseservicedata
|
|
//this.swarmlabname = data.swarmlabname
|
|
this.swarmlabnamecustomstart = data
|
|
if(data.size){
|
|
this.swarmlabname_size = data.size
|
|
}
|
|
if(data.port){
|
|
this.swarmlabname_port = data.port
|
|
}
|
|
//console.log('RUN exec '+JSON.stringify(this.swarmlabname))
|
|
this.onAction('startcustom')
|
|
})
|
|
this.$root.$on('hybrid_start_instance_storage', (data) => {
|
|
var obj = {}
|
|
obj.action = 'up'
|
|
obj.token = this.token
|
|
obj.swarmlabname = data.swarmlabname
|
|
obj.password = data.password
|
|
this.$socket.client.open();
|
|
this.$socket.client.emit('start_storage', obj);
|
|
})
|
|
this.$root.$on('hybrid_start_instance_poc', (data) => {
|
|
var obj = {}
|
|
obj.action = 'up'
|
|
obj.token = this.token
|
|
obj.swarmlabname = data.swarmlabname
|
|
obj.password = data.password
|
|
this.$socket.client.open();
|
|
this.$socket.client.emit('start_poc', obj);
|
|
})
|
|
// build
|
|
this.$root.$on('SERVER_build_image', (obj) => {
|
|
this.$socket.client.open();
|
|
this.$socket.client.emit('build_image', obj);
|
|
})
|
|
this.$root.$on('SERVER_build_vmlist', (data) => {
|
|
var obj = {}
|
|
obj.action = 'up'
|
|
obj.token = this.token
|
|
obj.kill = 2
|
|
this.$socket.client.open();
|
|
this.$socket.client.emit('build_vmlist', obj);
|
|
})
|
|
this.$root.$on('SERVER_build_kill', (data) => {
|
|
var obj = {}
|
|
obj.action = 'up'
|
|
obj.token = this.token
|
|
obj.kill = data.pid
|
|
this.$socket.client.open();
|
|
this.$socket.client.emit('build_kill', obj);
|
|
})
|
|
// from available services socket run here
|
|
this.$root.$on('hybrid_install_instance', (data) => {
|
|
this.swarmlabname = data.swarmlabname
|
|
this.swarmlabname_git = data.git
|
|
//this.swarmlabname_port = data.port
|
|
this.onAction('install')
|
|
})
|
|
// from available myservices socket run here
|
|
this.$root.$on('hybrid_install_instance_custom', (data) => {
|
|
this.swarmlabnamecustomdata = data.baseservicedata
|
|
this.swarmlabnamecustom = data.baseservice
|
|
this.swarmlabnamecustomservice = data.service
|
|
this.swarmlabnamecustomuser = data.user
|
|
this.swarmlabname_git = data.git
|
|
//this.swarmlabname_port = data.port
|
|
this.onAction('installcustom')
|
|
})
|
|
// from available storage socket run here
|
|
this.$root.$on('hybrid_install_instance_storage', (data) => {
|
|
//this.swarmlabname = data.swarmlabname
|
|
//this.swarmlabname_git = data.git
|
|
var obj = {}
|
|
obj.action = 'up'
|
|
obj.token = this.token
|
|
obj.swarmlabname = data.swarmlabname
|
|
obj.git = data.git
|
|
this.$socket.client.open();
|
|
this.$socket.client.emit('installstorage', obj);
|
|
})
|
|
// from available services socket run here
|
|
this.$root.$on('hybrid_connect_server', (data) => {
|
|
//this.onAction('create-wirequard')
|
|
this.$socket.client.emit('get-serverconfig');
|
|
})
|
|
// from available services socket run here
|
|
this.$root.$on('hybrid_stop_instance', (data) => {
|
|
this.swarmlabname = data
|
|
//console.log('RUN exec '+JSON.stringify(this.swarmlabname))
|
|
this.onAction('stop')
|
|
})
|
|
// from available storage socket run here
|
|
this.$root.$on('hybrid_stop_instance_storage', (data) => {
|
|
//this.swarmlabname = data
|
|
//console.log('RUN exec '+JSON.stringify(this.swarmlabname))
|
|
//this.onAction('stop')
|
|
this.$socket.client.emit('stop_storage', data);
|
|
})
|
|
// from available poc socket run here
|
|
this.$root.$on('hybrid_stop_instance_poc', (data) => {
|
|
//this.swarmlabname = data
|
|
//console.log('RUN exec '+JSON.stringify(this.swarmlabname))
|
|
//this.onAction('stop')
|
|
this.$socket.client.emit('stop_poc', data);
|
|
})
|
|
},
|
|
created() {
|
|
var url_string = window.location.href
|
|
var url = new URL(url_string);
|
|
this.token = url.searchParams.get("token");
|
|
//console.log("token "+ this.token);
|
|
var log = store.dispatch("pipelineLLO/settoken",{
|
|
token:this.token
|
|
})
|
|
this.socketopen();
|
|
|
|
},
|
|
beforeDestroy () {
|
|
this.$root.$off('hybrid_show_info')
|
|
this.$root.$off('hybrid_start_instance')
|
|
this.$root.$off('hybrid_start_instance_custom')
|
|
this.$root.$off('hybrid_stop_instance')
|
|
this.$root.$off('hybrid_connect_server')
|
|
this.$root.$off('hybrid_install_instance')
|
|
this.$root.$off('hybrid_install_instance_custom')
|
|
this.$root.$off('hybrid_install_instance_storage')
|
|
this.$root.$off('SERVER_build_vmlist')
|
|
this.$root.$off('SERVER_build_kill')
|
|
this.$root.$off('SERVER_build_image')
|
|
},
|
|
computed: {
|
|
httpOptions() {
|
|
var token = this.token
|
|
var p="headers: {Authorization: token}}"; //table props -> :http-options="httpOptions"
|
|
return {headers: {Authorization: 'Bearer ' + token}} //table props -> :http-options="httpOptions"
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
async guilogsclose(action){
|
|
this.webinterfacegeneric_menou1typelog_active = false
|
|
this.webinterfacegeneric_menou2typelog_active = false
|
|
this.webinterfacegeneric_menou3typelog_active = false
|
|
this.actionrowindexconsole = false
|
|
this.$root.$emit('hybrid_show_instance_images','images')
|
|
},
|
|
async guilogs(action){
|
|
var logdatacustom = await store.dispatch("pipelineLLO/getlog4gui",{
|
|
token:this.token,
|
|
instance:this.webinterfacegeneric_menou2typedir
|
|
})
|
|
if(!logdatacustom.data.error){
|
|
if(logdatacustom.data.log != 'no'){
|
|
if(action == 1){
|
|
this.webinterfacegeneric_menou1typedir_log = logdatacustom.data.log
|
|
this.webinterfacegeneric_menou1typelog_active = true
|
|
this.actionrowindexconsole = true
|
|
this.$root.$emit('hybrid_show_instance_images','console')
|
|
var val = {}
|
|
val.data = this.webinterfacegeneric_menou1typedir_log
|
|
var log = await store.dispatch("pipelineLLO/getlogs",{
|
|
container:this.hybridshowdata.ID
|
|
})
|
|
this.$root.$emit('hybrid_log_in',val)
|
|
}else if(action == 2){
|
|
this.webinterfacegeneric_menou2typedir_log = logdatacustom.data.log
|
|
this.webinterfacegeneric_menou2typelog_active = true
|
|
this.actionrowindexconsole = true
|
|
this.$root.$emit('hybrid_show_instance_images','console')
|
|
var val = {}
|
|
val.data = this.webinterfacegeneric_menou2typedir_log
|
|
var log = await store.dispatch("pipelineLLO/getlogs",{
|
|
container:this.hybridshowdata.ID
|
|
})
|
|
this.$root.$emit('hybrid_log_in',val)
|
|
}else if(action == 3){
|
|
this.webinterfacegeneric_menou3typedir_log = logdatacustom.data.log
|
|
this.webinterfacegeneric_menou3typelog_active = true
|
|
this.actionrowindexconsole = true
|
|
this.$root.$emit('hybrid_show_instance_images','console')
|
|
var val = {}
|
|
val.data = this.webinterfacegeneric_menou3typedir_log
|
|
var log = await store.dispatch("pipelineLLO/getlogs",{
|
|
container:this.hybridshowdata.ID
|
|
})
|
|
this.$root.$emit('hybrid_log_in',val)
|
|
}
|
|
}
|
|
}
|
|
},
|
|
async updateNetwork(container,action){
|
|
// console.log(JSON.stringify(container));
|
|
// console.log(JSON.stringify('selected :' + this.selectedNetworks));
|
|
var log = await store.dispatch("pipelineLLO/updatenetworks",{
|
|
networks:this.selectedNetworks,
|
|
defaultnetwork:this.localNetworkdefault,
|
|
container:container.ID
|
|
})
|
|
this.$root.$emit('hybrid_refresh_networktable')
|
|
this.hybridshowdata = {}
|
|
this.addNetworkMenou = false
|
|
this.localNetworks = []
|
|
this.selectedNetworks = []
|
|
this.localNetworkoptions = []
|
|
this.localNetworkdefault = ''
|
|
// console.log(JSON.stringify(log.data.data));
|
|
},
|
|
async addNetwork(container,action){
|
|
if(action == 'on'){
|
|
this.addNetworkMenou = true
|
|
var log = await store.dispatch("pipelineLLO/getnetworks",{
|
|
instance:container.ID
|
|
})
|
|
this.localNetworks = log.data.data
|
|
var searchnet = ''
|
|
this.localNetworkoptions = []
|
|
for(var i = 0; i < this.localNetworks.length; i++) {
|
|
this.localNetworkdefault = this.localNetworks[i].NetworkMode[0]
|
|
var NET = {}
|
|
NET.text = this.localNetworks[i].Name
|
|
NET.value = this.localNetworks[i].Name
|
|
|
|
searchnet = new RegExp(this.localNetworks[i].NetworkMode[0]);
|
|
//console.log(this.localNetworks[i].NetworkMode[0] +' - ' + this.localNetworks[i].Name );
|
|
if(searchnet.test(this.localNetworks[i].Name)){
|
|
NET.disabled = true
|
|
}else{
|
|
NET.disabled = false
|
|
}
|
|
|
|
this.localNetworkoptions.push(NET)
|
|
}
|
|
// console.log(JSON.stringify(this.localNetworks));
|
|
}else if(action == 'off'){
|
|
this.addNetworkMenou = false
|
|
}
|
|
// console.log(container);
|
|
},
|
|
async backupAndClose(result){
|
|
if (result.isConfirmed) {
|
|
var log = await store.dispatch("pipelineLLO/runbackup",{
|
|
instance: this.hybridshowdata.Names
|
|
})
|
|
}else {
|
|
console.log('no')
|
|
}
|
|
},
|
|
async onAction(action){
|
|
if(action == 'start'){
|
|
var obj = {}
|
|
obj.action = 'up'
|
|
obj.token = this.token
|
|
obj.swarmlabname = this.swarmlabname
|
|
obj.swarmlabname_size = this.swarmlabname_size
|
|
obj.swarmlabname_port = this.swarmlabname_port
|
|
//this.$socket.client.emit('action', obj);
|
|
//this.$socket.client.emit('actionstart', obj);
|
|
this.$socket.client.open();
|
|
//this.$socket.client.emit('start', this.swarmlabname);
|
|
this.$socket.client.emit('start', obj);
|
|
//console.log('start ' + JSON.stringify(log))
|
|
//console.log('startobj ' + JSON.stringify(obj))
|
|
////console.log(this.$socket.client.connect())
|
|
}else if(action == 'startcustom'){
|
|
this.$socket.client.open();
|
|
//this.$socket.client.emit('start', this.swarmlabnamecustomstart);
|
|
this.swarmlabnamecustomstart.baseservicedata = this.swarmlabnamecustomdata
|
|
this.$socket.client.emit('startcustom', this.swarmlabnamecustomstart);
|
|
}else if(action == 'basedireditor'){
|
|
this.$wait.start('myRunInstanceeditor');
|
|
//console.log('volumes-from-------- ' + JSON.stringify(this.hybridshowdata.Names))
|
|
var log = await store.dispatch("pipelineLLO/runeditor",{
|
|
token:this.token,
|
|
instance:this.hybridshowdata.Names
|
|
})
|
|
//console.log('start editor-------- ' + JSON.stringify(this.hybridshowdata.Names))
|
|
//console.log('start token-------- ' + JSON.stringify(log.data.port))
|
|
this.$root.$emit('SERVER_hybrid_table_stop')
|
|
|
|
|
|
}else if(action == 'basebackupview'){
|
|
var info=`<h5><b>Backups</b><br>
|
|
<br>
|
|
`
|
|
info +='<p class="text-secondary">'
|
|
info +=' <b>Click on hyperlink opens Directory in new tab</b></p>'
|
|
info +='<b> <a class="text-info" href="http://127.0.0.1:3383/" target="_blank">View Backups</a></b>'
|
|
info +='<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 == 'basebackup'){
|
|
var info = "Create a full backup of persistent data: <br><br> <p><b>" + this.hybridshowdata.Names
|
|
info += "</b></p><br>"
|
|
this.$swal({
|
|
type: 'info',
|
|
html: info,
|
|
icon:'info',
|
|
showCloseButton: true,
|
|
showLoaderOnConfirm: false,
|
|
allowOutsideClick: false,
|
|
cancelButtonText: 'No, cancel!',
|
|
showCancelButton: true,
|
|
showLoaderOnConfirm: false,
|
|
reverseButtons: true,
|
|
focusCancel: false,
|
|
confirmButtonText: 'Yes!'
|
|
}).then((result)=> {
|
|
this.backupAndClose(result);
|
|
})
|
|
}else if(action == 'basedir'){
|
|
var log = await store.dispatch("pipelineLLO/getmountinfo",{
|
|
instance:this.hybridshowdata.Names
|
|
})
|
|
var pocmypathtmp1 = log.data.mypath
|
|
var myNetwork1 = this.hybridshowdata.Networks.split('_')
|
|
var pocmypath1 = pocmypathtmp1 + myNetwork1[0]
|
|
var pocmypathinfo1 = ''
|
|
if(pocmypath1 != ''){
|
|
pocmypathinfo1 += '<b>Project BaseDir:</b> '+pocmypath1
|
|
}
|
|
var info=`<h5><b>Base Directory - Persistent data</b><br>
|
|
<br>
|
|
`
|
|
var myNetworkiservices = this.hybridshowdata.Networks.split('_')
|
|
info +='<p class="text-primary">'
|
|
info +=' <b>Click on hyperlink opens Directory in new tab</b></p>'
|
|
info +=' <table>'
|
|
info +='<tr><td><b>Local</b></td><td><i>Container</i></td></tr>'
|
|
var datajson = log.data.test[0]
|
|
var extendsearch = new RegExp(myNetworkiservices[0]);
|
|
var extendsearch1 = new RegExp('sec_bootstrap');
|
|
for(var i = 0; i < datajson.length; i++) {
|
|
if(datajson[i].Type == 'bind'){
|
|
if(extendsearch.test(datajson[i].Source) && !extendsearch1.test(datajson[i].Source) ){
|
|
var basedir1 = datajson[i].Source.indexOf(myNetworkiservices[0]);
|
|
info +='<tr style="outline: thin solid"><td><b> <a class="text-info" href="http://127.0.0.1:3382/'+datajson[i].Source.slice(basedir1)+'" target="_blank">'+datajson[i].Source+'</a></b></td><td><i>' + datajson[i].Destination+' </i></td></tr>'
|
|
}
|
|
}
|
|
}
|
|
info +=' </table>'
|
|
info += '<br><p>'
|
|
info += pocmypathinfo1
|
|
info += '</p>'
|
|
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 == 'shareinfo'){
|
|
var openuerlju = 'no'
|
|
var search = 'microservice-jupyter'
|
|
var extenderror = new RegExp(search);
|
|
if(extenderror.test(this.hybridshowdata.Names)){
|
|
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
|
|
openuerlju = `http://${juurlok}/?token=${jutokenok}`
|
|
}
|
|
}
|
|
var log = await store.dispatch("pipelineLLO/getshareinfo",{
|
|
instance:this.hybridshowdata.Names
|
|
})
|
|
//console.log('logsserver1---------- ' + JSON.stringify(log.data.network))
|
|
this.hybridshowdatashare = log.data.network
|
|
var IP = this.hybridshowdatashare.IPv4Address.split('/');
|
|
var search1 = '->'
|
|
var search3 = ','
|
|
var extenderror1 = new RegExp(search1);
|
|
var extenderror3 = new RegExp(search3);
|
|
var info = ''
|
|
// url port einai polla
|
|
if(extenderror1.test(this.hybridshowdata.Ports) ){
|
|
try {
|
|
if(extenderror3.test(this.hybridshowdata.Ports)){
|
|
var PORTSport = this.hybridshowdata.Ports.split(',');
|
|
for(var iaa = 0; iaa < PORTSport.length; iaa++){
|
|
var PORTStmp = PORTSport[iaa].split('->');
|
|
var PORTS = PORTSport[iaa].split('/');
|
|
if( openuerlju == 'no'){
|
|
info += `<h5>URL: ${IP[0]}:${PORTS[0]}</h5>`
|
|
}else{
|
|
info += `<h5>URL: ${IP[0]}:${PORTS[0]}/?token=${jutokenok}</h5>`
|
|
}
|
|
}
|
|
}else{
|
|
var PORTStmp = this.hybridshowdata.Ports.split('->');
|
|
var PORTS = PORTStmp[1].split('/');
|
|
var info = ''
|
|
if( openuerlju == 'no'){
|
|
info = `<h5>URL: ${IP[0]}:${PORTS[0]}</h5>`
|
|
}else{
|
|
info = `<h5>URL: ${IP[0]}:${PORTS[0]}/?token=${jutokenok}</h5>`
|
|
}
|
|
}
|
|
} catch (e) {
|
|
}
|
|
}
|
|
this.$swal({
|
|
title: '<strong>Share info</strong>',
|
|
type: 'info',
|
|
html: info,
|
|
showCloseButton: true,
|
|
showLoaderOnConfirm: false,
|
|
allowOutsideClick: false
|
|
})
|
|
}else if(action == 'container-logs'){
|
|
this.actionrowindexconsole = true
|
|
this.$root.$emit('hybrid_show_instance_images','console')
|
|
var log = await store.dispatch("pipelineLLO/getlogs",{
|
|
container:this.hybridshowdata.ID
|
|
})
|
|
}else if(action == 'container-logsclose'){
|
|
this.actionrowindexconsole = false
|
|
this.$root.$emit('hybrid_show_instance_images','images')
|
|
this.webinterfacegeneric_menou1typelog_active = false
|
|
this.webinterfacegeneric_menou2typelog_active = false
|
|
this.webinterfacegeneric_menou3typelog_active = false
|
|
}else if(action == 'startwebgeneric'){
|
|
this.$wait.start('myRunInstanceeditor');
|
|
var urlgen = this.hybridshowdata.Names.split('_');
|
|
//console.log('logs---------- ' + JSON.stringify(this.hybridshowdata))
|
|
//console.log('logs---------- ' + JSON.stringify(urlgen[0]))
|
|
if(this.swarmlab_services_type == 'swarmlab'){
|
|
var log = await store.dispatch("pipelineLLO/rungui",{
|
|
instance:urlgen[0]
|
|
})
|
|
} else if(this.swarmlab_services_type == 'custom'){
|
|
var baseservicetmp1as = this.hybridshowdata_user.servicedata.user.split('@')
|
|
var baseservicecustomas = `${baseservicetmp1as[0]}-${this.hybridshowdata_user.servicedata.service}`
|
|
var guicustom = `community/${this.hybridshowdata_user.servicedata.user}_${this.hybridshowdata_user.servicedata.service}_${this.hybridshowdata_user.servicedata.baseservice}/${baseservicecustomas}`
|
|
var log = await store.dispatch("pipelineLLO/runguicustom",{
|
|
instance:guicustom,
|
|
exec:this.webinterfacegeneric_menou_exec,
|
|
id:baseservicecustomas
|
|
})
|
|
}
|
|
this.$wait.end('myRunInstanceeditor');
|
|
}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}`
|
|
//var info=`<h5>You can connect to the same contained process multiple times simultaneously, from different sessions.<br>
|
|
var info=`<h5>
|
|
<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
|
|
})
|
|
var pocmypathtmp = log.data.mypath
|
|
var container_bash = '/bin/sh'
|
|
var container_user = false
|
|
var swarmlabinstance = new RegExp("^(hybrid-|HYBRID-)");
|
|
if(swarmlabinstance.test(this.hybridshowdata.Names)){
|
|
container_user = true
|
|
container_bash = '/bin/bash'
|
|
var container_user_swarmlab = 'docker'
|
|
}
|
|
// -----
|
|
var swarmlabinstance1c = new RegExp("(/poc-|/POC-)");
|
|
var pocurl = 'no'
|
|
|
|
var myNetwork = this.hybridshowdata.Networks.split('_')
|
|
var pocmypath = pocmypathtmp + myNetwork[0]
|
|
if(swarmlabinstance1c.test(this.hybridshowdata.Image)){
|
|
var swarmlabinstance1cd = new RegExp("(->)");
|
|
if(swarmlabinstance1cd.test(this.hybridshowdata.Ports)){
|
|
var splitcd = this.hybridshowdata.Ports.split(':')
|
|
var splitcd1 = splitcd[1].split('-')
|
|
var swarmlabinstance1ce = new RegExp("^(web)");
|
|
if(swarmlabinstance1ce.test(this.hybridshowdata.Names)){
|
|
pocurl = 'http://localhost:'+splitcd1[0]+'/?token='+this.token
|
|
}
|
|
}
|
|
}
|
|
// -----
|
|
var swarmlabinstance1ca = new RegExp("(microservice-codeserver)");
|
|
var pocurlcodeserver = 'no'
|
|
if(swarmlabinstance1ca.test(this.hybridshowdata.Names)){
|
|
var swarmlabinstance1cda = new RegExp("(->)");
|
|
if(swarmlabinstance1cda.test(this.hybridshowdata.Ports)){
|
|
var splitcda = this.hybridshowdata.Ports.split(':')
|
|
var splitcd1a = splitcda[1].split('-')
|
|
pocurlcodeserver = 'http://localhost:'+splitcd1a[0]+'/?token='+this.token
|
|
}
|
|
}
|
|
//console.log('stringify--------- ' + JSON.stringify(pocurlcodeserver));
|
|
|
|
// -----
|
|
var swarmlabinstance = new RegExp("^(hybrid-|HYBRID-)");
|
|
if(swarmlabinstance.test(this.hybridshowdata.Names)){
|
|
container_user = true
|
|
container_bash = '/bin/bash'
|
|
var container_user_swarmlab = 'docker'
|
|
}
|
|
|
|
//var Localpath = JSON.parse(log.data.test)
|
|
var info=`<h5>
|
|
<hr>
|
|
<b>Open a terminal and Run*:</b>
|
|
<br>
|
|
<br>
|
|
`
|
|
if(container_user){
|
|
info +='<p class="text-success">'
|
|
info += 'docker exec -it -u'+container_user_swarmlab+' '+this.hybridshowdata.Names+' ' + container_bash
|
|
info +='</p>'
|
|
}else{
|
|
info +='<p class="text-success">'
|
|
info += 'docker exec -it '+this.hybridshowdata.Names+' ' + container_bash
|
|
info +='</p>'
|
|
}
|
|
|
|
if(pocurl != 'no'){
|
|
info +='<p class="text-info">'
|
|
info += '<a href="'+pocurl+'" target="_blank">Click here to open the Web_App</a>'
|
|
info +='</p>'
|
|
}
|
|
|
|
|
|
if(pocurlcodeserver != 'no'){
|
|
info +='<p class="text-info">'
|
|
info += '<a href="'+pocurlcodeserver+'" target="_blank">Click here to open the Web_App</a>'
|
|
info +='</p>'
|
|
}
|
|
|
|
// find web url
|
|
// ipv4
|
|
// ApiConfigWEB.port = port
|
|
var urlgenWEB = this.hybridshowdata.Names.split('_');
|
|
var pocurletherpadserver = 'no'
|
|
var pocurletherpadserverttyd = 'no'
|
|
var pocurletherpadservertapp1 = 'no'
|
|
var pocurletherpadservertapp1text = 'no'
|
|
var pocurletherpadservertapp2 = 'no'
|
|
var pocurletherpadservertapp2text = 'no'
|
|
var pocurletherpadservertapp3 = 'no'
|
|
var pocurletherpadservertapp3text = 'no'
|
|
|
|
var pocurletherpadservertapp3port1 = 'no'
|
|
var pocurletherpadservertapp3textport1 = 'no'
|
|
var pocurletherpadservertapp3port2 = 'no'
|
|
var pocurletherpadservertapp3textport2 = 'no'
|
|
var pocurletherpadservertapp3port3 = 'no'
|
|
var pocurletherpadservertapp3textport3 = 'no'
|
|
var pocurletherpadservertapp3port4 = 'no'
|
|
var pocurletherpadservertapp3textport4 = 'no'
|
|
var pocurletherpadservertapp3port5 = 'no'
|
|
var pocurletherpadservertapp3textport5 = 'no'
|
|
for(var i = 0; i < ApiConfigWEB.length; i++) {
|
|
var obWEB = ApiConfigWEB[i];
|
|
if(obWEB.name == urlgenWEB[0]){
|
|
var swarmlabinstance1cda1 = new RegExp("(->)");
|
|
if(swarmlabinstance1cda1.test(this.hybridshowdata.Ports)){
|
|
var splitcda1split = this.hybridshowdata.Ports.split(',')
|
|
for(var i1 = 0; i1 < splitcda1split.length; i1++) {
|
|
|
|
var swarmlabinstance1cda1s = new RegExp("(0.0.0.0)");
|
|
if(swarmlabinstance1cda1s.test(splitcda1split[i1])){
|
|
|
|
if(obWEB.app){
|
|
var swarmlabinstance1cda1s1 = new RegExp(obWEB.port);
|
|
if(swarmlabinstance1cda1s1.test(splitcda1split[i1])){
|
|
var splitcda1 = splitcda1split[i1].split(':')
|
|
var splitcd1a1 = splitcda1[1].split('-')
|
|
pocurletherpadserver = obWEB.url+'://localhost:'+splitcd1a1[0]+'/?token='+this.token
|
|
}
|
|
}
|
|
|
|
if(obWEB.ttyd){
|
|
var swarmlabinstance1cda1s1b = new RegExp(obWEB.ttydport);
|
|
if(swarmlabinstance1cda1s1b.test(splitcda1split[i1])){
|
|
//console.log('stringify--------- ' + JSON.stringify(splitcda1split[i1]));
|
|
var splitcda1bc = splitcda1split[i1].split(':')
|
|
var splitcd1a1bc = splitcda1bc[1].split('-')
|
|
pocurletherpadserverttyd = obWEB.ttydurl+'://localhost:'+splitcd1a1bc[0]+'/?token='+this.token
|
|
}
|
|
}
|
|
// ---------------
|
|
if(obWEB.hasOwnProperty('app1')){
|
|
if(obWEB.app1){
|
|
var swarmlabinstance1cda1s1bapp1 = new RegExp(obWEB.port1);
|
|
if(swarmlabinstance1cda1s1bapp1.test(splitcda1split[i1])){
|
|
//console.log('stringify--------- ' + JSON.stringify(splitcda1split[i1]));
|
|
var splitcda1bcapp1 = splitcda1split[i1].split(':')
|
|
var splitcd1a1bcapp1 = splitcda1bcapp1[1].split('-')
|
|
pocurletherpadservertapp1 = obWEB.url1+'://localhost:'+splitcd1a1bcapp1[0]+'/?token='+this.token
|
|
pocurletherpadservertapp1text = obWEB.link1
|
|
}
|
|
}
|
|
}
|
|
// ---------------
|
|
|
|
// ---------------
|
|
if(obWEB.hasOwnProperty('app2')){
|
|
if(obWEB.app2){
|
|
var swarmlabinstance1cda1s1bapp2 = new RegExp(obWEB.port2);
|
|
if(swarmlabinstance1cda1s1bapp2.test(splitcda1split[i1])){
|
|
console.log('stringify--------- ' + JSON.stringify(splitcda1split[i1]));
|
|
var splitcda1bcapp2 = splitcda1split[i1].split(':')
|
|
var splitcd1a1bcapp2 = splitcda1bcapp2[1].split('-')
|
|
pocurletherpadservertapp2 = obWEB.url2+'://localhost:'+splitcd1a1bcapp2[0]+'/?token='+this.token
|
|
pocurletherpadservertapp2text = obWEB.link2
|
|
}
|
|
}
|
|
}
|
|
// ---------------
|
|
|
|
// ---------------
|
|
if(obWEB.hasOwnProperty('app3')){
|
|
if(obWEB.app3){
|
|
var swarmlabinstance1cda1s1bapp3 = new RegExp(obWEB.port3);
|
|
if(swarmlabinstance1cda1s1bapp3.test(splitcda1split[i1])){
|
|
//console.log('stringify--------- ' + JSON.stringify(splitcda1split[i1]));
|
|
var splitcda1bcapp3 = splitcda1split[i1].split(':')
|
|
var splitcd1a1bcapp3 = splitcda1bcapp3[1].split('-')
|
|
pocurletherpadservertapp3 = obWEB.url3+'://localhost:'+splitcd1a1bcapp3[0]+'/?token='+this.token
|
|
pocurletherpadservertapp3text = obWEB.link3
|
|
}
|
|
}
|
|
}
|
|
// ---------------
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// -------------------------------------------------------
|
|
// ----- customservice
|
|
// -------------------------------------------------------
|
|
// ---------------------------
|
|
// ------------------------- CUSTOM
|
|
// -------------------------------------------------------
|
|
var strbase = '_masterservice_1'
|
|
var sRegExInput1 = new RegExp(strbase, 'g');
|
|
var getcustomnames = this.hybridshowdata.Names.replace(sRegExInput1 ,'');
|
|
var logdatacustom = await store.dispatch("pipelineLLO/getinstallcustom",{
|
|
token:this.token,
|
|
instance:getcustomnames
|
|
})
|
|
//console.log('---------------------')
|
|
//console.log(logdatacustom.data)
|
|
if(logdatacustom.data && logdatacustom.data.data){
|
|
// EDITORcustom
|
|
|
|
|
|
var logdatacustomres = JSON.parse(logdatacustom.data.data)
|
|
// console.log(JSON.parse(logdatacustom.data.data))
|
|
//console.log('------111111111111111---------------')
|
|
|
|
var swarmlabinstance1cda1 = new RegExp("(->)");
|
|
if(swarmlabinstance1cda1.test(this.hybridshowdata.Ports)){
|
|
var splitcda1split = this.hybridshowdata.Ports.split(',')
|
|
for(var i1 = 0; i1 < splitcda1split.length; i1++) {
|
|
|
|
// ---------------------------------
|
|
if(logdatacustomres.baseservicedata.ttyd){
|
|
var swarmlabinstance1cda1s1b = new RegExp(logdatacustomres.baseservicedata.ttydport);
|
|
if(swarmlabinstance1cda1s1b.test(splitcda1split[i1])){
|
|
var splitcda1bc = splitcda1split[i1].split(':')
|
|
var splitcd1a1bc = splitcda1bc[1].split('-')
|
|
if(splitcd1a1bc[0]){
|
|
pocurletherpadserverttyd = logdatacustomres.baseservicedata.ttydurl+'://localhost:'+splitcd1a1bc[0]+'/?token='+this.token
|
|
}
|
|
}
|
|
}
|
|
// ---------------------------------
|
|
// ---------------------------------
|
|
if(logdatacustomres.baseservicedata.app){
|
|
var swarmlabinstance1cda1s1 = new RegExp(logdatacustomres.baseservicedata.port);
|
|
if(swarmlabinstance1cda1s1.test(splitcda1split[i1])){
|
|
var splitcda1 = splitcda1split[i1].split(':')
|
|
var splitcd1a1 = splitcda1[1].split('-')
|
|
if(splitcd1a1[0]){
|
|
pocurletherpadserver = logdatacustomres.baseservicedata.url+'://localhost:'+splitcd1a1[0]+'/?token='+this.token
|
|
}
|
|
}
|
|
}
|
|
// ---------------------------------
|
|
// ---------------
|
|
if(logdatacustomres.baseservicedata.hasOwnProperty('app1')){
|
|
if(logdatacustomres.baseservicedata.app1){
|
|
var swarmlabinstance1cda1s1bapp1 = new RegExp(logdatacustomres.baseservicedata.port1);
|
|
if(swarmlabinstance1cda1s1bapp1.test(splitcda1split[i1])){
|
|
var splitcda1bcapp1 = splitcda1split[i1].split(':')
|
|
var splitcd1a1bcapp1 = splitcda1bcapp1[1].split('-')
|
|
if(splitcd1a1bcapp1[0]){
|
|
pocurletherpadservertapp1 = logdatacustomres.baseservicedata.url1+'://localhost:'+splitcd1a1bcapp1[0]+'/?token='+this.token
|
|
pocurletherpadservertapp1text = logdatacustomres.baseservicedata.link1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// ---------------
|
|
|
|
// ---------------
|
|
if(logdatacustomres.baseservicedata.hasOwnProperty('app2')){
|
|
if(logdatacustomres.baseservicedata.app2){
|
|
var swarmlabinstance1cda1s1bapp2 = new RegExp(logdatacustomres.baseservicedata.port2);
|
|
if(swarmlabinstance1cda1s1bapp2.test(splitcda1split[i1])){
|
|
var splitcda1bcapp2 = splitcda1split[i1].split(':')
|
|
var splitcd1a1bcapp2 = splitcda1bcapp2[1].split('-')
|
|
if(splitcd1a1bcapp2[0]){
|
|
pocurletherpadservertapp2 = logdatacustomres.baseservicedata.url2+'://localhost:'+splitcd1a1bcapp2[0]+'/?token='+this.token
|
|
pocurletherpadservertapp2text = logdatacustomres.baseservicedata.link2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// ---------------
|
|
|
|
// ---------------
|
|
if(logdatacustomres.baseservicedata.hasOwnProperty('app3')){
|
|
if(logdatacustomres.baseservicedata.app3){
|
|
var swarmlabinstance1cda1s1bapp3 = new RegExp(logdatacustomres.baseservicedata.port3);
|
|
if(swarmlabinstance1cda1s1bapp3.test(splitcda1split[i1])){
|
|
//console.log('stringify--------- ' + JSON.stringify(splitcda1split[i1]));
|
|
var splitcda1bcapp3 = splitcda1split[i1].split(':')
|
|
var splitcd1a1bcapp3 = splitcda1bcapp3[1].split('-')
|
|
if(+splitcd1a1bcapp3[0]){
|
|
pocurletherpadservertapp3 = logdatacustomres.baseservicedata.url3+'://localhost:'+splitcd1a1bcapp3[0]+'/?token='+this.token
|
|
pocurletherpadservertapp3text = logdatacustomres.baseservicedata.link3
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// ---------------
|
|
var text4linkcustom = "Click to open "
|
|
// --------------- usercustom port1
|
|
if(logdatacustomres.servicedata.hasOwnProperty('port1')){
|
|
if(logdatacustomres.servicedata.port1){
|
|
var swarmlabinstance1cda1s1bapp3port1 = new RegExp(logdatacustomres.servicedata.port1);
|
|
if(swarmlabinstance1cda1s1bapp3port1.test(splitcda1split[i1])){
|
|
//console.log('stringify--------- ' + JSON.stringify(splitcda1split[i1]));
|
|
var splitcda1bcapp3port1 = splitcda1split[i1].split(':')
|
|
var splitcd1a1bcapp3port1 = splitcda1bcapp3port1[1].split('-')
|
|
if(+splitcd1a1bcapp3port1[0]){
|
|
pocurletherpadservertapp3port1 = logdatacustomres.servicedata.url1+'://localhost:'+splitcd1a1bcapp3port1[0]+'/?token='+this.token
|
|
pocurletherpadservertapp3textport1 = text4linkcustom
|
|
pocurletherpadservertapp3textport1 += logdatacustomres.servicedata.name1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// ---------------
|
|
// --------------- usercustom port2
|
|
if(logdatacustomres.servicedata.hasOwnProperty('port2')){
|
|
if(logdatacustomres.servicedata.port2){
|
|
var swarmlabinstance1cda1s1bapp3port2 = new RegExp(logdatacustomres.servicedata.port2);
|
|
if(swarmlabinstance1cda1s1bapp3port2.test(splitcda1split[i1])){
|
|
//console.log('stringify--------- ' + JSON.stringify(splitcda1split[i1]));
|
|
var splitcda1bcapp3port2 = splitcda1split[i1].split(':')
|
|
var splitcd1a1bcapp3port2 = splitcda1bcapp3port2[1].split('-')
|
|
if(+splitcd1a1bcapp3port2[0]){
|
|
pocurletherpadservertapp3port2 = logdatacustomres.servicedata.url1+'://localhost:'+splitcd1a1bcapp3port2[0]+'/?token='+this.token
|
|
pocurletherpadservertapp3textport2 = text4linkcustom
|
|
pocurletherpadservertapp3textport2 += logdatacustomres.servicedata.name2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// ---------------
|
|
// --------------- usercustom port3
|
|
if(logdatacustomres.servicedata.hasOwnProperty('port3')){
|
|
if(logdatacustomres.servicedata.port3){
|
|
var swarmlabinstance1cda1s1bapp3port3 = new RegExp(logdatacustomres.servicedata.port3);
|
|
if(swarmlabinstance1cda1s1bapp3port3.test(splitcda1split[i1])){
|
|
//console.log('stringify--------- ' + JSON.stringify(splitcda1split[i1]));
|
|
var splitcda1bcapp3port3 = splitcda1split[i1].split(':')
|
|
var splitcd1a1bcapp3port3 = splitcda1bcapp3port3[1].split('-')
|
|
if(+splitcd1a1bcapp3port3[0]){
|
|
pocurletherpadservertapp3port3 = logdatacustomres.servicedata.url3+'://localhost:'+splitcd1a1bcapp3port3[0]+'/?token='+this.token
|
|
pocurletherpadservertapp3textport3 = text4linkcustom
|
|
pocurletherpadservertapp3textport3 += logdatacustomres.servicedata.name3
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// ---------------
|
|
// --------------- usercustom por4
|
|
if(logdatacustomres.servicedata.hasOwnProperty('port4')){
|
|
if(logdatacustomres.servicedata.port4){
|
|
var swarmlabinstance1cda1s1bapp3port4 = new RegExp(logdatacustomres.servicedata.port4);
|
|
if(swarmlabinstance1cda1s1bapp3port4.test(splitcda1split[i1])){
|
|
//console.log('stringify--------- ' + JSON.stringify(splitcda1split[i1]));
|
|
var splitcda1bcapp3port4 = splitcda1split[i1].split(':')
|
|
var splitcd1a1bcapp3port4 = splitcda1bcapp3port4[1].split('-')
|
|
if(+splitcd1a1bcapp3port4[0]){
|
|
pocurletherpadservertapp3port4 = logdatacustomres.servicedata.url4+'://localhost:'+splitcd1a1bcapp3port4[0]+'/?token='+this.token
|
|
pocurletherpadservertapp3textport4 = text4linkcustom
|
|
pocurletherpadservertapp3textport4 += logdatacustomres.servicedata.name4
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// ---------------
|
|
// --------------- usercustom por5
|
|
if(logdatacustomres.servicedata.hasOwnProperty('port5')){
|
|
if(logdatacustomres.servicedata.port5){
|
|
var swarmlabinstance1cda1s1bapp3port5 = new RegExp(logdatacustomres.servicedata.port5);
|
|
if(swarmlabinstance1cda1s1bapp3port5.test(splitcda1split[i1])){
|
|
//console.log('stringify--------- ' + JSON.stringify(splitcda1split[i1]));
|
|
var splitcda1bcapp3port5 = splitcda1split[i1].split(':')
|
|
var splitcd1a1bcapp3port5 = splitcda1bcapp3port5[1].split('-')
|
|
if(+splitcd1a1bcapp3port5[0]){
|
|
pocurletherpadservertapp3port5 = logdatacustomres.servicedata.url5+'://localhost:'+splitcd1a1bcapp3port5[0]+'/?token='+this.token
|
|
pocurletherpadservertapp3textport5 = text4linkcustom
|
|
pocurletherpadservertapp3textport5 += logdatacustomres.servicedata.name5
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// ---------------
|
|
|
|
}
|
|
}
|
|
// -------------------------------------------------------
|
|
// --------------------------- CUSTOM
|
|
// -------------------------------------------------------
|
|
} // end CUSTOM
|
|
/*
|
|
var swarmlabinstance1ca1 = new RegExp("(microservice-etherpad)");
|
|
var pocurletherpadserver = 'no'
|
|
if(swarmlabinstance1ca1.test(this.hybridshowdata.Names)){
|
|
var swarmlabinstance1cda1 = new RegExp("(->)");
|
|
if(swarmlabinstance1cda1.test(this.hybridshowdata.Ports)){
|
|
var splitcda1 = this.hybridshowdata.Ports.split(':')
|
|
var splitcd1a1 = splitcda1[1].split('-')
|
|
pocurletherpadserver = 'http://localhost:'+splitcd1a1[0]+'/?token='+this.token
|
|
}
|
|
}
|
|
*/
|
|
|
|
|
|
if(pocurletherpadserverttyd != 'no'){
|
|
info += '<hr>'
|
|
info +='<p class="text-info">'
|
|
info += '<a class="text-info" href="'+pocurletherpadserverttyd+'" target="_blank"> - OR -<br>Click to open Terminal emulator</a>'
|
|
info +='</p>'
|
|
info += '<hr>'
|
|
}
|
|
|
|
if(pocurletherpadserver != 'no'){
|
|
info += '<hr>'
|
|
info +='<p class="text-info">'
|
|
info += '<a class="text-secondary" href="'+pocurletherpadserver+'" target="_blank">Click here to open Web App</a>'
|
|
info +='</p>'
|
|
info += '<hr>'
|
|
}
|
|
|
|
if(pocurletherpadservertapp1 != 'no'){
|
|
info += '<hr>'
|
|
info +='<p class="text-info">'
|
|
info += '<a class="text-info" href="'+pocurletherpadservertapp1+'" target="_blank"> ' + pocurletherpadservertapp1text + '</a>'
|
|
info +='</p>'
|
|
info += '<hr>'
|
|
}
|
|
|
|
if(pocurletherpadservertapp2 != 'no'){
|
|
info += '<hr>'
|
|
info +='<p class="text-info">'
|
|
info += '<a class="text-info" href="'+pocurletherpadservertapp2+'" target="_blank"> ' + pocurletherpadservertapp2text + '</a>'
|
|
info +='</p>'
|
|
info += '<hr>'
|
|
}
|
|
|
|
if(pocurletherpadservertapp3 != 'no'){
|
|
info += '<hr>'
|
|
info +='<p class="text-info">'
|
|
info += '<a class="text-info" href="'+pocurletherpadservertapp3+'" target="_blank"> ' + pocurletherpadservertapp3text + '</a>'
|
|
info +='</p>'
|
|
info += '<hr>'
|
|
}
|
|
|
|
if(pocurletherpadservertapp3port1 != 'no'){
|
|
info += '<hr>'
|
|
info +='<p class="text-info">'
|
|
info += '<a class="text-info" href="'+pocurletherpadservertapp3port1+'" target="_blank"> ' + pocurletherpadservertapp3textport1 + '</a>'
|
|
info +='</p>'
|
|
info += '<hr>'
|
|
}
|
|
|
|
if(pocurletherpadservertapp3port2 != 'no'){
|
|
info += '<hr>'
|
|
info +='<p class="text-info">'
|
|
info += '<a class="text-info" href="'+pocurletherpadservertapp3port2+'" target="_blank"> ' + pocurletherpadservertapp3textport2 + '</a>'
|
|
info +='</p>'
|
|
info += '<hr>'
|
|
}
|
|
|
|
if(pocurletherpadservertapp3port3 != 'no'){
|
|
info += '<hr>'
|
|
info +='<p class="text-info">'
|
|
info += '<a class="text-info" href="'+pocurletherpadservertapp3port3+'" target="_blank"> ' + pocurletherpadservertapp3textport3 + '</a>'
|
|
info +='</p>'
|
|
info += '<hr>'
|
|
}
|
|
|
|
if(pocurletherpadservertapp3port4 != 'no'){
|
|
info += '<hr>'
|
|
info +='<p class="text-info">'
|
|
info += '<a class="text-info" href="'+pocurletherpadservertapp3port4+'" target="_blank"> ' + pocurletherpadservertapp3textport4 + '</a>'
|
|
info +='</p>'
|
|
info += '<hr>'
|
|
}
|
|
|
|
if(pocurletherpadservertapp3port5 != 'no'){
|
|
info += '<hr>'
|
|
info +='<p class="text-info">'
|
|
info += '<a class="text-info" href="'+pocurletherpadservertapp3port5+'" target="_blank"> ' + pocurletherpadservertapp3textport5 + '</a>'
|
|
info +='</p>'
|
|
info += '<hr>'
|
|
}
|
|
// -----
|
|
|
|
var pocmypathinfo = ''
|
|
if(pocmypath != ''){
|
|
|
|
pocmypathinfo += '<b>Project BaseDir:</b> '+pocmypath
|
|
}
|
|
|
|
/*
|
|
info +='<p class="text-secondary">'
|
|
info +=' <b>Directory Maps</b>'
|
|
info +='<br>'
|
|
info +=' <table>'
|
|
info +='<tr><td><b>Local</b></td><td><i>Container</i></td></tr>'
|
|
var datajson = log.data.test[0]
|
|
for(var i = 0; i < datajson.length; i++) {
|
|
|
|
//console.log('test1 '+JSON.stringify(datajson[i]))
|
|
if(datajson[i].Type == 'bind'){
|
|
info +='<tr style="outline: thin solid"><td><b>'+datajson[i].Source+' </b></td><td><i>' + datajson[i].Destination+' </i></td></tr>'
|
|
}
|
|
}
|
|
info +=' </table>'
|
|
info +='</p>'
|
|
info += pocmypathinfo
|
|
info +='</h5><br>'
|
|
info +='<br>'
|
|
info +='<b>*</b> App with GUI: xhost +local:docker <br>'
|
|
info +='<br>'
|
|
info +='This permits the docker user on the local machine to connect to X windows display.<br>'
|
|
//console.log('test1 '+JSON.stringify(this.hybridshowdata))
|
|
*/
|
|
|
|
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 == 'install'){
|
|
var obj = {}
|
|
obj.action = 'up'
|
|
obj.token = this.token
|
|
obj.swarmlabname = this.swarmlabname
|
|
obj.git = this.swarmlabname_git
|
|
this.$socket.client.open();
|
|
this.$socket.client.emit('install', obj);
|
|
}else if(action == 'installcustom'){
|
|
var obj = {}
|
|
obj.action = 'up'
|
|
obj.token = this.token
|
|
obj.swarmlabname = this.swarmlabnamecustom
|
|
obj.user = this.swarmlabnamecustomuser
|
|
obj.service = this.swarmlabnamecustomservice
|
|
obj.baseservicedata = this.swarmlabnamecustomdata
|
|
obj.git = this.swarmlabname_git
|
|
this.$socket.client.open();
|
|
this.$socket.client.emit('installcustom', obj);
|
|
}else if(action == 'container-stop'){
|
|
this.actionrowindexconsole = true
|
|
this.$root.$emit('hybrid_show_instance_images','console')
|
|
// refresh adhocview.vue on console await
|
|
this.$root.$emit('SERVER_hybrid_table_start')
|
|
this.$socket.client.emit('container-stop', this.swarmlabname, this.hybridshowdata.ID);
|
|
//console.log('socket instance container-stop '+ this.swarmlabname +' '+ this.hybridshowdata.ID )
|
|
}else if(action == 'create-wirequard'){
|
|
//this.CONFIGprivatekey = value.privatekey
|
|
//this.CONFIGpublickey = value.publickey
|
|
//this.CONFIGserver_ip = value.server_ip // 83.212.77.133:51820
|
|
//this.CONFIGallowed_ips = value.allowed_ips // 10.13.13.0/16, 0.0.0.0/0, ::/0
|
|
this.$socket.client.emit('create-wirequard', this.token);
|
|
}else if(action == 'stop'){
|
|
this.$socket.client.emit('stop', this.swarmlabname);
|
|
//console.log('socket instance container-stop passed from services '+ this.swarmlabname )
|
|
}
|
|
},
|
|
async runmore (action ) {
|
|
console.log(action)
|
|
if(action == 'on'){
|
|
this.actionrowindex = true
|
|
this.actionrowindexselect = false
|
|
}else if(action == 'off'){
|
|
this.actionrowindex = false
|
|
this.actionrowindexselect = true
|
|
this.addNetworkMenou = false
|
|
this.actionrowindexconsole = false
|
|
this.$root.$emit('hybrid_show_instance_images','images')
|
|
}
|
|
},
|
|
async socketopen () {
|
|
this.$socket.client.open();
|
|
this.$socket.client.connect();
|
|
},
|
|
async socketauthenticate () {
|
|
this.$socket.client.emit('authenticate', this.token);
|
|
},
|
|
async socketreconnect () {
|
|
var log = await this.socketopen()
|
|
this.socketauthenticate()
|
|
},
|
|
async socketclose () {
|
|
this.$socket.client.close();
|
|
}
|
|
|
|
},
|
|
/**
|
|
*
|
|
* == Socket events
|
|
*
|
|
* [source,javascript]
|
|
* ----
|
|
* this.$socket.client.emit('authenticate', 'logintoken');
|
|
* ----
|
|
*
|
|
*/
|
|
sockets: {
|
|
connect() {
|
|
//this.$socket.client.emit('authenticate', this.token);
|
|
//console.log('socket connected '+ 'socketdatasend' )
|
|
this.issocket = 'open';
|
|
var log = store.dispatch("pipelineLLO/setsocketStatus",{
|
|
status:'open'
|
|
})
|
|
},
|
|
/**
|
|
*
|
|
* === onError
|
|
*
|
|
*/
|
|
error(error) {
|
|
//console.log("socket error "+JSON.stringify(error))
|
|
this.issocket = 'close'
|
|
var log = store.dispatch("pipelineLLO/setsocketStatus",{
|
|
status:'close'
|
|
})
|
|
},
|
|
/**
|
|
*
|
|
* === connect_error
|
|
*
|
|
*/
|
|
connect_error(error) {
|
|
//console.log("socket connect_error "+JSON.stringify(error))
|
|
this.issocket = 'close'
|
|
var log = store.dispatch("pipelineLLO/setsocketStatus",{
|
|
status:'close'
|
|
})
|
|
this.socketopen()
|
|
this.socketreconnect()
|
|
},
|
|
/**
|
|
*
|
|
* === connect_error
|
|
*
|
|
*/
|
|
disconnect(reason) {
|
|
//console.log("socket disconnect "+JSON.stringify(reason))
|
|
this.issocket = 'close'
|
|
var log = store.dispatch("pipelineLLO/setsocketStatus",{
|
|
status:'close'
|
|
})
|
|
this.socketreconnect()
|
|
},
|
|
/**
|
|
*
|
|
* === Socket connect_timeout
|
|
*
|
|
*/
|
|
connect_timeout(reason) {
|
|
//console.log("socket timeout "+JSON.stringify(reason))
|
|
this.issocket = 'close'
|
|
var log = store.dispatch("pipelineLLO/setsocketStatus",{
|
|
status:'close'
|
|
})
|
|
this.socketreconnect()
|
|
},
|
|
/**
|
|
*
|
|
* === Socket reconnect
|
|
*
|
|
*/
|
|
reconnect(attemptNumber) {
|
|
//console.log("socket reconnect attemptNumber "+JSON.stringify(attemptNumber))
|
|
this.socketreconnect()
|
|
},
|
|
/**
|
|
*
|
|
* === connect_attempt
|
|
*
|
|
*/
|
|
reconnect_attempt(attemptNumber) {
|
|
//console.log("socket reconnect_attempt "+JSON.stringify(attemptNumber))
|
|
this.socketreconnect()
|
|
},
|
|
/**
|
|
*
|
|
* === Socket reconnecting
|
|
*
|
|
*/
|
|
reconnecting(attemptNumber) {
|
|
//console.log("socket reconnecting "+JSON.stringify(attemptNumber))
|
|
this.socketreconnect()
|
|
},
|
|
/**
|
|
*
|
|
* === reconnect_error
|
|
*
|
|
*/
|
|
reconnect_error(error) {
|
|
//console.log("socket reconnect_error "+JSON.stringify(error))
|
|
this.issocket = 'close'
|
|
var log = store.dispatch("pipelineLLO/setsocketStatus",{
|
|
status:'close'
|
|
})
|
|
this.socketreconnect()
|
|
},
|
|
/**
|
|
*
|
|
* === unauthorized
|
|
*
|
|
*/
|
|
unauthorized(val) {
|
|
//console.log("socket unauthorized "+JSON.stringify(val))
|
|
this.issocket = 'close'
|
|
var log = store.dispatch("pipelineLLO/setsocketStatus",{
|
|
status:'close'
|
|
})
|
|
},
|
|
/**
|
|
*
|
|
* === connected
|
|
*
|
|
*/
|
|
socket_id_emit(val) {
|
|
//console.log("socket id from server "+JSON.stringify(val))
|
|
this.issocket = 'open'
|
|
var log = store.dispatch("pipelineLLO/setsocketStatus",{
|
|
status:'open'
|
|
})
|
|
},
|
|
/**
|
|
*
|
|
* === Socket onMessage
|
|
*
|
|
*/
|
|
/*
|
|
async adhocEmit(val) {
|
|
//console.log("socket from server "+JSON.stringify(val))
|
|
this.issocket = 'open'
|
|
//this.$wait.start('myRunInstance1');
|
|
// render begin
|
|
this.tryLLO = 'on'
|
|
if(this.firstbootstrap === 0 ){
|
|
await this.bootsrapllo();
|
|
this.firstbootstrap = 1
|
|
}
|
|
var output = log.data.out
|
|
var mydinfunction = `
|
|
<div class="row">
|
|
<b-col class="" cols="12" sm="12" md="12" >
|
|
${output}
|
|
</b-col>
|
|
</div>`
|
|
|
|
try {
|
|
let divascii = document.createElement('div');
|
|
divascii.setAttribute("class", "container-fluid w-100 p-3 llotry")
|
|
divascii.innerHTML = mydinfunction
|
|
this.addtask(divascii);
|
|
}catch (ex) {
|
|
//console.log(" logi error1 "+JSON.stringify(ex))
|
|
return
|
|
}
|
|
//this.$wait.end('myRunInstance1');
|
|
},
|
|
*/
|
|
async logdata(val) {
|
|
//console.log(" socket from logdata "+JSON.stringify(val))
|
|
// -------------------------------------
|
|
// Save store
|
|
// -------------------------------------
|
|
var log = store.dispatch("pipelineLLO/addlog",{
|
|
log:val
|
|
})
|
|
|
|
var ltmp = store.getters['pipelineLLO/getlog'];
|
|
this.log_path = [...new Set(ltmp.map(item => item.tailed_path))];
|
|
var loglenght = ''
|
|
for (let item of this.log_path) {
|
|
//console.log('l1find '+ JSON.stringify(item))
|
|
loglenght = ltmp.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 message(val) {
|
|
//console.log(" socket message "+JSON.stringify(val))
|
|
},
|
|
async message_config(value) {
|
|
value.data = JSON.parse(value.data);
|
|
if(value.file == 'ok'){
|
|
//console.log('server-value-file-ok ' + JSON.stringify(value.data.status))
|
|
this.CONFIG.status = value.data.status
|
|
this.CONFIG.workerkey = value.data.workerkey
|
|
this.CONFIG.swarmlab_public_wgkey = value.data.swarmlab_public_wgkey
|
|
this.CONFIG.server_ip = value.data.server_ip
|
|
this.CONFIG.allowed_ips = value.data.allowed_ips
|
|
this.CONFIG.wg_port = value.data.wg_port
|
|
this.CONFIG.wg_ip = value.data.wg_ip
|
|
this.CONFIG.swarm_ip = value.data.swarm_ip
|
|
this.CONFIG.privatekey = value.data.privatekey
|
|
this.CONFIG.publickey = value.data.publickey
|
|
|
|
}else if(value.file == 'nodata'){
|
|
this.CONFIG.status = ''
|
|
this.CONFIG.workerkey = ''
|
|
this.CONFIG.swarmlab_public_wgkey = ''
|
|
this.CONFIG.server_ip = ''
|
|
this.CONFIG.allowed_ips = ''
|
|
this.CONFIG.wg_port = ''
|
|
this.CONFIG.wg_ip = ''
|
|
this.CONFIG.swarm_ip = ''
|
|
this.CONFIG.privatekey = ''
|
|
this.CONFIG.publickey = ''
|
|
}
|
|
// send to myconnect-server.vue
|
|
//console.log('server-config ' + JSON.stringify(this.CONFIG))
|
|
store.dispatch("pipelineLLO/addconfig",this.CONFIG)
|
|
this.$root.$emit('hybrid_connect_server_view', this.CONFIG)
|
|
},
|
|
async message_log(val) {
|
|
//console.log(" socket out "+JSON.stringify(val))
|
|
this.$root.$emit('hybrid_log_in',val)
|
|
// refresh adhocview.vue on console await
|
|
//this.$root.$emit('SERVER_hybrid_table_start')
|
|
// clear container info here sockert end
|
|
//this.hybridshowdata = {}
|
|
},
|
|
async message_out(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
|
|
this.$root.$emit('SERVER_hybrid_table_start')
|
|
// clear container info here sockert end
|
|
this.hybridshowdata = {}
|
|
},
|
|
async message_err(val) {
|
|
//console.log(" socket err "+JSON.stringify(val))
|
|
var extenderror = new RegExp('error checking context');
|
|
if(extenderror.test(val.data)){
|
|
var cwdpath = val.cwdpath
|
|
var cwdservice = val.service
|
|
//console.log(" path "+JSON.stringify(cwdpath))
|
|
//console.log(" path-------- "+JSON.stringify(val))
|
|
var errorrun = "<b>error checking context:</b> 'no permission to read from ..."
|
|
var info=`<h5><b>You might see an error message:</b></h5><br>
|
|
<samp> ${errorrun} </samp>
|
|
<br>
|
|
<br>
|
|
<b>In this case open Open a terminal and Run:</b>
|
|
<br>
|
|
<br> `
|
|
info +='<p class="text-success">'
|
|
info += 'sudo chown -R $USER.$USER '+cwdpath + '/instance/'+cwdservice+'/'+cwdservice
|
|
info +='</p>'
|
|
info +='<br> <br> <b>and try again</b> <br>'
|
|
|
|
this.$swal({
|
|
type: 'info',
|
|
html: info,
|
|
icon:'info',
|
|
showCloseButton: true,
|
|
showLoaderOnConfirm: false,
|
|
allowOutsideClick: false,
|
|
cancelButtonText: 'No, cancel!',
|
|
showCancelButton: false,
|
|
showLoaderOnConfirm: false,
|
|
reverseButtons: true,
|
|
focusCancel: true,
|
|
})
|
|
}
|
|
this.$root.$emit('hybrid_log_in',val)
|
|
},
|
|
async message_close(val) {
|
|
//console.log(" socket close "+JSON.stringify(val))
|
|
// Error in event handler for "hybrid_log_in": "TypeError: child is undefined"
|
|
// data: 0 gia na doume ean ine afto
|
|
// to lathos exafanistike
|
|
if(val.data != 0){
|
|
if(val.data){
|
|
//console.log(val)
|
|
//console.log(val.data)
|
|
this.$root.$emit('hybrid_log_in',val)
|
|
}
|
|
//console.log(val)
|
|
}
|
|
// refresh table availableservices
|
|
this.$root.$emit('hybrid_refresh_table')
|
|
// refresh adhocview.vue on console await console
|
|
this.$root.$emit('SERVER_hybrid_table_stop')
|
|
},
|
|
async message_err_storage(val) {
|
|
//console.log(" socket err "+JSON.stringify(val))
|
|
this.$root.$emit('hybrid_log_in',val)
|
|
},
|
|
async message_out_storage(val) {
|
|
// console.log(" socket out storage "+JSON.stringify(val))
|
|
this.$root.$emit('hybrid_log_in',val)
|
|
//this.hybridshowdata = {}
|
|
},
|
|
async message_close_storage(val) {
|
|
// refresh table hybrid storage
|
|
this.$root.$emit('hybrid_log_in',val)
|
|
this.$root.$emit('hybrid_refresh_table_storage')
|
|
},
|
|
// poc
|
|
async message_err_poc(val) {
|
|
//console.log(" socket err "+JSON.stringify(val))
|
|
this.$root.$emit('hybrid_log_in',val)
|
|
},
|
|
async message_out_poc(val) {
|
|
// console.log(" socket out storage "+JSON.stringify(val))
|
|
this.$root.$emit('hybrid_log_in',val)
|
|
//this.hybridshowdata = {}
|
|
},
|
|
async message_close_poc(val) {
|
|
// refresh table hybrid storage
|
|
this.$root.$emit('hybrid_log_in',val)
|
|
this.$root.$emit('hybrid_refresh_table_poc')
|
|
},
|
|
async message_close_build(val) {
|
|
// refresh table hybrid storage
|
|
this.$root.$emit('SERVER_build_closebuild',val)
|
|
//this.$root.$emit('hybrid_refresh_table_storage')
|
|
},
|
|
async message_exec_editor(val) {
|
|
// refresh table hybrid storage
|
|
//console.log(" socket out editor "+JSON.stringify(val))
|
|
if(val.start){
|
|
this.$root.$emit('SERVER_hybrid_table_stop')
|
|
this.editor_instance.start=val.start
|
|
this.editor_instance.start=val.port
|
|
var info=`<h5><b>Editor</b><br>
|
|
<br>
|
|
`
|
|
info +='<p class="text-secondary">'
|
|
info +=' <b>Click on hyperlink opens Editor in new tab</b></p>'
|
|
info +='<b> <a class="text-info" href="http://127.0.0.1:'+val.port+'" target="_blank">Open Editor</a></b>'
|
|
info +='<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!'
|
|
})
|
|
// this.webinterfacegenericedit = false
|
|
this.$wait.end('myRunInstanceeditor');
|
|
}
|
|
|
|
//this.$root.$emit('hybrid_refresh_table_storage')
|
|
},
|
|
async build_set_sshpid(val) {
|
|
// console.log(" socket pid "+JSON.stringify(val))
|
|
this.$root.$emit('SERVER_build_set_sshpid',val)
|
|
},
|
|
async build_set_buildpid(val) {
|
|
// console.log(" socket pid "+JSON.stringify(val))
|
|
this.$root.$emit('SERVER_build_set_buildpid',val)
|
|
},
|
|
async message_hybrid_status(val) {
|
|
var obj = {}
|
|
obj.status = val
|
|
var res1 = store.dispatch('pipelineLLO/setstatus', obj)
|
|
this.$root.$emit('hybrid_server_status',val)
|
|
//message_hybrid_status {"data":{"swarmlab":"active","hybrid":"Online","swarmlabid":"z3abo50tks76alp7ubjos4ngz"}}
|
|
this.STATUS.swarmlabid = val.data.swarmlabid
|
|
this.STATUS.hybrid = val.data.hybrid
|
|
this.STATUS.swarmlab = val.data.swarmlab
|
|
store.dispatch("pipelineLLO/addstatusswarmlab",this.STATUS)
|
|
}
|
|
},
|
|
|
|
|
|
actions: {
|
|
|
|
}
|
|
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
|
|
.flex-fixed-width-item {
|
|
flex: 0 0 100px;
|
|
}
|
|
.modalinfo {
|
|
z-index: 10000000 !important;
|
|
position:fixed;
|
|
}
|
|
/* a container with flex-direction column */
|
|
|
|
.vue-notifyjs.notifications{
|
|
.alert{
|
|
z-index: 100;
|
|
}
|
|
.list-move {
|
|
transition: transform 0.3s, opacity 0.4s;
|
|
}
|
|
.list-item {
|
|
display: inline-block;
|
|
margin-right: 10px;
|
|
|
|
}
|
|
.list-enter-active {
|
|
transition: transform 0.2s ease-in, opacity 0.4s ease-in;
|
|
}
|
|
.list-leave-active {
|
|
transition: transform 1s ease-out, opacity 0.4s ease-out;
|
|
}
|
|
|
|
.list-enter {
|
|
opacity: 0;
|
|
transform: scale(1.1);
|
|
|
|
}
|
|
.list-leave-to {
|
|
opacity: 0;
|
|
transform: scale(1.2, 0.7);
|
|
}
|
|
}
|
|
|
|
pre {
|
|
//background-color: rgb(255, 247, 229);
|
|
background-color: #eff0f1;
|
|
border: 1px solid blue;
|
|
//white-space: pre-line;
|
|
}
|
|
|
|
|
|
</style>
|
|
|