import { mapState, mapActions, commit } from 'vuex' import store from '@/store/index' import axios from 'axios' import {ApiConfig} from "@/config/index"; export default { namespaced: true, state: { token: '', socketStatus:'close', status: {}, statusswarmlab: {}, theme: {}, myCmfontSize: 11, config: {} }, getters: { getmytheme (state, container) { return state.theme }, getmyCmfontSize (state, container) { return state.myCmfontSize }, getsocketStatus (state, container) { return state.socketStatus }, gettoken (state, container) { return state.token }, getlog (state, container) { return state.log }, getconfig (state, container) { return state.config }, getstatus (state, container) { return state.status }, getstatusswarmlab (state, container) { return state.statusswarmlab } }, mutations: { set_mytheme (state, data) { console.log(data) console.log('data') state.theme=data; }, set_myCmfontSize (state, data) { state.myCmfontSize=data; }, set_socketStatus (state, data) { state.socketStatus=data; }, set_token (state, data) { state.token=data; }, set_status (state, data) { state.status=data; }, add_log (state, data) { //console.log("js1 set "+JSON.stringify(data)) state.log.push(data); }, add_config (state, data) { //console.log("js1 set "+JSON.stringify(data)) state.config = data }, add_statusswarmlab (state, data) { console.log("status server "+JSON.stringify(data)) state.statusswarmlab = data } }, actions: { setmytheme({commit}, value) { console.log("container "+value) commit('set_mytheme', value.instance) }, setmyCmfontSize({commit}, value) { //console.log("container "+value) commit('set_myCmfontSize', value.size) }, addstatusswarmlab({commit}, value) { commit('add_statusswarmlab', value) }, addconfig({commit}, value) { commit('add_config', value) }, addlog({commit}, value) { //console.log("container "+value) var tt = {} tt.message = value.log.log.message tt.tailed_path = value.log.log.tailed_path tt.date = value.log.date commit('add_log', tt) }, setsocketStatus({commit}, value) { //console.log("container "+value) commit('set_socketStatus', value.status) }, settoken({commit}, value) { //console.log("container "+value) commit('set_token', value.token) }, setstatus({commit}, value) { //console.log("container "+value) commit('set_status', value.status) }, async swarmlabstart({commit,rootGetters}, value) { //console.log('from '+JSON.stringify(value)) try { var token = value.token var params = { action: value.action, } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/run' var p = await axios.post(sock_server_l,params,options); //var p = await axios.post('http://localhost:8084/run',params,options); //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async oncompletiontracking({commit,rootGetters}, value) { try { var token = value.token var params = { action: value.action, track: value.track, course: value.course, chapter: value.chapter, evaluation: value.evaluation } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var p = await axios.post('https://api.swarmlab.io/completiontracking',params,options); if(p.error == "invalid_token"){ console.log(p) //console.log(JSON.stringify(p)) }else{ } //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async rmmycustomservice({commit,rootGetters}, value) { try { var token = value.token var params = { service: value.service } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var p = await axios.post('https://api.swarmlab.io/rmmycustomservice',params,options); return p if(p.error == "invalid_token"){ console.log(p) //console.log(JSON.stringify(p)) }else{ } //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getcompletion({commit,rootGetters}, value) { try { var token = rootGetters['pipelineLLO/gettoken'] var params = { course: value.course, chapter: value.chapter } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; const info = await axios.get('https://api.swarmlab.io/getcompletion',options); return info } catch (e) { //console.error(e); if(e.error == "invalid_token"){ window.location.href = 'https://api-login.swarmlab.io:8089'; } } }, async getmyservices({commit,rootGetters}, value) { try { var token = rootGetters['pipelineLLO/gettoken'] var params = { service: value.service } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; const info = await axios.get('https://api.swarmlab.io/getmyservices',options); return info } catch (e) { //console.error(e); if(e.error == "invalid_token"){ window.location.href = 'https://api-login.swarmlab.io:8089'; } } }, async addmycustomservice({commit,rootGetters}, value) { try { var token = value.token var params = { service: value.service, readme: value.readme, baseservice: value.baseservice, sh: value.sh, packages: value.packages, gitrepo: value.gitrepo, serviceversion: value.serviceversion, rclocal: value.rclocal, port1: value.port1, name1: value.name1, url1: value.url1, port2: value.port2, name2: value.name2, url2: value.url2, port3: value.port3, name3: value.name3, url3: value.url3 } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var p = await axios.post('https://api.swarmlab.io/addmycustomservice',params,options); return p if(p.error == "invalid_token"){ console.log(p) //console.log(JSON.stringify(p)) }else{ } //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getevents({commit,rootGetters}, value) { try { var token = rootGetters['pipelineLLO/gettoken'] var params = { begin: value.begin, end: value.end } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; const info = await axios.get('https://api.swarmlab.io/getswarmlabevents',options); return info } catch (e) { //console.error(e); if(e.error == "invalid_token"){ window.location.href = 'https://api-login.swarmlab.io:8089'; } } }, async swarmlabhybridapi({commit,rootGetters}, value) { try { var token = rootGetters['pipelineLLO/gettoken'] var save = value var params = { pipeline: save } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var pipelineApi = await axios.post('https://api.swarmlab.io/swarmlabhybridapi',params,options); return pipelineApi } catch (e) { if(e.error == "invalid_token"){ window.location.href = 'https://api-login.swarmlab.io:8089'; } console.error(e); } }, async getprogress({commit,rootGetters}, value) { try { var token = rootGetters['pipelineLLO/gettoken'] var params = { course: value.course } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; const info = await axios.get('https://api.swarmlab.io/getprogress',options); return info } catch (e) { //console.error(e); if(e.error == "invalid_token"){ window.location.href = 'https://api-login.swarmlab.io:8089'; } } }, async swarmlabhybridadd({commit,rootGetters}, value) { try { var token = value.token var params = { action: value.action, nodename: value.nodename, nodeip: value.nodeip, nodeid: value.nodeid, noderole: value.noderole, nodezones: value.nodezones, nodedesc: value.nodedesc } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var p = await axios.post('https://api.swarmlab.io/swarmlabhybridadd',params,options); if(p.error == "invalid_token"){ console.log(p) //console.log(JSON.stringify(p)) }else{ } //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async swarmlabhybridrm({commit,rootGetters}, value) { try { var token = value.token var params = { action: value.action, nodename: value.nodename, nodeip: value.nodeip, nodeid: value.nodeid, noderole: value.noderole, nodezones: value.nodezones, nodedesc: value.nodedesc } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var p = await axios.post('https://api.swarmlab.io/swarmlabhybridrm',params,options); if(p.error == "invalid_token"){ console.log(p) //console.log(JSON.stringify(p)) }else{ } //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getjupyterinfo({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getjupyterinfo' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async rungui({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/rungui' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async runguicustom({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance, exec: value.exec, id: value.id } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/runguicustom' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getcustom({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getcustom' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getcustomuser({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getcustomuser' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async savecustom({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance, package: value.package, sh: value.sh } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/savecustom' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async savecustomuser({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value, package: value.package, sh: value.sh } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/savecustomuser' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getservicesinfocustom({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getservicesinfocustom' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async get_stats_imagescontainers({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { action: value, } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/get_stats_imagescontainers' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async get_stats_containers({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { action: value, } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/get_stats_containers' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async runeditor({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/runeditor' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async chown({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/chown' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getlog4gui({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getlog4gui' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async chowncustom({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { user: value.user, service: value.service, baseservice: value.baseservice } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/chowncustom' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async checkowner({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/checkowner' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getinstallcustom({commit,rootGetters}, value) { try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getinstallcustom' var p = await axios.get(sock_server_l,options); return p //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async checkownercustom({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/checkownercustom' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async runbackup({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/runbackup' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async runbackupinstance({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/runbackupinstance' var p = await axios.get(sock_server_l,options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async runbackupinstanceuser({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/runbackupinstanceuser' var p = await axios.get(sock_server_l,options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async hybrid_rmimage({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/hybrid_rmimage' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async hybrid_rmnetworks({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/hybrid_rmnetworks' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async hybrid_inspectnetworks({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/hybrid_inspectnetworks' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async hybrid_inspectimages({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/hybrid_inspectimages' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async hybrid_inspectcontainer({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/hybrid_inspectcontainer' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async hybrid_rmall({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { action: value.action } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/hybrid_rmall' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getmountinfo({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getmountinfo' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getservicesinfo({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getservicesinfo' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getshareinfo({commit,rootGetters}, value) { try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getshareinfo' var p = await axios.get(sock_server_l,options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getnetworks({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getnetworks' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async updatenetworks({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { network: value.networks, defaultnetwork: value.defaultnetwork, container: value.container } var options = { //params: params, headers: { 'content-type': 'application/json',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/updatenetworks' var p = await axios.post(sock_server_l,params,options); //var p = await axios.get('https://localhost:3000/get_config',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) //window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getlogs({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { container: value } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getlogs' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesinfo',options); return p //console.log(JSON.stringify(p)) //console.log(value.token) //console.log(value.swarmlabname) } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getserviceshybridstatus({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { bootstrapnameid: value.bootstrapnameid, bootstrapstackname: value.bootstrapstackname } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getserviceshybridstatus' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesstatus',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getservicesstatus({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getservicesstatus' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesstatus',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getservicesstatusall({commit,rootGetters}, value) { try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getservicesstatusall' var p = await axios.get(sock_server_l,options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async stopservice({commit,rootGetters}, value) { try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/stopservice' var p = await axios.get(sock_server_l,options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async stopservicecustom({commit,rootGetters}, value) { try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/stopservicecustom' var p = await axios.get(sock_server_l,options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getservicesinfoall({commit,rootGetters}, value) { try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getservicesinfoall' var p = await axios.get(sock_server_l,options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getservicesinfoallcustom({commit,rootGetters}, value) { try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getservicesinfoallcustom' var p = await axios.get(sock_server_l,options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async rmbuildstatus({commit,rootGetters}, value) { //console.log('valuei22222222222222222222222222222222 '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/rmbuildstatus' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesstatus',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getbuildstatus({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getbuildstatus' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesstatus',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getstoragestatus({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getstoragestatus' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesstatus',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getpocstatus({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value.instance } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/getpocstatus' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/getservicesstatus',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async create_config({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { value: value.value } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/create_config' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/create_config',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async rmswarmlablocal({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/rm_swarmlab' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/get_config',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async rmswarmlablocaluser({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/rm_swarmlabuser' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/get_config',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async rmswarmlablocalpoc({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { instance: value } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/rm_swarmlabpoc' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/get_config',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async save_llo_asciidoctmp({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { code: value } var options = { //params: params, headers: { 'content-type': 'application/json',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/save_course_ascii' var p = await axios.post(sock_server_l,params,options); //var p = await axios.get('https://localhost:3000/get_config',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) //window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getstoragesudoprepare({commit,rootGetters}, value) { try { var token = value.token var params = { storagename: value } var options = { headers: { 'content-type': 'application/json',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/check_storage_sudorun' var p = await axios.post(sock_server_l,params,options); console.log('error '+JSON.stringify(p)) return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getstoragesudopreparestop({commit,rootGetters}, value) { try { var token = value.token var params = { storagename: value } var options = { headers: { 'content-type': 'application/json',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/check_storage_sudostop' var p = await axios.post(sock_server_l,params,options); console.log('error '+JSON.stringify(p)) return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async get_llo_course_ascii({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { dir: value.dir, file: value.file } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/get_course_ascii' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/get_config',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) //window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async get_llo_course({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { course: value } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/get_course' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/get_config',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async get_config({commit,rootGetters}, value) { //console.log('value '+JSON.stringify(value)) try { var token = value.token var params = { value: 'get' } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var sock_server_l = ApiConfig.url_80+'/get_config' var p = await axios.get(sock_server_l,options); //var p = await axios.get('https://localhost:3000/get_config',options); return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async getswarmlabinfo({commit,rootGetters}, value) { try { var token = rootGetters['pipelineLLO/gettoken'] //console.log('token ' + token) var params = { swarmlabname: value } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; const info = await axios.get('https://api.swarmlab.io/getswarmlabhybridservicesinfo',options); return info } catch (e) { //console.error(e); if(e.error == "invalid_token"){ window.location.href = 'https://api-login.swarmlab.io:8089'; } } }, async getswarmlabstorageinfo({commit,rootGetters}, value) { try { var token = rootGetters['pipelineLLO/gettoken'] //console.log('token ' + token) var params = { swarmlabname: value } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; const info = await axios.get('https://api.swarmlab.io/getswarmlabhybridstorageinfo',options); return info } catch (e) { //console.error(e); if(e.error == "invalid_token"){ window.location.href = 'https://api-login.swarmlab.io:8089'; } } }, async getswarmlabpocinfo({commit,rootGetters}, value) { try { var token = rootGetters['pipelineLLO/gettoken'] //console.log('token ' + token) var params = { swarmlabname: value } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; const info = await axios.get('https://api.swarmlab.io/getswarmlabhybridpocinfo',options); return info } catch (e) { //console.error(e); if(e.error == "invalid_token"){ window.location.href = 'https://api-login.swarmlab.io:8089'; } } }, async getswarmlabmicroserviceinfo({commit,rootGetters}, value) { try { var token = rootGetters['pipelineLLO/gettoken'] //console.log('token ' + token) var params = { swarmlabname: value } var options = { params: params, headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; const info = await axios.get('https://api.swarmlab.io/getswarmlabhybridmicroserviceinfo',options); return info } catch (e) { //console.error(e); if(e.error == "invalid_token"){ window.location.href = 'https://api-login.swarmlab.io:8089'; } } }, async hybrid_join({commit,rootGetters}, value) { try { var token = value.token var params = { node: value.node, bootstrapstackid: value.bootstrapstackid, bootstrapnameid: value.bootstrapnameid, action: 'join' } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var p = await axios.post('https://api.swarmlab.io/swarmlabhybridjoinstack',params,options); if(p.error == "invalid_token"){ console.log(p) //console.log(JSON.stringify(p)) }else{ } //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async hybrid_leave({commit,rootGetters}, value) { try { var token = value.token var params = { node: value.node, bootstrapstackid: value.bootstrapstackid, bootstrapnameid: value.bootstrapnameid, action: 'leave' } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var p = await axios.post('https://api.swarmlab.io/swarmlabhybridjoinstack',params,options); if(p.error == "invalid_token"){ console.log(p) //console.log(JSON.stringify(p)) }else{ } //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async swarmlabhybridconfig({commit,rootGetters}, value) { try { var token = value.token var params = { action: 'add' } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var p = await axios.post('https://api.swarmlab.io/swarmlabhybridconfiginfo',params,options); if(p.error == "invalid_token"){ console.log(p) //console.log(JSON.stringify(p)) }else{ } //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async hybrid_servicerm({commit,rootGetters}, value) { try { var token = value.token var params = { bootstrapstackid: value.bootstrapstackid, bootstrapnameid: value.bootstrapnameid, action: 'servicesrm' } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var p = await axios.post('https://api.swarmlab.io/swarmlabhybridrmservice',params,options); if(p.error == "invalid_token"){ console.log(p) //console.log(JSON.stringify(p)) }else{ } //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async stackrm({commit,rootGetters}, value) { try { var token = value.token var params = { bootstrapstackid: value.bootstrapstackid, action: 'stackrm' } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var p = await axios.post('https://api.swarmlab.io/swarmlabhybridrmstack',params,options); if(p.error == "invalid_token"){ console.log(p) console.log(JSON.stringify(p)) }else{ } //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async hybrid_servicerestart({commit,rootGetters}, value) { try { var token = value.token var params = { bootstrapnameid: value.bootstrapnameid, action: 'stackrestart' } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var p = await axios.post('https://api.swarmlab.io/swarmlabhybridrestartservice',params,options); if(p.error == "invalid_token"){ console.log(p) //console.log(JSON.stringify(p)) }else{ } //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async hybrid_servicelog({commit,rootGetters}, value) { try { var token = value.token var params = { bootstrapnameid: value.bootstrapnameid, action: 'stackrestlog' } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var p = await axios.post('https://api.swarmlab.io/swarmlabhybridlogservice',params,options); if(p.error == "invalid_token"){ console.log(p) //console.log(JSON.stringify(p)) }else{ } //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async swarmlabhybridjoin({commit,rootGetters}, value) { try { var token = value.token var params = { swarmlabservice: 'ondemand_test_spitifgdfgdfkngkndfkngkdfngkdfk', action: 'join' } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var p = await axios.post('https://api.swarmlab.io/swarmlabhybridjoin',params,options); if(p.error == "invalid_token"){ console.log(p) //console.log(JSON.stringify(p)) }else{ } //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, async adddeploy({commit,rootGetters}, value) { try { var token = value.token var params = { deploy: value.deploy, action: 'deploy' } var options = { headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` }, }; var p = await axios.post('https://api.swarmlab.io/adddeployhybrid',params,options); if(p.error == "invalid_token"){ console.log(p) //console.log(JSON.stringify(p)) }else{ } //console.log(value.token) //console.log(value.swarmlabname) //console.log(JSON.stringify(p)) return p } catch (e) { if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){ //console.log('error '+JSON.stringify(e)) window.location.href = 'https://api-login.swarmlab.io:8089'; }else{ var R = { ERROR_str: e, ERROR: 'yes' } return R; } } }, } }