1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-09 05:57:40 +02:00
bitwarden-browser/apps/web/src/app/vault/bulk-move.component.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.4 KiB
TypeScript
Raw Normal View History

2018-06-12 23:33:08 +02:00
import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core";
2022-06-14 17:10:53 +02:00
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
import { FolderService } from "@bitwarden/common/abstractions/folder.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { FolderView } from "@bitwarden/common/models/view/folderView";
2018-06-12 23:33:08 +02:00
@Component({
selector: "app-vault-bulk-move",
templateUrl: "bulk-move.component.html",
})
export class BulkMoveComponent implements OnInit {
@Input() cipherIds: string[] = [];
@Output() onMoved = new EventEmitter();
folderId: string = null;
folders: FolderView[] = [];
formPromise: Promise<any>;
2021-12-07 20:41:45 +01:00
constructor(
private cipherService: CipherService,
private platformUtilsService: PlatformUtilsService,
private i18nService: I18nService,
private folderService: FolderService
) {}
2018-06-12 23:33:08 +02:00
async ngOnInit() {
this.folders = await this.folderService.getAllDecrypted();
this.folderId = this.folders[0].id;
}
async submit() {
this.formPromise = this.cipherService.moveManyWithServer(this.cipherIds, this.folderId);
await this.formPromise;
this.onMoved.emit();
2021-12-07 20:41:45 +01:00
this.platformUtilsService.showToast("success", null, this.i18nService.t("movedItems"));
2018-06-12 23:33:08 +02:00
}
}