diff --git a/Frontend/src/app/app.component.ts b/Frontend/src/app/app.component.ts index 37442ef..1017cd6 100644 --- a/Frontend/src/app/app.component.ts +++ b/Frontend/src/app/app.component.ts @@ -18,28 +18,30 @@ export class AppComponent { ) { console.log('Start versionUpdates subscribe', this._swUpdate.isEnabled, environment.production); - this._swUpdate.versionUpdates.subscribe((evt) => { - console.log('Version update', evt); - if (evt.type === 'VERSION_READY') { - console.log('tt'); - this._swUpdate.activateUpdate().then(() => { - console.log('Update!'); - this._notifications.add({ - text: "New version available. DiunaBI will restart in 10 seconds.", - duration: 10000, - dismiss: () => { - window.location.reload() - }, - btn: 'Cancel', - action: () => { + if (this._swUpdate.isEnabled && environment.production) { + this._swUpdate.versionUpdates.subscribe((evt) => { + console.log('versionUpdates', evt); + switch (evt.type) { + case 'VERSION_READY': + this._swUpdate.activateUpdate().then(() => { this._notifications.add({ - text: "Restart canceled.", - btn: "Hide" - }); - } - }) - }); - } - }) + text: "New version available. DiunaBI will restart in 10 seconds.", + duration: 10000, + dismiss: () => { + window.location.reload() + }, + btn: 'Cancel', + action: () => { + this._notifications.add({ + text: "Restart canceled.", + btn: "Hide" + }); + } + }) + }); + break; + } + }); + } } }