diff --git a/src/components/chart/Chart.vue b/src/components/chart/Chart.vue index fb1ed793..3bca3926 100644 --- a/src/components/chart/Chart.vue +++ b/src/components/chart/Chart.vue @@ -36,7 +36,7 @@ @click="toggleTimeframeDropdown($event, $refs.timeframeButton)" class="-arrow -cases pane-header__highlight pane-chart__timeframe-selector" > - {{ !isKnownTimeframe ? timeframeForHuman : '' }} + {{ !isKnownTimeframe ? timeframeForHuman : '' }}
diff --git a/src/components/chart/TimeframeDropdown.vue b/src/components/chart/TimeframeDropdown.vue index 166b8727..b029a834 100644 --- a/src/components/chart/TimeframeDropdown.vue +++ b/src/components/chart/TimeframeDropdown.vue @@ -1,5 +1,5 @@ + diff --git a/src/components/panes/PaneHeader.vue b/src/components/panes/PaneHeader.vue index 7419efe4..4ea2d0dd 100644 --- a/src/components/panes/PaneHeader.vue +++ b/src/components/panes/PaneHeader.vue @@ -143,41 +143,25 @@ import Btn from '@/components/framework/Btn.vue' import { downloadAnything, getSiblings, slugify } from '@/utils/helpers' import dialogService from '@/services/dialogService' import { INFRAME } from '@/utils/constants' +import { Prop } from 'vue-property-decorator' @Component({ name: 'PaneHeader', - props: { - paneId: { - type: String - }, - settings: { - type: Function, - default: null - }, - showSearch: { - type: Boolean, - default: true - }, - showName: { - type: Boolean, - default: true - }, - split: { - type: Boolean, - default: true - } - }, components: { Btn } }) export default class PaneHeader extends Vue { - private settings?: () => Promise - paneId: string paneDropdownTrigger = null isLoading = false isInFrame = INFRAME + @Prop(String) readonly paneId: string + @Prop({ default: null }) readonly settings?: () => Promise + @Prop({ default: true }) readonly showSearch: boolean + @Prop({ default: true }) readonly showName: boolean + @Prop({ default: true }) readonly split: boolean + get zoom() { return this.$store.state.panes.panes[this.paneId].zoom || 1 } diff --git a/src/services/aggregatorService.ts b/src/services/aggregatorService.ts index f2b8b6bc..6e2f3ab5 100644 --- a/src/services/aggregatorService.ts +++ b/src/services/aggregatorService.ts @@ -268,7 +268,6 @@ class AggregatorService extends EventEmitter { listenVisibilityChange() { document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'visible') { - console.log('made visible') this.worker.postMessage({ op: 'clearReconnectionTimeout' }) } }) diff --git a/src/worker/aggregator.ts b/src/worker/aggregator.ts index d36cc39a..d0d531da 100644 --- a/src/worker/aggregator.ts +++ b/src/worker/aggregator.ts @@ -881,7 +881,14 @@ class Aggregator { clearReconnectionTimeout() { for (const exchange of exchanges) { - exchange.reconnectAllClosedApis() + if (exchange.reconnectAllClosedApis()) { + this.ctx.postMessage({ + op: 'notice', + data: { + title: `Reconnecting ${exchange.id}` + } + }) + } } } } diff --git a/src/worker/exchange.ts b/src/worker/exchange.ts index a726425e..f2e91f64 100755 --- a/src/worker/exchange.ts +++ b/src/worker/exchange.ts @@ -423,13 +423,14 @@ class Exchange extends EventEmitter { /** * Reconnect api * @param {Api} api + * @returns true if has attempted a reconnection */ - reconnectApi(api: Api) { + reconnectApi(api: Api): boolean { if (this.apis.indexOf(api) === -1) { console.debug( `[${this.id}.reconnectApi] reconnect api prevented because api doesn't exist anymore (url: ${api.url})` ) - return + return false } console.debug( @@ -443,9 +444,11 @@ class Exchange extends EventEmitter { ) const pairsToReconnect = [...api._pending, ...api._connected] - + const hasPairs = pairsToReconnect.length > 0 this.removeWs(api) this.reconnectPairs(pairsToReconnect, api._errored) + + return hasPairs } /** @@ -826,12 +829,17 @@ class Exchange extends EventEmitter { reconnectAllClosedApis() { this.scheduledOperationsDelays = {} + let isReconecting = false for (const api of this.apis) { if (api.readyState == WebSocket.CLOSED) { - this.reconnectApi(api) + if (!isReconecting && this.reconnectApi(api)) { + isReconecting = true + } } } + + return isReconecting } }