syncing from menu and vault reload
This commit is contained in:
parent
16545d9be7
commit
ac647f3184
|
@ -61,9 +61,6 @@ export class AppComponent implements OnInit {
|
||||||
case 'logout':
|
case 'logout':
|
||||||
this.logOut(message.expired);
|
this.logOut(message.expired);
|
||||||
break;
|
break;
|
||||||
case 'doneLoggingOut':
|
|
||||||
this.doneLoggingOut(message.expired);
|
|
||||||
break;
|
|
||||||
case 'locked':
|
case 'locked':
|
||||||
break;
|
break;
|
||||||
case 'unlocked':
|
case 'unlocked':
|
||||||
|
@ -92,10 +89,6 @@ export class AppComponent implements OnInit {
|
||||||
this.passwordGenerationService.clear(),
|
this.passwordGenerationService.clear(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this.doneLoggingOut(expired);
|
|
||||||
}
|
|
||||||
|
|
||||||
private doneLoggingOut(expired: boolean) {
|
|
||||||
this.authService.logOut(() => {
|
this.authService.logOut(() => {
|
||||||
this.analytics.eventTrack.next({ action: 'Logged Out' });
|
this.analytics.eventTrack.next({ action: 'Logged Out' });
|
||||||
if (expired) {
|
if (expired) {
|
||||||
|
|
|
@ -15,6 +15,9 @@ import {
|
||||||
Router,
|
Router,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
|
|
||||||
|
import { ToasterService } from 'angular2-toaster';
|
||||||
|
import { Angulartics2 } from 'angulartics2';
|
||||||
|
|
||||||
import { ModalComponent } from '../modal.component';
|
import { ModalComponent } from '../modal.component';
|
||||||
|
|
||||||
import { BroadcasterService } from '../services/broadcaster.service';
|
import { BroadcasterService } from '../services/broadcaster.service';
|
||||||
|
@ -60,7 +63,8 @@ export class VaultComponent implements OnInit {
|
||||||
constructor(private route: ActivatedRoute, private router: Router, private location: Location,
|
constructor(private route: ActivatedRoute, private router: Router, private location: Location,
|
||||||
private componentFactoryResolver: ComponentFactoryResolver, private i18nService: I18nService,
|
private componentFactoryResolver: ComponentFactoryResolver, private i18nService: I18nService,
|
||||||
private broadcasterService: BroadcasterService, private changeDetectorRef: ChangeDetectorRef,
|
private broadcasterService: BroadcasterService, private changeDetectorRef: ChangeDetectorRef,
|
||||||
private ngZone: NgZone, private syncService: SyncService) {
|
private ngZone: NgZone, private syncService: SyncService, private analytics: Angulartics2,
|
||||||
|
private toasterService: ToasterService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
@ -91,6 +95,18 @@ export class VaultComponent implements OnInit {
|
||||||
case 'openPasswordGenerator':
|
case 'openPasswordGenerator':
|
||||||
await this.openPasswordGenerator(false);
|
await this.openPasswordGenerator(false);
|
||||||
break;
|
break;
|
||||||
|
case 'syncVault':
|
||||||
|
try {
|
||||||
|
await this.syncService.fullSync(true);
|
||||||
|
this.toasterService.popAsync('success', null, this.i18nService.t('syncingComplete'));
|
||||||
|
this.analytics.eventTrack.next({ action: 'Synced Full' });
|
||||||
|
} catch {
|
||||||
|
this.toasterService.popAsync('error', null, this.i18nService.t('syncingFailed'));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'syncCompleted':
|
||||||
|
await this.load();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
detectChanges = false;
|
detectChanges = false;
|
||||||
break;
|
break;
|
||||||
|
@ -102,16 +118,13 @@ export class VaultComponent implements OnInit {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
while (this.syncService.syncInProgress) {
|
if (!this.syncService.syncInProgress) {
|
||||||
await new Promise((resolve) => setTimeout(resolve, 200));
|
await this.load();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async load() {
|
||||||
this.route.queryParams.subscribe(async (params) => {
|
this.route.queryParams.subscribe(async (params) => {
|
||||||
await this.load(params);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async load(params?: { [key: string]: any }) {
|
|
||||||
await this.groupingsComponent.load();
|
await this.groupingsComponent.load();
|
||||||
|
|
||||||
if (params == null) {
|
if (params == null) {
|
||||||
|
@ -150,6 +163,7 @@ export class VaultComponent implements OnInit {
|
||||||
this.groupingsComponent.selectedAll = true;
|
this.groupingsComponent.selectedAll = true;
|
||||||
await this.ciphersComponent.load();
|
await this.ciphersComponent.load();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
viewCipher(cipher: CipherView) {
|
viewCipher(cipher: CipherView) {
|
||||||
|
|
|
@ -664,13 +664,19 @@
|
||||||
"changeEmailConfirmation": {
|
"changeEmailConfirmation": {
|
||||||
"message": "You can change your email address on the bitwarden.com web vault. Do you want to visit the website now?"
|
"message": "You can change your email address on the bitwarden.com web vault. Do you want to visit the website now?"
|
||||||
},
|
},
|
||||||
"webVault": {
|
"goToWebVault": {
|
||||||
"message": "Web Vault"
|
"message": "Go To Web Vault"
|
||||||
},
|
},
|
||||||
"getMobileApp": {
|
"getMobileApp": {
|
||||||
"message": "Get Mobile App"
|
"message": "Get Mobile App"
|
||||||
},
|
},
|
||||||
"getBrowserExtension": {
|
"getBrowserExtension": {
|
||||||
"message": "Get Browser Extension"
|
"message": "Get Browser Extension"
|
||||||
|
},
|
||||||
|
"syncingComplete": {
|
||||||
|
"message": "Syncing complete"
|
||||||
|
},
|
||||||
|
"syncingFailed": {
|
||||||
|
"message": "Syncing failed"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,7 +259,7 @@ export class MenuMain {
|
||||||
},
|
},
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{
|
{
|
||||||
label: this.i18nService.t('webVault'),
|
label: this.i18nService.t('goToWebVault'),
|
||||||
click() {
|
click() {
|
||||||
shell.openExternal('https://vault.bitwarden.com');
|
shell.openExternal('https://vault.bitwarden.com');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue