[PS-2120] Forcing vault to refresh when the vault is purged or new items are imported (#4380)
* [PS-2120] Forcing vault to refresh when the vault is purged or new items are imported * [PS-2120] Forcing vault refresh by calling fullSync with force as true
This commit is contained in:
parent
44851fe231
commit
51ead2e7da
|
@ -8,6 +8,7 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
|
import { SyncService } from "@bitwarden/common/abstractions/sync/sync.service.abstraction";
|
||||||
|
|
||||||
import { ImportComponent } from "../../../tools/import-export/import.component";
|
import { ImportComponent } from "../../../tools/import-export/import.component";
|
||||||
|
|
||||||
|
@ -28,7 +29,8 @@ export class OrganizationImportComponent extends ImportComponent {
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
private organizationService: OrganizationService,
|
private organizationService: OrganizationService,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
modalService: ModalService
|
modalService: ModalService,
|
||||||
|
syncService: SyncService
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
i18nService,
|
i18nService,
|
||||||
|
@ -37,7 +39,8 @@ export class OrganizationImportComponent extends ImportComponent {
|
||||||
platformUtilsService,
|
platformUtilsService,
|
||||||
policyService,
|
policyService,
|
||||||
logService,
|
logService,
|
||||||
modalService
|
modalService,
|
||||||
|
syncService
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
|
import { SyncService } from "@bitwarden/common/abstractions/sync/sync.service.abstraction";
|
||||||
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification/userVerification.service.abstraction";
|
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification/userVerification.service.abstraction";
|
||||||
import { Verification } from "@bitwarden/common/types/verification";
|
import { Verification } from "@bitwarden/common/types/verification";
|
||||||
|
|
||||||
|
@ -24,7 +25,8 @@ export class PurgeVaultComponent {
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private userVerificationService: UserVerificationService,
|
private userVerificationService: UserVerificationService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private logService: LogService
|
private logService: LogService,
|
||||||
|
private syncService: SyncService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
|
@ -34,6 +36,7 @@ export class PurgeVaultComponent {
|
||||||
.then((request) => this.apiService.postPurgeCiphers(request, this.organizationId));
|
.then((request) => this.apiService.postPurgeCiphers(request, this.organizationId));
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("vaultPurged"));
|
this.platformUtilsService.showToast("success", null, this.i18nService.t("vaultPurged"));
|
||||||
|
this.syncService.fullSync(true);
|
||||||
if (this.organizationId != null) {
|
if (this.organizationId != null) {
|
||||||
this.router.navigate(["organizations", this.organizationId, "vault"]);
|
this.router.navigate(["organizations", this.organizationId, "vault"]);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { ImportService } from "@bitwarden/common/abstractions/import.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
|
import { SyncService } from "@bitwarden/common/abstractions/sync/sync.service.abstraction";
|
||||||
import { ImportOption, ImportType } from "@bitwarden/common/enums/importOptions";
|
import { ImportOption, ImportType } from "@bitwarden/common/enums/importOptions";
|
||||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
import { ImportError } from "@bitwarden/common/importers/import-error";
|
import { ImportError } from "@bitwarden/common/importers/import-error";
|
||||||
|
@ -40,7 +41,8 @@ export class ImportComponent implements OnInit {
|
||||||
protected platformUtilsService: PlatformUtilsService,
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
protected policyService: PolicyService,
|
protected policyService: PolicyService,
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
protected modalService: ModalService
|
protected modalService: ModalService,
|
||||||
|
protected syncService: SyncService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
@ -133,6 +135,7 @@ export class ImportComponent implements OnInit {
|
||||||
|
|
||||||
//No errors, display success message
|
//No errors, display success message
|
||||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("importSuccess"));
|
this.platformUtilsService.showToast("success", null, this.i18nService.t("importSuccess"));
|
||||||
|
this.syncService.fullSync(true);
|
||||||
this.router.navigate(this.successNavigate);
|
this.router.navigate(this.successNavigate);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logService.error(e);
|
this.logService.error(e);
|
||||||
|
|
Loading…
Reference in New Issue