mirror of
https://github.com/Av0idD4rk/packmate.git
synced 2026-10-24 10:09:25 +00:00
Автообновление списка сервисов
This commit is contained in:
parent
824bec994c
commit
04839c3a26
@ -33,6 +33,7 @@ export default {
|
|||||||
showSettingsModal: false,
|
showSettingsModal: false,
|
||||||
showAddServiceModal: false,
|
showAddServiceModal: false,
|
||||||
socket: null,
|
socket: null,
|
||||||
|
navbarTimer: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: ['servicePort', 'streamId',],
|
props: ['servicePort', 'streamId',],
|
||||||
@ -42,6 +43,9 @@ export default {
|
|||||||
},
|
},
|
||||||
connectWs() {
|
connectWs() {
|
||||||
const wsUrl = this.$store.state.apiUrl + '/ws';
|
const wsUrl = this.$store.state.apiUrl + '/ws';
|
||||||
|
// FIXME: нельзя посылать заголовок авторизации (может появиться окно с авторизацией, что не круто),
|
||||||
|
// FIXME: нужно либо убрать его на эндпоинте, либо использовать другой способ
|
||||||
|
// FIXME: (https://groups.google.com/forum/#!topic/sockjs/4gmZy8XZFIY)
|
||||||
this.socket = new SockJS(wsUrl);
|
this.socket = new SockJS(wsUrl);
|
||||||
this.socket.onopen = function () {
|
this.socket.onopen = function () {
|
||||||
console.debug('WS connected');
|
console.debug('WS connected');
|
||||||
@ -70,9 +74,11 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.connectWs();
|
this.connectWs();
|
||||||
|
this.navbarTimer = setInterval(this.reloadNavbar, 4000); // TODO: некрасиво, лучше ловить через WS
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.socket.close();
|
this.socket.close();
|
||||||
|
clearInterval(this.navbarTimer);
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
AddServiceModal,
|
AddServiceModal,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user