Убрал ненужный отладочный вывод, исправил сброс прокрутки сайдбара

This commit is contained in:
saber-nyan 2019-05-17 22:34:39 +03:00
parent 595dc3b20f
commit 6542e06ecd
No known key found for this signature in database
GPG Key ID: 7B069E9C295E6B4A
6 changed files with 7 additions and 20 deletions

View File

@ -47,7 +47,6 @@ export default {
},
methods: {
sendNewService() {
console.debug(`creating service name: ${this.service.name}, port: ${this.service.port}`);
const instance = axios.create({
baseURL: this.$store.state.apiUrl,
auth: {

View File

@ -27,8 +27,7 @@ export default {
}
},
watch: {
'streamId': function (streamId) {
console.debug('Content.vue: streamId changed! new:', streamId);
'streamId': function () {
this.packets = [];
this.$refs.infiniteLoading.stateChanger.reset();
},
@ -36,7 +35,6 @@ export default {
methods: {
infiniteHandler($state) {
if (!this.streamId) return $state.complete();
console.debug('getting next portion of packets...');
const instance = axios.create({
baseURL: this.$store.state.apiUrl,
auth: {

View File

@ -34,8 +34,7 @@ export default {
},
});
instance.delete(`/pattern/${this.id}`)
.then(response => {
console.debug('got r', response.data);
.then(() => {
this.$destroy();
this.$el.parentNode.removeChild(this.$el); // FIXME: может сломать Vue, лучше бы это убрать...
})

View File

@ -135,10 +135,7 @@ export default {
},
});
instance.post('/pattern/', this.newPattern)
.then(response => {
console.debug('got r', response.data);
this.getPatterns();
})
.then(this.getPatterns())
.catch(error => console.error('failed to create pattern', error));
},
},

View File

@ -70,20 +70,17 @@ export default {
}
},
watch: {
'servicePort': function (servicePort) {
console.debug('Sidebar.vue: port changed! new:', servicePort);
'servicePort': function () {
this.streams = [];
this.$refs.infiniteLoading.stateChanger.reset();
},
'$route.query': function (query) {
console.debug('Sidebar.vue: query changed! new:', query);
'$route.query.pId': function () {
this.streams = [];
this.$refs.infiniteLoading.stateChanger.reset();
},
},
methods: {
infiniteHandler($state) {
console.debug('getting next portion of streams...');
const instance = axios.create({
baseURL: this.$store.state.apiUrl,
auth: {
@ -124,7 +121,6 @@ export default {
});
},
onGotNewStream(stream) {
console.debug('got new stream from WS!', stream);
this.streams.pop();
this.streams.unshift(stream);
},

View File

@ -52,10 +52,10 @@ export default {
// FIXME: (https://groups.google.com/forum/#!topic/sockjs/4gmZy8XZFIY)
this.socket = new SockJS(wsUrl);
this.socket.onopen = function () {
console.debug('WS connected');
console.info('WS connected');
};
this.socket.onclose = function (ev) {
console.debug('WS disconnected', ev.code, ev.reason);
console.info('WS disconnected', ev.code, ev.reason);
if (ev.code === 1008) { // FIXME: выключить security timeout (This connection was established under an authenticated HTTP session that has ended.)
console.info('Security timeout, reconnecting...');
this.connectWs();
@ -63,10 +63,8 @@ export default {
};
this.socket.onmessage = ev => {
const parsed = JSON.parse(ev.data);
console.debug('WS got message', parsed);
const currentPort = parseInt(this.$route.params.servicePort, 10);
if (!(currentPort === undefined || currentPort === parsed.service.port)) {
console.debug('not related port, skipping...');
return;
}
this.$refs.sidebar.onGotNewStream(parsed);