zeus
3 years ago
25 changed files with 4895 additions and 1633 deletions
@ -0,0 +1,17 @@ |
|||
{ |
|||
"servicedata": { |
|||
"service": "mytest1", |
|||
"baseservice": "microservice-ipterm", |
|||
"user": "rootapostolos@swarmlab.io", |
|||
"port1": "8081", |
|||
"url1": "http", |
|||
"name1": "n1", |
|||
"port2": "8082", |
|||
"url2": "http", |
|||
"name2": "n2", |
|||
"port3": "8083", |
|||
"url3": "https", |
|||
"name3": "n3" |
|||
}, |
|||
"baseservicedata": {"name":"microservice-ipterm","custom":"true","customostext":"Base OS: debian:jessie ","customos":"apt-get update && apt-get install -y --no-install-recommends net-tools","customshtext":"It is executed after all the normal builds","customsh":" #!/bin/sh","app":false,"url":"http","port":"80/tcp","ttyd":true,"ttydport":"3787/tcp","ttydurl":"http"} |
|||
} |
@ -0,0 +1,56 @@ |
|||
#!/bin/bash |
|||
|
|||
SOURCE="${BASH_SOURCE[0]}" |
|||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink |
|||
TARGET="$(readlink "$SOURCE")" |
|||
if [[ $TARGET == /* ]]; then |
|||
SOURCE="$TARGET" |
|||
else |
|||
DIR="$( dirname "$SOURCE" )" |
|||
SOURCE="$DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located |
|||
fi |
|||
done |
|||
|
|||
SRPATH="$( dirname "$SOURCE" )" |
|||
SFPATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )" |
|||
if [ "$SFPATH" != "$SRPATH" ]; then |
|||
RDIR=$SRPATH # relativ path directory |
|||
fi |
|||
|
|||
cwdir=$PWD |
|||
wdir=$SFPATH |
|||
|
|||
#echo $cwdir |
|||
#echo $wdir |
|||
|
|||
cd $wdir |
|||
|
|||
. ./user.env |
|||
|
|||
sed -i '/${U_PORT5}:${S_PORT5}/d' ../docker-compose.yml |
|||
sed -i '/${U_PORT4}:${S_PORT4}/d' ../docker-compose.yml |
|||
sed -i '/${U_PORT3}:${S_PORT3}/d' ../docker-compose.yml |
|||
sed -i '/${U_PORT2}:${S_PORT2}/d' ../docker-compose.yml |
|||
sed -i '/${U_PORT1}:${S_PORT1}/d' ../docker-compose.yml |
|||
|
|||
if [ ! -z "$S_PORT5" ]; then |
|||
sed -i '/\sports:/a \ \ \ \ \ \ -\ "${U_PORT5}:${S_PORT5}"' ../docker-compose.yml |
|||
fi |
|||
|
|||
if [ ! -z "$S_PORT4" ]; then |
|||
sed -i '/\sports:/a \ \ \ \ \ \ -\ "${U_PORT4}:${S_PORT4}"' ../docker-compose.yml |
|||
fi |
|||
|
|||
if [ ! -z "$S_PORT3" ]; then |
|||
sed -i '/\sports:/a \ \ \ \ \ \ -\ "${U_PORT3}:${S_PORT3}"' ../docker-compose.yml |
|||
fi |
|||
|
|||
if [ ! -z "$S_PORT2" ]; then |
|||
sed -i '/\sports:/a \ \ \ \ \ \ -\ "${U_PORT2}:${S_PORT2}"' ../docker-compose.yml |
|||
fi |
|||
|
|||
if [ ! -z "$S_PORT1" ]; then |
|||
sed -i '/\sports:/a \ \ \ \ \ \ -\ "${U_PORT1}:${S_PORT1}"' ../docker-compose.yml |
|||
fi |
|||
|
|||
cd $cwdir |
@ -0,0 +1,31 @@ |
|||
#!/bin/sh |
|||
|
|||
mkdir -p /tmp/logs |
|||
|
|||
echo "==> extra packages" |
|||
|
|||
extrap=/tmp/bin/extrapackages |
|||
if [ -f $extrap ]; then |
|||
sh $extrap 2>&1 | tee /tmp/logs/extrapackages.log |
|||
fi |
|||
|
|||
echo "==> exec custom" |
|||
|
|||
extrashell=/tmp/bin/custom.sh |
|||
if [ -f $extrashell ]; then |
|||
sh $extrashell 2>&1 | tee /tmp/logs/custom1.log |
|||
fi |
|||
|
|||
echo "==> extra add" |
|||
|
|||
extrap1=/tmp/bin/extrapackages1 |
|||
if [ -f $extrap1 ]; then |
|||
sh $extrap1 2>&1 | tee /tmp/logs/extrapackages1.log |
|||
fi |
|||
|
|||
echo "==> exec sh 2" |
|||
|
|||
extrashell1=/tmp/bin/custom1.sh |
|||
if [ -f $extrashell1 ]; then |
|||
sh $extrashell1 2>&1 | tee /tmp/logs/custom2.log |
|||
fi |
@ -0,0 +1 @@ |
|||
Subproject commit 73dd22c502c6de2b258627b883ece5806a82053f |
@ -0,0 +1,69 @@ |
|||
<template> |
|||
<card class="card-user" style="max-height:100%"> |
|||
|
|||
<div class="row" > |
|||
<div class="col-7 order-first " > |
|||
<br> |
|||
<!-- |
|||
<view-network> |
|||
|
|||
</view-network> |
|||
--> |
|||
<available-mymicroservices |
|||
:key="componentKeyreloadservice5" |
|||
> |
|||
|
|||
</available-mymicroservices> |
|||
</div> |
|||
|
|||
<div class="col-5 order-last" > |
|||
<br> |
|||
<adhoc-view> |
|||
|
|||
</adhoc-view> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</card> |
|||
</template> |
|||
<script> |
|||
import {mapState, mapGetters, mapActions} from 'vuex' |
|||
//import ViewNetwork from "./mynetwork/mytable.vue"; |
|||
import AdhocView from "./mynetwork/AdhocView.vue"; |
|||
import card from '@/components/Card.vue' |
|||
//import DockerServices from "./mynetwork/dockerservices.vue"; |
|||
import AvailableMymicroservices from "./mynetwork/availablemicroservicescustom.vue"; |
|||
export default { |
|||
components: { |
|||
// ViewNetwork, |
|||
AdhocView, |
|||
card, |
|||
// DockerServices, |
|||
AvailableMymicroservices |
|||
}, |
|||
data () { |
|||
return { |
|||
componentKeyreloadservice5:1, |
|||
loading: false, |
|||
consoleView: 'off', |
|||
productIndex: 1 |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.$root.$on('hybrid_refresh_info_deploy_local', () => { |
|||
this.componentKeyreloadservice5 += 1 |
|||
}) |
|||
}, |
|||
beforeDestroy () { |
|||
this.$root.$off('hybrid_refresh_info_deploy_local') |
|||
}, |
|||
|
|||
|
|||
created () { |
|||
} |
|||
}; |
|||
</script> |
|||
<style> |
|||
</style> |
|||
|
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,472 @@ |
|||
<template> |
|||
<card class="card-user" style="max-height:100%"> |
|||
|
|||
<br> |
|||
|
|||
<v-wait for="myRunInstancetutormybuild"> |
|||
<template slot="waiting"> |
|||
<div> |
|||
<img src="@/assets/loading.gif" /> |
|||
Enter Lab_room... |
|||
</div> |
|||
</template> |
|||
</v-wait> |
|||
|
|||
<div class="row text-center"> |
|||
<div class="col-12"> |
|||
<b>Swarmlab <span class="text-info">my Custom MicroServices</span></b> |
|||
</div> |
|||
</div> |
|||
|
|||
<br> |
|||
|
|||
|
|||
|
|||
|
|||
<div class="input-group input-group-sm sm-3"> |
|||
</div> |
|||
|
|||
<div class="input-group input-group-sm sm-3"> |
|||
|
|||
<input type="text" |
|||
class="form-control" |
|||
aria-label="Small" aria-describedby="inputGroup-sizing-sm" |
|||
placeholder="Search" |
|||
v-model="searchFor" |
|||
@keyup.enter="setFilter" |
|||
> |
|||
|
|||
<div class="input-group-append"> |
|||
<button |
|||
class="btn btn-outline-primary" |
|||
round |
|||
type="button" |
|||
@click="setFilter"> |
|||
Go</button> |
|||
</div> |
|||
|
|||
<div class="input-group-append"> |
|||
<button class="btn btn-outline-secondary" |
|||
round |
|||
type="button" |
|||
@click="resetFilter"> |
|||
Reset</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="input-group-append" |
|||
v-if="viewhybridoptions && heavy" |
|||
> |
|||
<p class="text-danger">{{ heavytext }}</p> |
|||
</div> |
|||
|
|||
<div class="white h-100 flex-fixed-width-item" |
|||
<vuetable |
|||
ref="vuetable" |
|||
:key="vuetablekeygmybuildservice123" |
|||
:api-url='apiurl' |
|||
:api-mode="true" |
|||
:http-options="httpOptions" |
|||
:fields="fields" |
|||
:item-actions="itemActions" |
|||
:sort-order="sortOrder" |
|||
:show-sort-icons="true" |
|||
:multi-sort="multiSort" |
|||
:per-page="perpage" |
|||
pagination-path="links.pagination" |
|||
:pagination-component="paginationComponent" |
|||
:append-params="moreParams" |
|||
wrapper-class="vuetable-wrapper" |
|||
loading-class="loading" |
|||
detail-row-id="id" |
|||
@vuetable:pagination-data="onPaginationData" |
|||
@vuetable:load-success="loadsuccess" |
|||
@vuetable:load-error="onLoadError" |
|||
:css="css.table" |
|||
> |
|||
|
|||
<div slot="actions" slot-scope="props"> |
|||
<div class="d-flex justify-content-center"> |
|||
<button |
|||
class="ti-pencil btn btn-outline-secondary btn-sm" |
|||
title="Upload MicroService" |
|||
round |
|||
@click="onAction('upload-item', props.rowData, props.rowData._id)"> |
|||
</button> |
|||
<button |
|||
class="ti-trash btn btn-outline-warning btn-sm" |
|||
title="MicroService Info" |
|||
round |
|||
@click="onAction('rm-item', props.rowData, props.rowData._id)"> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</vuetable> |
|||
<div class="vuetable-pagination ui basic segment grid"> |
|||
<vuetable-pagination-info |
|||
ref="paginationInfo" |
|||
:css="css.paginationInfo" |
|||
> |
|||
</vuetable-pagination-info> |
|||
<vuetable-pagination |
|||
:css="css.pagination" |
|||
ref="pagination" |
|||
@vuetable-pagination:change-page="onChangePage" |
|||
> |
|||
</vuetable-pagination> |
|||
</div> |
|||
</div> |
|||
</b-container> |
|||
</card> |
|||
</template> |
|||
<script> |
|||
import store from '@/store/index' |
|||
import {mapState, mapGetters, mapActions,dispatch} from 'vuex' |
|||
import Vue from 'vue' |
|||
import {Vuetable, VuetablePaginationDropdown} from 'vuetable-2' |
|||
import VuetablePaginationInfo from 'vuetable-2/src/components/VuetablePaginationInfo' |
|||
import VuetablePagination from 'vuetable-2/src/components/VuetablePagination' |
|||
import CssConfig from 'vuetable-2/src/components/VuetableCssConfig.js' |
|||
import card from '@/components/Card.vue' |
|||
import {ApiConfig} from "@/config/index"; |
|||
import {ApiConfigWEB} from "@/config/index-web"; |
|||
|
|||
export default { |
|||
components: { |
|||
card, |
|||
Vuetable, |
|||
VuetablePagination, |
|||
VuetablePaginationInfo, |
|||
VuetablePaginationDropdown |
|||
}, |
|||
props: { |
|||
}, |
|||
data() { |
|||
return{ |
|||
testactionrowindex:[], // downloaded used in installed |
|||
teststatusindex:[], // status stop run used in status |
|||
testtest:[], // up or down services |
|||
testtestdir:[], // install download or not service |
|||
hybridoptions: { |
|||
'index':'', |
|||
'swarmlabname':'', |
|||
'size':'', |
|||
'port':'' |
|||
}, |
|||
viewhybridoptions: false, |
|||
heavy: false, |
|||
heavytext: '', |
|||
customedit: false, |
|||
custommenouopen: false, |
|||
custommenou: false, |
|||
custom: { |
|||
'os':'', |
|||
'sh':'' |
|||
}, |
|||
customostext: '', |
|||
customshtext: '', |
|||
up_name:'', |
|||
swarmlab:{}, |
|||
playbookInfo: {}, |
|||
token: '', |
|||
playbook: { |
|||
'title':'', |
|||
'name':'', |
|||
'description':'' |
|||
}, |
|||
container:{ |
|||
name:'', |
|||
view:0 |
|||
}, |
|||
pipeline:{}, |
|||
selected: 'hybrid', |
|||
options: [ |
|||
{ text: 'Packages', value: 'packages' }, |
|||
{ text: 'Images', value: 'images' }, |
|||
{ text: 'Scripts', value: 'scripts' } |
|||
], |
|||
showModal: false, |
|||
visibility: [], |
|||
active:false, |
|||
vuetablekeygmybuildservice123:0, |
|||
vuetablekeygslot:0, |
|||
fielddata:{}, |
|||
fields: [ |
|||
{ |
|||
name: 'service', |
|||
title: '<span class="orange"></span>Name', |
|||
sortField: 'service', |
|||
visible:true, |
|||
dataClass: 'left aligned col-3', |
|||
width: '30%' |
|||
}, |
|||
{ |
|||
name: '_id', |
|||
title: '<span class="orange"></span>mongo', |
|||
visible:false |
|||
}, |
|||
{ |
|||
name: 'readme', |
|||
title: '<span class="orange"></span>Info', |
|||
sortField: 'gitrepoCloneUrl', |
|||
dataClass: 'left aligned w-25', |
|||
visible:true, |
|||
width: '20%' |
|||
}, |
|||
{ |
|||
name: 'baseservice', |
|||
title: '<span class="orange"></span>Base', |
|||
sortField: 'baseservice', |
|||
titleClass: 'center aligned', |
|||
dataClass: 'left aligned w-25', |
|||
visible:true, |
|||
width: '30%' |
|||
}, |
|||
{ |
|||
name: '__slot:actions', // <---- |
|||
title: 'Actions', |
|||
titleClass: 'col text-center', |
|||
dataClass: 'center aligned', |
|||
width: '10%' |
|||
}, |
|||
], |
|||
apiurl:ApiConfig.swarmlab_url_80+"/swarmlabhybridmymicroservices", |
|||
css: CssConfig, |
|||
perpage: 8, |
|||
searchFor: '', |
|||
sortOrder: [{ |
|||
field: 'pipelinename', |
|||
direction: 'asc' |
|||
}], |
|||
multiSort: true, |
|||
paginationComponent: 'vuetable-pagination', |
|||
currentpage:'1', |
|||
currentpagepaginationData: {}, |
|||
dataselect:'', |
|||
indexselect:'', |
|||
itemActions: [ |
|||
{ name: 'view-item', label: '', icon: 'glyphicon glyphicon-zoom-in', class: 'btn btn-info', extra: {'title': 'View', 'data-toggle':"tooltip", 'data-placement': "left"} }, |
|||
{ name: 'edit-item', label: '', icon: 'glyphicon glyphicon-pencil', class: 'btn btn-warning', extra: {title: 'Edit', 'data-toggle':"tooltip", 'data-placement': "top"} }, |
|||
{ name: 'delete-item', label: '', icon: 'glyphicon glyphicon-remove', class: 'btn btn-danger', extra: {title: 'Delete', 'data-toggle':"tooltip", 'data-placement': "right" } } |
|||
], |
|||
moreParams: { |
|||
'filter': '', |
|||
'type': 'scripts' |
|||
}, |
|||
|
|||
} |
|||
}, |
|||
mounted() { |
|||
this.$root.$on('hybrid_build_micro_service_menou_refreshtable', () => { |
|||
this.refreshVuetable() |
|||
console.log('11111111111111111111111111') |
|||
}) |
|||
}, |
|||
async created() { |
|||
var url_string = window.location.href |
|||
var url = new URL(url_string); |
|||
this.token = url.searchParams.get("token"); |
|||
//await this.checkactionrowindexall() |
|||
this.$root.$emit('hybrid_build_micro_service_menou') |
|||
//console.log("token "+ this.token); |
|||
}, |
|||
beforeDestroy () { |
|||
this.$root.$off('hybrid_build_micro_service_menou_refreshtable') |
|||
}, |
|||
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 refreshVuetable() { |
|||
this.vuetablekeygmybuildservice123 += 1 |
|||
}, |
|||
setFilter () { |
|||
this.moreParams = { |
|||
'filter': this.searchFor, |
|||
'type': this.selected |
|||
} |
|||
Vue.nextTick( () => this.$refs.vuetable.refresh()) |
|||
}, |
|||
resetFilter () { |
|||
this.moreParams = {} |
|||
this.searchFor = '' |
|||
this.moreParams = { |
|||
'filter': '', |
|||
'type': 'scripts' |
|||
} |
|||
Vue.nextTick( () => this.refreshVuetableall()) |
|||
}, |
|||
onPaginationData (paginationData) { |
|||
this.$refs.pagination.setPaginationData(paginationData) |
|||
this.$refs.paginationInfo.setPaginationData(paginationData) |
|||
this.currentpagepaginationData = paginationData |
|||
}, |
|||
onChangePage (page) { |
|||
this.currentpage = page |
|||
this.$refs.vuetable.changePage(page) |
|||
}, |
|||
editRow(rowData) { |
|||
alert("You clicked edit on"+ JSON.stringify(rowData)); |
|||
}, |
|||
async rmAndClose(result){ |
|||
if (result.isConfirmed) { |
|||
var value = this.hybridoptions.swarmlabname |
|||
var log = await store.dispatch("pipelineLLO/rmmycustomservice",{ |
|||
token:this.token, |
|||
service:this.swarmlab.service |
|||
}) |
|||
this.refreshVuetable() |
|||
if(log.data.action == 'ok'){ |
|||
|
|||
}else{ |
|||
var info = "Remove error " |
|||
this.$swal({ |
|||
type: 'Info', |
|||
title: 'Info!', |
|||
icon:'error', |
|||
html: info, |
|||
showCloseButton: true, |
|||
showLoaderOnConfirm: false, |
|||
allowOutsideClick: false, |
|||
cancelButtonText: 'No, cancel!', |
|||
showCancelButton: false, |
|||
showLoaderOnConfirm: false, |
|||
reverseButtons: true, |
|||
focusCancel: true, |
|||
confirmButtonText: 'Ok!' |
|||
}) |
|||
} |
|||
}else { |
|||
console.log('no') |
|||
} |
|||
}, |
|||
async onAction (action, data, index) { |
|||
if(action == 'rm-item' ){ |
|||
this.swarmlab=data |
|||
var container=this.swarmlab |
|||
|
|||
var info = "Remove service: <b> " + this.swarmlab.service |
|||
info += "</b>" |
|||
this.$swal({ |
|||
type: 'info', |
|||
html: info, |
|||
icon:'warning', |
|||
showCloseButton: true, |
|||
showLoaderOnConfirm: false, |
|||
allowOutsideClick: false, |
|||
cancelButtonText: 'No, cancel!', |
|||
showCancelButton: true, |
|||
showLoaderOnConfirm: false, |
|||
reverseButtons: true, |
|||
focusCancel: false, |
|||
confirmButtonText: 'Yes!' |
|||
}).then((result)=> { |
|||
this.rmAndClose(result); |
|||
}) |
|||
|
|||
}else if(action == 'upload-item' ){ |
|||
var data1 = { |
|||
data:data |
|||
} |
|||
var log = { |
|||
data: data1 |
|||
} |
|||
this.swarmlab=data |
|||
var service = { |
|||
data: data, |
|||
log: log |
|||
} |
|||
this.$root.$emit('hybrid_build_micro_myservice', service) |
|||
} |
|||
}, |
|||
playbookinfoShow(value) { |
|||
return this.visibility[value]=true |
|||
}, |
|||
playbookinfo(value) { |
|||
return this.playbookInfo=value |
|||
}, |
|||
rowClicked(row, event) { |
|||
return { |
|||
html: true, |
|||
title: () => { return 'Hello <b>Popover:</b> ' + (++this.counter) }, |
|||
content: () => { return 'The date is:<br><em>' + new Date() + '</em>' } |
|||
} |
|||
}, |
|||
loadsuccess(response) { |
|||
var data = response.data.data |
|||
this.fielddata=data |
|||
var n = data.length |
|||
n=n-1 |
|||
}, |
|||
onLoadError(payload) { |
|||
if(payload.response.status == '401'){ |
|||
window.location.href = 'https://api-login.swarmlab.io:8089'; |
|||
Vue.nextTick( () => window.location.href = 'https://api-login.swarmlab.io:8089') |
|||
} |
|||
} |
|||
|
|||
|
|||
}, |
|||
|
|||
|
|||
actions: { |
|||
|
|||
|
|||
} |
|||
|
|||
}; |
|||
</script> |
|||
<style> |
|||
.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> |
@ -0,0 +1,562 @@ |
|||
<template> |
|||
<card class="card-user" style="max-height:100%"> |
|||
|
|||
|
|||
<v-wait for="myRunInstancetutor"> |
|||
<template slot="waiting"> |
|||
<div> |
|||
<img src="@/assets/loading.gif" /> |
|||
Enter Lab_room... |
|||
</div> |
|||
</template> |
|||
</v-wait> |
|||
|
|||
<b-container fluid class="bv-example-row"> |
|||
|
|||
<div class="input-group input-group-sm sm-3"> |
|||
<div class="input-group-append"> |
|||
<button |
|||
class="btn btn-outline-info" |
|||
round |
|||
type="button" |
|||
@click="setRefresh"> |
|||
Refresh table</button> |
|||
</div> |
|||
|
|||
<input type="text" |
|||
class="form-control" |
|||
aria-label="Small" aria-describedby="inputGroup-sizing-sm" |
|||
placeholder="Search by Name" |
|||
v-model="searchFor" |
|||
@keyup.enter="setFilter" |
|||
> |
|||
|
|||
<div class="input-group-append"> |
|||
<button |
|||
class="btn btn-outline-primary" |
|||
round |
|||
type="button" |
|||
@click="setFilter"> |
|||
Go</button> |
|||
</div> |
|||
|
|||
<div class="input-group-append"> |
|||
<button class="btn btn-outline-secondary" |
|||
round |
|||
type="button" |
|||
@click="resetFilter"> |
|||
Reset</button> |
|||
</div> |
|||
</div> |
|||
<div class="white h-100 flex-fixed-width-item" |
|||
<vuetable |
|||
ref="vuetable" |
|||
:key="vuetablekeyl" |
|||
:api-url='apiurl' |
|||
:api-mode="true" |
|||
:http-options="httpOptions" |
|||
:fields="fields" |
|||
:item-actions="itemActions" |
|||
:sort-order="sortOrder" |
|||
:show-sort-icons="true" |
|||
:multi-sort="multiSort" |
|||
:per-page="perpage" |
|||
pagination-path="links.pagination" |
|||
:pagination-component="paginationComponent" |
|||
:append-params="moreParams" |
|||
wrapper-class="vuetable-wrapper" |
|||
loading-class="loading" |
|||
detail-row-id="id" |
|||
@vuetable:pagination-data="onPaginationData" |
|||
@vuetable:load-success="loadsuccess" |
|||
@vuetable:load-error="onLoadError" |
|||
:css="css.table" |
|||
> |
|||
|
|||
<div slot="actions" slot-scope="props"> |
|||
<button |
|||
v-if="actionrowindex == props.rowIndex" |
|||
class="ti-more-alt btn btn-secondary btn-sm" |
|||
round |
|||
@click="onAction('run-more', props.rowData, props.rowIndex)"> |
|||
</button> |
|||
<button |
|||
v-else |
|||
class="ti-more btn btn-outline-secondary btn-sm" |
|||
round |
|||
@click="onAction('run-more', props.rowData, props.rowIndex)"> |
|||
</button> |
|||
</div> |
|||
|
|||
|
|||
<div slot="actionslocal" slot-scope="props"> |
|||
<div class="d-flex justify-content-center" |
|||
v-if="checkbuildrowindex(props.rowData,props.rowIndex)" |
|||
> |
|||
<button |
|||
v-if="testactionrowindex[props.rowData.name] == props.rowIndex" |
|||
class="ti-trash btn btn-info btn-sm" |
|||
title="Remove Box_Instance" |
|||
round |
|||
@click="onAction('delete-item', props.rowData, props.rowIndex)" |
|||
> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</vuetable> |
|||
<div class="vuetable-pagination ui basic segment grid"> |
|||
<vuetable-pagination-info |
|||
ref="paginationInfo" |
|||
:css="css.paginationInfo" |
|||
> |
|||
</vuetable-pagination-info> |
|||
<vuetable-pagination |
|||
:css="css.pagination" |
|||
ref="pagination" |
|||
@vuetable-pagination:change-page="onChangePage" |
|||
> |
|||
</vuetable-pagination> |
|||
</div> |
|||
</div> |
|||
</b-container> |
|||
</card> |
|||
</template> |
|||
<script> |
|||
import store from '@/store/index' |
|||
import {mapState, mapGetters, mapActions,dispatch} from 'vuex' |
|||
import Vue from 'vue' |
|||
import {Vuetable, VuetablePaginationDropdown} from 'vuetable-2' |
|||
import VuetablePaginationInfo from 'vuetable-2/src/components/VuetablePaginationInfo' |
|||
import VuetablePagination from 'vuetable-2/src/components/VuetablePagination' |
|||
import CssConfig from 'vuetable-2/src/components/VuetableCssConfig.js' |
|||
import card from '@/components/Card.vue' |
|||
import {ApiConfig} from "@/config/index"; |
|||
export default { |
|||
components: { |
|||
card, |
|||
Vuetable, |
|||
VuetablePagination, |
|||
VuetablePaginationInfo, |
|||
VuetablePaginationDropdown |
|||
}, |
|||
props: { |
|||
}, |
|||
data() { |
|||
return{ |
|||
actionrowindex:'', |
|||
playbookInfo: {}, |
|||
token: '', |
|||
build_file :{}, |
|||
testactionrowindex:[], // downloaded used in installed |
|||
playbook: { |
|||
'title':'', |
|||
'name':'', |
|||
'description':'' |
|||
}, |
|||
container:{ |
|||
name:'', |
|||
view:0 |
|||
}, |
|||
pipeline:{}, |
|||
selected: 'hybrid', |
|||
options: [ |
|||
{ text: 'Packages', value: 'packages' }, |
|||
{ text: 'Images', value: 'images' }, |
|||
{ text: 'Scripts', value: 'scripts' } |
|||
], |
|||
showModal: false, |
|||
visibility: [], |
|||
active:false, |
|||
rmbox:{}, |
|||
vuetablekeyl:0, |
|||
fielddata:{}, |
|||
fields: [ |
|||
{ |
|||
name: 'name', |
|||
title: '<span class="orange"></span>Name', |
|||
sortField: 'name', |
|||
visible:true, |
|||
dataClass: 'text-left text-wrap text-break break-word', |
|||
width: '65%' |
|||
}, |
|||
{ |
|||
name: 'Image', |
|||
title: '<span class="orange"></span>Image', |
|||
//sortField: 'Image', |
|||
visible:false, |
|||
dataClass: 'left aligned w-25', |
|||
width: '15%', |
|||
formatter (value) { |
|||
const result = /^ondemand_playground/.test(value); |
|||
if (result) { |
|||
var v = '<p class="text-warning">Playground</p>' |
|||
return v |
|||
}else{ |
|||
var v = '<p class="text-info">Lab</p>' |
|||
return v |
|||
} |
|||
} |
|||
|
|||
}, |
|||
{ |
|||
name: '_id', |
|||
title: '<span class="orange"></span>mongo', |
|||
visible:false |
|||
}, |
|||
{ |
|||
name: 'Status', |
|||
title: '<span class="orange"></span>Status', |
|||
sortField: 'Status', |
|||
titleClass: 'center aligned', |
|||
visible:true, |
|||
width: '10%' |
|||
}, |
|||
{ |
|||
name: 'ID', |
|||
sortField: 'ID', |
|||
titleClass: 'center aligned', |
|||
dataClass: 'left aligned w-25', |
|||
visible:false, |
|||
width: '15%' |
|||
}, |
|||
{ |
|||
name: '__slot:actionslocal', // <---- |
|||
title: 'Box', |
|||
titleClass: 'center', |
|||
dataClass: 'center aligned', |
|||
width: '5%' |
|||
}, |
|||
{ |
|||
name: '__slot:actions', // <---- |
|||
title: 'Actions', |
|||
titleClass: 'center aligned', |
|||
dataClass: 'center aligned', |
|||
width: '5%' |
|||
}, |
|||
], |
|||
apiurl:ApiConfig.url_80+"/buildservices", |
|||
//apiurl:ApiConfig.swarmlab_url_80+"/swarmlabhybridservices", |
|||
css: CssConfig, |
|||
perpage: 5, |
|||
searchFor: '', |
|||
sortOrder: [{ |
|||
field: 'name', |
|||
direction: 'asc' |
|||
}], |
|||
multiSort: true, |
|||
paginationComponent: 'vuetable-pagination', |
|||
itemActions: [ |
|||
{ name: 'view-item', label: '', icon: 'glyphicon glyphicon-zoom-in', class: 'btn btn-info', extra: {'title': 'View', 'data-toggle':"tooltip", 'data-placement': "left"} }, |
|||
{ name: 'edit-item', label: '', icon: 'glyphicon glyphicon-pencil', class: 'btn btn-warning', extra: {title: 'Edit', 'data-toggle':"tooltip", 'data-placement': "top"} }, |
|||
{ name: 'delete-item', label: '', icon: 'glyphicon glyphicon-remove', class: 'btn btn-danger', extra: {title: 'Delete', 'data-toggle':"tooltip", 'data-placement': "right" } } |
|||
], |
|||
moreParams: { |
|||
'filter': '', |
|||
'type': 'scripts', |
|||
'tutor': 'yes' |
|||
}, |
|||
|
|||
} |
|||
}, |
|||
mounted() { |
|||
this.$root.$on('SERVER_build_closebuild', (v) => { |
|||
console.log('build from server '+JSON.stringify(v)) |
|||
if(v.build == "ok" && v.file !== 'false'){ |
|||
Vue.set(this.build_file, v.name, v.name) |
|||
// this.$set(this.user, 'last_name', 'Doe') |
|||
console.log('build ok '+JSON.stringify(this.build_file)) |
|||
}else{ |
|||
Vue.delete(this.build_file, v.name) |
|||
console.log('build no '+JSON.stringify(this.build_file)) |
|||
} |
|||
if( v.homefile_exist == 'yes'){ |
|||
console.log('build no '+JSON.stringify(v.homefile)) |
|||
var info = ` |
|||
<b-container fluid> |
|||
<div class="row text-center"> |
|||
<div class="col-12"> |
|||
|
|||
<h5> <b>File exists</b> </h5> |
|||
<h5> Error: You cannot Create a VM that already exists.</h5> |
|||
<h5> Please rename or remove the file and Retry </h5> |
|||
<p class="mb-1 list-group-item list-group-item-success"> |
|||
${v.homefile} |
|||
</p> |
|||
</div> <!-- col --> |
|||
</div> <!-- row --> |
|||
</b-container fluid> |
|||
` |
|||
this.$swal({ |
|||
type: 'info', |
|||
html: info, |
|||
icon: 'info', |
|||
showCloseButton: true, |
|||
showLoaderOnConfirm: false, |
|||
allowOutsideClick: false, |
|||
cancelButtonText: 'No, cancel!', |
|||
showCancelButton: false, |
|||
showLoaderOnConfirm: false, |
|||
reverseButtons: true, |
|||
focusCancel: false, |
|||
confirmButtonText: 'ok! ' |
|||
}) |
|||
} |
|||
this.refreshVuetable() |
|||
}) |
|||
}, |
|||
created() { |
|||
var url_string = window.location.href |
|||
var url = new URL(url_string); |
|||
this.token = url.searchParams.get("token"); |
|||
//console.log("token "+ this.token); |
|||
|
|||
}, |
|||
beforeDestroy () { |
|||
this.$root.$off('SERVER_build_closebuild') |
|||
}, |
|||
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: { |
|||
onError (type,description) { |
|||
var winfo=description |
|||
var info='<h5>Bootstrap '+type+'</h5>' |
|||
this.$swal({ |
|||
type: type, |
|||
html: info+winfo, |
|||
showCloseButton: true, |
|||
showLoaderOnConfirm: false, |
|||
allowOutsideClick: false, |
|||
cancelButtonText: 'No, cancel!', |
|||
showCancelButton: false, |
|||
showLoaderOnConfirm: false, |
|||
reverseButtons: true, |
|||
focusCancel: true, |
|||
confirmButtonText: 'Ok!' |
|||
}) |
|||
}, |
|||
|
|||
|
|||
setRefresh () { |
|||
this.moreParams = { |
|||
'filter': '', |
|||
'type': this.selected |
|||
} |
|||
Vue.nextTick( () => this.$refs.vuetable.refresh()) |
|||
}, |
|||
setFilter () { |
|||
this.moreParams = { |
|||
'filter': this.searchFor, |
|||
'type': this.selected |
|||
} |
|||
Vue.nextTick( () => this.$refs.vuetable.refresh()) |
|||
}, |
|||
resetFilter () { |
|||
this.moreParams = {} |
|||
this.searchFor = '' |
|||
Vue.nextTick( () => this.$refs.vuetable.refresh()) |
|||
}, |
|||
onPaginationData (paginationData) { |
|||
this.$refs.pagination.setPaginationData(paginationData) |
|||
this.$refs.paginationInfo.setPaginationData(paginationData) |
|||
}, |
|||
onChangePage (page) { |
|||
this.$refs.vuetable.changePage(page) |
|||
}, |
|||
editRow(rowData) { |
|||
alert("You clicked edit on"+ JSON.stringify(rowData)); |
|||
}, |
|||
async onAction (action, data, index) { |
|||
this.actionrowindex = index |
|||
this.rmbox = data |
|||
var obj = {} |
|||
obj.name = data.name |
|||
obj.dir = data.dir |
|||
obj.config = data.config |
|||
this.$root.$emit('BUILD_hybrid_show_info',data) |
|||
console.log('index '+this.actionrowindex) |
|||
console.log('data '+JSON.stringify(obj)) |
|||
if(action == 'view-item' ){ |
|||
console.log('data' + JSON.stringify(data)) |
|||
console.log('index '+JSON.stringify(index)) |
|||
console.log('build info '+JSON.stringify(this.build_file)) |
|||
}else if(action == 'delete-item' ){ |
|||
var info = ` |
|||
<b-container fluid> |
|||
<div class="row text-center"> |
|||
<div class="col-12"> |
|||
<p class="mb-1 list-group-item list-group-item-success"> |
|||
Remove |
|||
</p> |
|||
</div> <!-- col --> |
|||
</div> <!-- row --> |
|||
</b-container fluid> |
|||
` |
|||
this.$swal({ |
|||
type: 'info', |
|||
html: info, |
|||
showCloseButton: true, |
|||
showLoaderOnConfirm: false, |
|||
allowOutsideClick: false, |
|||
cancelButtonText: 'No, cancel!', |
|||
showCancelButton: true, |
|||
showLoaderOnConfirm: false, |
|||
reverseButtons: true, |
|||
focusCancel: false, |
|||
confirmButtonText: 'Remove the box! ' |
|||
}).then((result)=> { |
|||
this.removeAndClose(result); |
|||
}) |
|||
console.log('data da1 '+JSON.stringify(data)) |
|||
}else if(action == 'run-item' ){ |
|||
} |
|||
}, |
|||
async removeAndClose(result){ |
|||
var obj = {} |
|||
obj.instance = this.rmbox.name |
|||
obj.dir = this.rmbox.dir |
|||
obj.config = this.rmbox.config |
|||
if (result.isConfirmed) { |
|||
//console.log('value obj11111111111111111111111 '+ JSON.stringify(result)) |
|||
var res1 = await store.dispatch('pipelineLLO/rmbuildstatus', obj) |
|||
console.log('value objdata111111111111111111 '+ JSON.stringify(res1)) |
|||
if(res1.data.data == 'yes'){ |
|||
Vue.delete(this.testactionrowindex, data.name) |
|||
Vue.nextTick( () => this.$refs.vuetable.refresh()) |
|||
} |
|||
}else { |
|||
console.log('no') |
|||
} |
|||
}, |
|||
async checkbuildrowindex(data,index){ |
|||
if(this.testactionrowindex[index] == index){ |
|||
var obj = {} |
|||
obj.token = this.token |
|||
obj.instance = data.name |
|||
var res1 = await store.dispatch('pipelineLLO/getbuildstatus', obj) |
|||
if(res1.data.data == 'yes'){ |
|||
Vue.set(this.testactionrowindex, data.name, index) |
|||
}else{ |
|||
Vue.delete(this.testactionrowindex, data.name) |
|||
} |
|||
console.log('resi NO3 '+JSON.stringify(this.testactionrowindex)) |
|||
}else{ |
|||
var obj = {} |
|||
obj.token = this.token |
|||
obj.instance = data.name |
|||
var res = await store.dispatch('pipelineLLO/getbuildstatus', obj) |
|||
if(res.data.data == 'yes'){ |
|||
Vue.set(this.testactionrowindex, index, index) |
|||
}else{ |
|||
Vue.delete(this.testactionrowindex, data.name) |
|||
} |
|||
console.log('resi NO2 '+JSON.stringify(this.testactionrowindex)) |
|||
} |
|||
}, |
|||
refreshVuetable() { |
|||
this.$nextTick(()=>{ |
|||
this.vuetablekeyl += 1 |
|||
}) |
|||
}, |
|||
playbookinfoShow(value) { |
|||
return this.visibility[value]=true |
|||
}, |
|||
playbookinfo(value) { |
|||
return this.playbookInfo=value |
|||
}, |
|||
rowClicked(row, event) { |
|||
return { |
|||
html: true, |
|||
title: () => { return 'Hello <b>Popover:</b> ' + (++this.counter) }, |
|||
content: () => { return 'The date is:<br><em>' + new Date() + '</em>' } |
|||
} |
|||
}, |
|||
loadsuccess(response) { |
|||
var data = response.data.data |
|||
this.fielddata=data |
|||
var n = data.length |
|||
n=n-1 |
|||
}, |
|||
onLoadError(payload) { |
|||
/* |
|||
//error2 "invalid_token" join-service.vue:684 |
|||
//error2 "The access token provided has expired" join-service.vue:685 |
|||
//error2 "Unauthorized" join-service.vue:686 |
|||
//error2 401 |
|||
console.log('error2 '+JSON.stringify(payload.response.data.error)) |
|||
console.log('error2 '+JSON.stringify(payload.response.data.error_description)) |
|||
console.log('error2 '+JSON.stringify(payload.response.statusText)) |
|||
console.log('error2 '+JSON.stringify(payload.response.status)) |
|||
*/ |
|||
if(payload.response.status == '401'){ |
|||
window.location.href = 'https://api-login.swarmlab.io:8089'; |
|||
Vue.nextTick( () => window.location.href = 'https://api-login.swarmlab.io:8089') |
|||
} |
|||
} |
|||
|
|||
|
|||
}, |
|||
|
|||
|
|||
actions: { |
|||
|
|||
|
|||
} |
|||
|
|||
}; |
|||
</script> |
|||
<style> |
|||
.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> |
@ -0,0 +1,821 @@ |
|||
<template> |
|||
<card class="card-user" style="max-height:100%" |
|||
v-show="menou" |
|||
> |
|||
<div class="author"> |
|||
<img class="avatar border-white" src="@/assets/img/docker.png" alt="..."> |
|||
</div> |
|||
|
|||
<b-container fluid class="bv-example-row"> |
|||
<div class="row text-center"> |
|||
<div class="col-12"> |
|||
<b>View and Manage your builds</b> |
|||
</div> |
|||
</div> |
|||
|
|||
<br> |
|||
|
|||
<div class="row" |
|||
v-if="menouselect" |
|||
> |
|||
<div class="col-sm-12 sm-12"> |
|||
<b-form-select v-model="selected" :options="options" size="sm" class="mt-3" |
|||
@change="setservice"> |
|||
></b-form-select> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row"> |
|||
<div class="col-sm-12 sm-12"> |
|||
<div class="input-group"> |
|||
<div class="input-group-prepend"> |
|||
<span class="input-group-text" name="validationTooltipUsernamePrepend1">Base Service Name</span> |
|||
</div> |
|||
<input |
|||
type="text" |
|||
class="form-control text-success" |
|||
v-model="form_baseservice" |
|||
disabled |
|||
aria-describedby="validationTooltipUsernamePrepend1" |
|||
> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<ValidationProvider |
|||
ref="hybrid_stackname" |
|||
name="myServicename" |
|||
rules="required|alpha_num_name" |
|||
v-slot="{ errors, ariaMsg, ariaInput, valid, invalid }" |
|||
> |
|||
<div class="row"> |
|||
<div class="col-sm-12 sm-12"> |
|||
<div class="input-group input-group-sm sm-3"> |
|||
<div class="input-group-prepend"> |
|||
<span class="input-group-text" >Service Name</span> |
|||
</div> |
|||
<input |
|||
type="text" |
|||
class="form-control" |
|||
v-bind:class="{'is-valid': isDeployValid.stackname == 1, 'is-invalid': isDeployValid.stackname == 2}" |
|||
aria-label="Small" aria-describedby="inputGroup-sizing-sm" |
|||
v-model="form_myservicename" |
|||
v-on:keyup="isValid('stackname')" |
|||
v-on:blur="isValid('stackname')" |
|||
v-on:input="isValid('stackname')" |
|||
v-on:change="isValid('stackname')" |
|||
v-on:focus="isValid('stackname')" |
|||
|
|||
data-vv-as='"nyServicename"' |
|||
data-vv-value-path="form_myservicename" |
|||
data-vv-name="form_myservicename" |
|||
|
|||
> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<span class="hybrid-field-error">{{ errors[0] }}</span> |
|||
</ValidationProvider> |
|||
|
|||
<ValidationProvider |
|||
ref="hybrid_stackversion" |
|||
name="myVersion" |
|||
rules="required|alpha_num_name" |
|||
v-slot="{ errors, ariaMsg, ariaInput, valid, invalid }" |
|||
> |
|||
<div class="row"> |
|||
<div class="col-sm-12 sm-12"> |
|||
<div class="input-group input-group-sm sm-3"> |
|||
<div class="input-group-prepend"> |
|||
<span class="input-group-text" >Service Version</span> |
|||
</div> |
|||
<input |
|||
type="text" |
|||
class="form-control" |
|||
aria-label="Small" aria-describedby="inputGroup-sizing-sm" |
|||
v-bind:class="{'is-valid': isDeployValid.stackversion == 1, 'is-invalid': isDeployValid.stackversion == 2}" |
|||
name="myVersion" |
|||
v-model="form_version" |
|||
v-on:keyup="isValid('stackversion')" |
|||
v-on:blur="isValid('stackversion')" |
|||
v-on:input="isValid('stackversion')" |
|||
v-on:change="isValid('stackversion')" |
|||
v-on:focus="isValid('stackversion')" |
|||
> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<span class="hybrid-field-error">{{ errors[0] }}</span> |
|||
</ValidationProvider> |
|||
|
|||
<div class="row"> |
|||
<div class="col-sm-12 sm-12"> |
|||
<div class="input-group"> |
|||
<div class="input-group-prepend"> |
|||
<span class="input-group-text" name="validationTooltipUsernamePrepend">Git-repo</span> |
|||
</div> |
|||
<input |
|||
type="text" |
|||
class="form-control" |
|||
v-model="form_gitrepo" |
|||
name="validationTooltipUsername" |
|||
aria-describedby="validationTooltipUsernamePrepend" |
|||
> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="row" |
|||
<b-col class="text-center" cols="12" sm="12" md="12"> |
|||
<div class="form-group"> |
|||
<label for="customreadme" class="text-dark"> <b>README </b> <br> |
|||
</label> |
|||
<textarea class="form-control" name="customreadme" rows="8" |
|||
v-model="form_readme" |
|||
> |
|||
{{ form_readme }} |
|||
</textarea> |
|||
</div> |
|||
</b-col> |
|||
</div> |
|||
|
|||
|
|||
<div class="row" |
|||
<b-col class="text-center" cols="12" sm="12" md="12"> |
|||
<div class="form-group"> |
|||
<label for="custompackages" class="text-dark"><b>Add Extrapackages</b> <br> |
|||
<span class="text-success"> |
|||
{{ customostext }} |
|||
</span > |
|||
</label> |
|||
<textarea class="form-control" name="custompackages" rows="8" |
|||
v-model="form_os" |
|||
> |
|||
{{ form_os }} |
|||
</textarea> |
|||
</div> |
|||
</b-col> |
|||
</div> |
|||
|
|||
<div class="row" |
|||
<b-col class="text-center" cols="12" sm="12" md="12"> |
|||
<div class="form-group"> |
|||
<label for="customshell" class="text-dark"><b>Custom sh script</b> <br> |
|||
<span class="text-success"> |
|||
{{ customshtext }} |
|||
</span > |
|||
</label> |
|||
<textarea class="form-control" name="customshell" rows="8" |
|||
v-model="form_sh" |
|||
> |
|||
{{ form_sh }} |
|||
</textarea> |
|||
</div> |
|||
</b-col> |
|||
</div> |
|||
|
|||
<div class="row"> |
|||
<div class="col-sm-3 sm-3"> |
|||
<div class="input-group"> |
|||
<div class="input-group-prepend"> |
|||
<span class="input-group-text" name="validationTooltipUsernamePrepend">Port</span> |
|||
</div> |
|||
<input |
|||
type="text" |
|||
class="form-control" |
|||
v-model="form_port1" |
|||
aria-describedby="validationTooltipUsernamePrepend" |
|||
> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-sm-4 sm-4"> |
|||
<div class="input-group"> |
|||
<div class="input-group-prepend"> |
|||
<span class="input-group-text" name="validationTooltipUsernamePrepend">URI</span> |
|||
</div> |
|||
<input |
|||
type="text" |
|||
class="form-control" |
|||
v-model="form_url1" |
|||
placeholder="http/https" |
|||
aria-describedby="validationTooltipUsernamePrepend" |
|||
> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-sm-5 sm-5"> |
|||
<div class="input-group"> |
|||
<div class="input-group-prepend"> |
|||
<span class="input-group-text" name="validationTooltipUsernamePrepend1a">Name</span> |
|||
</div> |
|||
<input |
|||
type="text" |
|||
class="form-control" |
|||
v-model="form_name1" |
|||
aria-describedby="validationTooltipUsernamePrepend1a" |
|||
> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<div class="row"> |
|||
<div class="col-sm-3 sm-3"> |
|||
<div class="input-group"> |
|||
<div class="input-group-prepend"> |
|||
<span class="input-group-text" name="validationTooltipUsernamePrepend2">Port</span> |
|||
</div> |
|||
<input |
|||
type="text" |
|||
class="form-control" |
|||
v-model="form_port2" |
|||
aria-describedby="validationTooltipUsernamePrepend2" |
|||
> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="col-sm-4 sm-4"> |
|||
<div class="input-group"> |
|||
<div class="input-group-prepend"> |
|||
<span class="input-group-text" name="validationTooltipUsernamePrepend">URI</span> |
|||
</div> |
|||
<input |
|||
type="text" |
|||
class="form-control" |
|||
v-model="form_url2" |
|||
placeholder="http/https" |
|||
aria-describedby="validationTooltipUsernamePrepend" |
|||
> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-sm-5 sm-5"> |
|||
<div class="input-group"> |
|||
<div class="input-group-prepend"> |
|||
<span class="input-group-text" name="validationTooltipUsernamePrepend2a">Name</span> |
|||
</div> |
|||
<input |
|||
type="text" |
|||
class="form-control" |
|||
v-model="form_name2" |
|||
aria-describedby="validationTooltipUsernamePrepend2a" |
|||
> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<div class="row"> |
|||
<div class="col-sm-3 sm-3"> |
|||
<div class="input-group"> |
|||
<div class="input-group-prepend"> |
|||
<span class="input-group-text" name="validationTooltipUsernamePrepend3">Port</span> |
|||
</div> |
|||
<input |
|||
type="text" |
|||
class="form-control" |
|||
v-model="form_port3" |
|||
aria-describedby="validationTooltipUsernamePrepend2" |
|||
> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-sm-4 sm-4"> |
|||
<div class="input-group"> |
|||
<div class="input-group-prepend"> |
|||
<span class="input-group-text" name="validationTooltipUsernamePrepend">URI</span> |
|||
</div> |
|||
<input |
|||
type="text" |
|||
class="form-control" |
|||
v-model="form_url3" |
|||
placeholder="http/https" |
|||
aria-describedby="validationTooltipUsernamePrepend" |
|||
> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-sm-5 sm-5"> |
|||
<div class="input-group"> |
|||
<div class="input-group-prepend"> |
|||
<span class="input-group-text" name="validationTooltipUsernamePrepend3a">Name</span> |
|||
</div> |
|||
<input |
|||
type="text" |
|||
class="form-control" |
|||
v-model="form_name3" |
|||
aria-describedby="validationTooltipUsernamePrepend3a" |
|||
> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
<div class="row" |
|||
<b-col class="text-center" cols="12" sm="12" md="12"> |
|||
<div class="form-group"> |
|||
<label for="rclocal" class="text-dark"><b>rc.local</b> <br> |
|||
<span class="text-success"> |
|||
{{ customshtext }} |
|||
</span > |
|||
</label> |
|||
<textarea class="form-control" name="rclocal" rows="8" |
|||
v-model="form_rclocal" |
|||
> |
|||
{{ form_rclocal }} |
|||
</textarea> |
|||
</div> |
|||
</b-col> |
|||
</div> |
|||
|
|||
<div class="row"> |
|||
<div class="col-sm-12 sm-12 float-right"> |
|||
<button |
|||
class="btn btn-outline-info btn-sm float-right" |
|||
type="submit" |
|||
@click="save" |
|||
>Save Microservice</button> |
|||
<button |
|||
class="btn btn-outline-warning btn-sm float-right" |
|||
type="submit" |
|||
@click="cancel" |
|||
>Cancel</button> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</b-container> |
|||
</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 { ValidationObserver, ValidationProvider, extend } from 'vee-validate'; |
|||
//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' |
|||
}); |
|||
|
|||
|
|||
extend('alpha_num_name', value => { |
|||
var regex = new RegExp(/^[A-Za-z0-9]+$/, 'i'); |
|||
if(regex.test(value)){ |
|||
return true; |
|||
} |
|||
return 'The {_field_} field may contain alphabetic characters and numbers' |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
export default { |
|||
components: { |
|||
ValidationProvider, |
|||
card |
|||
}, |
|||
props: { |
|||
}, |
|||
data() { |
|||
return{ |
|||
customostext: '', |
|||
customshtext: '', |
|||
menou: false, |
|||
custom: { |
|||
'os':'', |
|||
'sh':'', |
|||
}, |
|||
customserviceall: [], |
|||
'form_baseservice':'', |
|||
'form_myservicename':'', |
|||
'form_os':'', |
|||
'form_sh':'', |
|||
'form_readme': '', |
|||
'form_version':'', |
|||
'form_rclocal':'', |
|||
'form_url1':'', |
|||
'form_url2':'', |
|||
'form_url3':'', |
|||
'form_port1':'', |
|||
'form_name1':'', |
|||
'form_port2':'', |
|||
'form_name2':'', |
|||
'form_port3':'', |
|||
'form_name3':'', |
|||
'form_gitrepo':'', |
|||
customservice: { |
|||
'myservicename':'', |
|||
'os':'', |
|||
'sh':'', |
|||
'readme': '', |
|||
'microservice':'', |
|||
'version':'', |
|||
'rclocal':'', |
|||
'url1':'', |
|||
'url2':'', |
|||
'url3':'', |
|||
'port1':'', |
|||
'name1':'', |
|||
'port2':'', |
|||
'name2':'', |
|||
'port3':'', |
|||
'name3':'', |
|||
'gitrepo':'' |
|||
}, |
|||
addNetworkMenou:false, |
|||
issocket:'close', |
|||
isDeployValid:{ |
|||
"stackname":3, |
|||
"stackversion":3 |
|||
}, |
|||
isDeployError:{ |
|||
}, |
|||
selected: 1, |
|||
menouselect: false, |
|||
options: [ |
|||
{"value":99999,"text":"Please select an option"} |
|||
] |
|||
} |
|||
}, |
|||
beforeMount () { |
|||
}, |
|||
mounted() { |
|||
this.$root.$on('hybrid_build_micro_service_menou', () => { |
|||
this.menou = false |
|||
//console.log('false') |
|||
}) |
|||
this.$root.$on('hybrid_build_micro_service', (service) => { |
|||
//console.log(service); |
|||
this.menou = true |
|||
this.myservicename = {} |
|||
this.customserviceall = [] |
|||
this.options = [] |
|||
this.customservice = {} |
|||
this.menouselect = false |
|||
this.customservice.microservice = service.data.swarmlabname |
|||
|
|||
if( service.log.hasOwnProperty('data')){ |
|||
if( service.log.data.hasOwnProperty('data')){ |
|||
if(service.log.data.data){ |
|||
//const cc = service.log.data.data.filter(item => item.service === '0').length; |
|||
var cc = Object.keys(service.log.data.data).length; |
|||
if(cc > 0){ |
|||
if(cc > 1){ |
|||
this.menouselect = true |
|||
} |
|||
cc-- |
|||
} |
|||
//console.log(cc) |
|||
this.customservice.myservicename = service.log.data.data[cc].service |
|||
this.customservice.baseservice = service.log.data.data[cc].baseservice |
|||
this.customservice.sh = service.log.data.data[cc].sh |
|||
this.customservice.os = service.log.data.data[cc].packages |
|||
this.customservice.readme = service.log.data.data[cc].readme |
|||
this.customservice.gitrepo = service.log.data.data[cc].gitrepo |
|||
this.customservice.version = service.log.data.data[cc].serviceversion |
|||
this.customservice.rclocal = service.log.data.data[cc].rclocal |
|||
|
|||
this.customservice.url1 = service.log.data.data[cc].url1 |
|||
this.customservice.url2 = service.log.data.data[cc].url2 |
|||
this.customservice.url3 = service.log.data.data[cc].url3 |
|||
this.customservice.port1 = service.log.data.data[cc].port1 |
|||
this.customservice.name1 = service.log.data.data[cc].name1 |
|||
this.customservice.port2 = service.log.data.data[cc].port2 |
|||
this.customservice.name2 = service.log.data.data[cc].name2 |
|||
this.customservice.port3 = service.log.data.data[cc].port3 |
|||
this.customservice.name3 = service.log.data.data[cc].name3 |
|||
this.setserviceform(this.customservice) |
|||
|
|||
for (let i = 0; i <= cc; i++) { |
|||
let option = { |
|||
value: i, |
|||
text: service.log.data.data[i].service |
|||
} |
|||
Vue.set(this.options, i, option) |
|||
this.selected = i |
|||
} |
|||
this.customserviceall = service.log.data.data |
|||
console.log('customall2 '+ JSON.stringify(this.customservice.myservicename)) |
|||
console.log('customall1 '+ JSON.stringify(service.log.data.data[cc])) |
|||
console.log('customall '+ JSON.stringify(this.customserviceall)) |
|||
} |
|||
} |
|||
} |
|||
this.selected++ |
|||
var vtmp1 = {"value":this.selected,"text":"Please select an option"} |
|||
Vue.set(this.options, this.selected, vtmp1) |
|||
console.log('options '+ JSON.stringify(this.options)) |
|||
|
|||
}) |
|||
|
|||
this.$root.$on('hybrid_build_micro_myservice', (service) => { |
|||
console.log(service); |
|||
this.menou = true |
|||
this.myservicename = {} |
|||
this.customserviceall = [] |
|||
this.customservice = {} |
|||
this.menouselect = false |
|||
this.customservice.microservice = service.data.swarmlabname |
|||
|
|||
if( service.log.hasOwnProperty('data')){ |
|||
if( service.log.data.hasOwnProperty('data')){ |
|||
if(service.log.data.data){ |
|||
this.customservice.myservicename = service.log.data.data.service |
|||
this.customservice.baseservice = service.log.data.data.baseservice |
|||
this.customservice.sh = service.log.data.data.sh |
|||
this.customservice.os = service.log.data.data.packages |
|||
this.customservice.readme = service.log.data.data.readme |
|||
this.customservice.gitrepo = service.log.data.data.gitrepo |
|||
this.customservice.version = service.log.data.data.serviceversion |
|||
this.customservice.rclocal = service.log.data.data.rclocal |
|||
|
|||
this.customservice.url1 = service.log.data.data.url1 |
|||
this.customservice.url2 = service.log.data.data.url2 |
|||
this.customservice.url3 = service.log.data.data.url3 |
|||
this.customservice.port1 = service.log.data.data.port1 |
|||
this.customservice.name1 = service.log.data.data.name1 |
|||
this.customservice.port2 = service.log.data.data.port2 |
|||
this.customservice.name2 = service.log.data.data.name2 |
|||
this.customservice.port3 = service.log.data.data.port3 |
|||
this.customservice.name3 = service.log.data.data.name3 |
|||
this.setserviceform(this.customservice) |
|||
} |
|||
} |
|||
} |
|||
|
|||
}) |
|||
}, |
|||
created() { |
|||
var url_string = window.location.href |
|||
var url = new URL(url_string); |
|||
this.token = url.searchParams.get("token"); |
|||
var log = store.dispatch("pipelineLLO/settoken",{ |
|||
token:this.token |
|||
}) |
|||
|
|||
}, |
|||
beforeDestroy () { |
|||
this.$root.$off('hybrid_build_micro_service') |
|||
this.$root.$off('hybrid_build_micro_myservice') |
|||
this.$root.$off('hybrid_build_micro_service_menou') |
|||
}, |
|||
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 save() { |
|||
(async () => { |
|||
var isAllValid = true |
|||
for (const [key, value] of Object.entries(this.isDeployValid)) { |
|||
//console.log(`${key}: ${value}`); |
|||
if(value != 1){ |
|||
isAllValid = false |
|||
} |
|||
} |
|||
if(isAllValid){ |
|||
|
|||
var log = await store.dispatch("pipelineLLO/addmycustomservice",{ |
|||
token:this.token, |
|||
service: this.form_myservicename, |
|||
readme: this.form_readme, |
|||
baseservice: this.form_baseservice, |
|||
sh: this.form_sh, |
|||
packages: this.form_os, |
|||
gitrepo: this.form_gitrepo, |
|||
serviceversion: this.form_version, |
|||
rclocal: this.form_rclocal, |
|||
url1: this.form_url1, |
|||
url2: this.form_url2, |
|||
url3: this.form_url3, |
|||
port1: this.form_port1, |
|||
name1: this.form_name1, |
|||
port2: this.form_port2, |
|||
name2: this.form_name2, |
|||
port3: this.form_port3, |
|||
name3: this.form_name3 |
|||
}) |
|||
// this.$root.$emit('hybrid_refresh_bootstrap_view') |
|||
// this.$root.$emit('hybrid_refresh_bootstrap_view') |
|||
|
|||
console.log(this.customservice); |
|||
//console.log(log); |
|||
if(log.data.action == 'ok'){ |
|||
var info = "Your upload was successful!" |
|||
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.$root.$emit('hybrid_build_micro_service_menou_refreshtable') |
|||
|
|||
}else{ |
|||
var info = "Service upload error " |
|||
this.$swal({ |
|||
type: 'Info', |
|||
title: 'Info!', |
|||
icon:'error', |
|||
html: info, |
|||
showCloseButton: true, |
|||
showLoaderOnConfirm: false, |
|||
allowOutsideClick: false, |
|||
cancelButtonText: 'No, cancel!', |
|||
showCancelButton: false, |
|||
showLoaderOnConfirm: false, |
|||
reverseButtons: true, |
|||
focusCancel: true, |
|||
confirmButtonText: 'Ok!' |
|||
}) |
|||
} |
|||
}else{ |
|||
var info = "Missing required fields" |
|||
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!' |
|||
}) |
|||
|
|||
} |
|||
})(); |
|||
|
|||
}, |
|||
cancel() { |
|||
//console.log('cancel'); |
|||
this.menou = false |
|||
}, |
|||
setserviceform(data) { |
|||
this.form_myservicename = data.myservicename |
|||
this.form_baseservice = data.baseservice |
|||
this.form_sh = data.sh |
|||
this.form_os = data.os |
|||
this.form_readme = data.readme |
|||
this.form_gitrepo = data.gitrepo |
|||
this.form_version = data.version |
|||
this.form_rclocal = data.rclocal |
|||
|
|||
this.form_url1 = data.url1 |
|||
this.form_url2 = data.url2 |
|||
this.form_url3 = data.url3 |
|||
this.form_port1 = data.port1 |
|||
this.form_name1 = data.name1 |
|||
this.form_port2 = data.port2 |
|||
this.form_name2 = data.name2 |
|||
this.form_port3 = data.port3 |
|||
this.form_name3 = data.name3 |
|||
//console.log(data) |
|||
//console.log(data.myservicename) |
|||
//console.log(this.form_myservicename) |
|||
}, |
|||
setservice() { |
|||
//console.log(this.selected); |
|||
var cc = this.selected |
|||
console.log('sel '+ JSON.stringify(this.customserviceall[cc])) |
|||
|
|||
this.customservice.myservicename = this.customserviceall[cc].service |
|||
|
|||
this.customservice.baseservice = this.customserviceall[cc].baseservice |
|||
this.customservice.sh = this.customserviceall[cc].sh |
|||
this.customservice.os = this.customserviceall[cc].packages |
|||
this.customservice.readme = this.customserviceall[cc].readme |
|||
this.customservice.gitrepo = this.customserviceall[cc].gitrepo |
|||
this.customservice.version = this.customserviceall[cc].serviceversion |
|||
this.customservice.rclocal = this.customserviceall[cc].rclocal |
|||
|
|||
this.customservice.url1 = this.customserviceall[cc].url1 |
|||
this.customservice.url2 = this.customserviceall[cc].url2 |
|||
this.customservice.url3 = this.customserviceall[cc].url3 |
|||
this.customservice.port1 = this.customserviceall[cc].port1 |
|||
this.customservice.name1 = this.customserviceall[cc].name1 |
|||
this.customservice.port2 = this.customserviceall[cc].port2 |
|||
this.customservice.name2 = this.customserviceall[cc].name2 |
|||
this.customservice.port3 = this.customserviceall[cc].port3 |
|||
this.customservice.name3 = this.customserviceall[cc].name3 |
|||
|
|||
//this.customservice.readme = 'xxxxxxxxxxxxxxxxxx' |
|||
//Vue.set(this.customservice, 'readme', 'xxxxxxxxxxxxxxxxxxxxxxxxx' ) |
|||
//console.log('sel1 '+ JSON.stringify(this.customservice)) |
|||
this.setserviceform(this.customservice) |
|||
}, |
|||
async isValid(f){ |
|||
|
|||
if(f == 'stackname'){ |
|||
var field = await this.$refs.hybrid_stackname.validate(); |
|||
if(field.valid == true){ |
|||
this.isDeployValid.stackname = 1 |
|||
}else{ |
|||
this.isDeployValid.stackname = 2 |
|||
} |
|||
} |
|||
else if(f == 'stackversion'){ |
|||
var field = await this.$refs.hybrid_stackversion.validate(); |
|||
if(field.valid == true){ |
|||
this.isDeployValid.stackversion = 1 |
|||
}else{ |
|||
this.isDeployValid.stackversion = 2 |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
}, |
|||
|
|||
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> |
Loading…
Reference in new issue