mirror of
https://github.com/WebTools-NG/WebTools-NG
synced 2024-11-26 21:10:19 +00:00
#16 moved stuff to plextv.js
This commit is contained in:
parent
cb7f1d972c
commit
babfbb657f
3 changed files with 72 additions and 6 deletions
|
@ -52,8 +52,7 @@
|
|||
|
||||
<script>
|
||||
import store from '../../store';
|
||||
import { et } from "../modules/ExportTools/et";
|
||||
|
||||
import { ptv } from '../modules/General/plextv';
|
||||
const log = require('electron-log');
|
||||
|
||||
|
||||
|
@ -75,7 +74,7 @@ export default {
|
|||
},
|
||||
selected: function () {
|
||||
log.info('HEADER: selected server: ' + this.selectedOption.name)
|
||||
et.checkServerConnect(this.selectedOption)
|
||||
ptv.checkServerConnect(this.selectedOption)
|
||||
this.$store.commit("UPDATE_SELECTED_SERVER", this.selectedOption);
|
||||
|
||||
},
|
||||
|
|
|
@ -61,9 +61,28 @@ const et = new class ET {
|
|||
axios.get(baseurl + '/identity')
|
||||
.then(response => {
|
||||
log.info(response)
|
||||
}).catch(error => {
|
||||
log.error(error)
|
||||
})
|
||||
if(response.status == 200){
|
||||
log.info("NUGGA: ET : checkServerConnect: response status is 200")
|
||||
}
|
||||
}).catch((error) => {
|
||||
if (error.response) {
|
||||
// The request was made and tgite server responded with a status code
|
||||
// that falls out of the range of 2xx
|
||||
console.log(error.response.data)
|
||||
console.log(error.response.status)
|
||||
alert(error.response.data.error)
|
||||
//this.danger(error.response.status, error.response.data.error);
|
||||
} else if (error.request) {
|
||||
// The request was made but no response was received
|
||||
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
||||
// http.ClientRequest in node.js
|
||||
console.log(error.request);
|
||||
} else {
|
||||
// Something happened in setting up the request that triggered an Error
|
||||
console.log('Error', error.message);
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
let serverAdress = []
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
const log = require('electron-log');
|
||||
import axios from 'axios'
|
||||
|
||||
const ptv = new class PTV {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
checkServerConnect(server) {
|
||||
log.info("NUGGA : ET : checkServerConnect called")
|
||||
server.connections.forEach((val) => {
|
||||
log.info(val.uri)
|
||||
let baseurl = val.uri
|
||||
|
||||
axios.get(baseurl + '/identity')
|
||||
.then(response => {
|
||||
log.info(response)
|
||||
if(response.status == 200){
|
||||
log.info("NUGGA: PTV : checkServerConnect: response status is 200")
|
||||
|
||||
}
|
||||
}).catch((error) => {
|
||||
if (error.response) {
|
||||
// The request was made and tgite server responded with a status code
|
||||
// that falls out of the range of 2xx
|
||||
console.log(error.response.data)
|
||||
console.log(error.response.status)
|
||||
alert(error.response.data.error)
|
||||
//this.danger(error.response.status, error.response.data.error);
|
||||
} else if (error.request) {
|
||||
// The request was made but no response was received
|
||||
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
||||
// http.ClientRequest in node.js
|
||||
console.log(error.request);
|
||||
} else {
|
||||
// Something happened in setting up the request that triggered an Error
|
||||
console.log('Error', error.message);
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
let serverAdress = []
|
||||
|
||||
return serverAdress
|
||||
}
|
||||
|
||||
}
|
||||
export {ptv};
|
Loading…
Reference in a new issue