2021-04-24 20:09:28 +02:00
|
|
|
new Vue({
|
|
|
|
el: '#app',
|
|
|
|
data: function() {
|
|
|
|
return {
|
|
|
|
loading: false,
|
|
|
|
splash: false,
|
|
|
|
services: {},
|
|
|
|
addModalVisible: false,
|
|
|
|
addModalHost: undefined,
|
|
|
|
addModalPort: 8008,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
refresh: function() {
|
|
|
|
this.services = {
|
|
|
|
...this.services,
|
|
|
|
...JSON.parse(app.pollServices()),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
onClick: function(service) {
|
|
|
|
this.loadService(service.host, service.port)
|
|
|
|
},
|
|
|
|
|
|
|
|
onConnect: function() {
|
|
|
|
this.loadService(this.addModalHost, this.addModalPort)
|
|
|
|
},
|
|
|
|
|
|
|
|
loadService: function(host, port) {
|
|
|
|
this.loading = true
|
|
|
|
app.stopServicesPoll()
|
|
|
|
window.location.href = `http://${host}:${port}/`
|
|
|
|
},
|
|
|
|
|
|
|
|
splashScreen: function(duration) {
|
|
|
|
var self = this
|
|
|
|
this.splash = true
|
|
|
|
window.setTimeout(() => {
|
|
|
|
self.splash = false
|
|
|
|
}, duration)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted: function() {
|
2021-04-24 22:35:33 +02:00
|
|
|
this.splashScreen(2500)
|
2021-04-24 20:09:28 +02:00
|
|
|
app.startServicesPoll()
|
|
|
|
window.setInterval(this.refresh, 500)
|
|
|
|
}
|
|
|
|
})
|