mirror of
https://github.com/bitwarden/desktop.git
synced 2024-11-28 12:35:40 +01:00
Apply save changes prompt to groupings
This commit is contained in:
parent
68bc1ebbff
commit
9e8873e5c7
@ -7,6 +7,11 @@ import { UserService } from 'jslib/abstractions/user.service';
|
|||||||
|
|
||||||
import { GroupingsComponent as BaseGroupingsComponent } from 'jslib/angular/components/groupings.component';
|
import { GroupingsComponent as BaseGroupingsComponent } from 'jslib/angular/components/groupings.component';
|
||||||
|
|
||||||
|
import { CipherType } from 'jslib/enums/cipherType';
|
||||||
|
|
||||||
|
import { CollectionView } from 'jslib/models/view/collectionView';
|
||||||
|
import { FolderView } from 'jslib/models/view/folderView';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-vault-groupings',
|
selector: 'app-vault-groupings',
|
||||||
templateUrl: 'groupings.component.html',
|
templateUrl: 'groupings.component.html',
|
||||||
@ -16,4 +21,24 @@ export class GroupingsComponent extends BaseGroupingsComponent {
|
|||||||
storageService: StorageService, userService: UserService) {
|
storageService: StorageService, userService: UserService) {
|
||||||
super(collectionService, folderService, storageService, userService);
|
super(collectionService, folderService, storageService, userService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectAll() {
|
||||||
|
this.onAllClicked.emit();
|
||||||
|
}
|
||||||
|
|
||||||
|
selectFavorites() {
|
||||||
|
this.onFavoritesClicked.emit();
|
||||||
|
}
|
||||||
|
|
||||||
|
selectType(type: CipherType) {
|
||||||
|
this.onCipherTypeClicked.emit(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectFolder(folder: FolderView) {
|
||||||
|
this.onFolderClicked.emit(folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectCollection(collection: CollectionView) {
|
||||||
|
this.onCollectionClicked.emit(collection);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -484,6 +484,21 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async clearGroupingFilters() {
|
async clearGroupingFilters() {
|
||||||
|
if (this.groupingsComponent.selectedAll) {
|
||||||
|
return;
|
||||||
|
} else if (this.dirtyInput() && await this.wantsToSaveChanges()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.groupingsComponent != null) {
|
||||||
|
this.groupingsComponent.clearSelections();
|
||||||
|
this.groupingsComponent.selectedAll = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.action === 'add' || this.action === 'edit' || this.action === 'clone') {
|
||||||
|
this.cancelledAddEdit(this.addEditComponent.cipher);
|
||||||
|
}
|
||||||
|
|
||||||
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchVault');
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchVault');
|
||||||
await this.ciphersComponent.reload();
|
await this.ciphersComponent.reload();
|
||||||
this.clearFilters();
|
this.clearFilters();
|
||||||
@ -491,6 +506,21 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async filterFavorites() {
|
async filterFavorites() {
|
||||||
|
if (this.groupingsComponent.selectedFavorites) {
|
||||||
|
return;
|
||||||
|
} else if (this.dirtyInput() && await this.wantsToSaveChanges()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.groupingsComponent != null) {
|
||||||
|
this.groupingsComponent.clearSelections();
|
||||||
|
this.groupingsComponent.selectedFavorites = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.action === 'add' || this.action === 'edit' || this.action === 'clone') {
|
||||||
|
this.cancelledAddEdit(this.addEditComponent.cipher);
|
||||||
|
}
|
||||||
|
|
||||||
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchFavorites');
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchFavorites');
|
||||||
await this.ciphersComponent.reload((c) => c.favorite);
|
await this.ciphersComponent.reload((c) => c.favorite);
|
||||||
this.clearFilters();
|
this.clearFilters();
|
||||||
@ -499,6 +529,21 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async filterCipherType(type: CipherType) {
|
async filterCipherType(type: CipherType) {
|
||||||
|
if (this.groupingsComponent.selectedType === type) {
|
||||||
|
return;
|
||||||
|
} else if (this.dirtyInput() && await this.wantsToSaveChanges()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.groupingsComponent != null) {
|
||||||
|
this.groupingsComponent.clearSelections();
|
||||||
|
this.groupingsComponent.selectedType = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.action === 'add' || this.action === 'edit' || this.action === 'clone') {
|
||||||
|
this.cancelledAddEdit(this.addEditComponent.cipher);
|
||||||
|
}
|
||||||
|
|
||||||
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchType');
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchType');
|
||||||
await this.ciphersComponent.reload((c) => c.type === type);
|
await this.ciphersComponent.reload((c) => c.type === type);
|
||||||
this.clearFilters();
|
this.clearFilters();
|
||||||
@ -507,6 +552,22 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async filterFolder(folderId: string) {
|
async filterFolder(folderId: string) {
|
||||||
|
if (this.groupingsComponent.selectedFolderId === folderId) {
|
||||||
|
return;
|
||||||
|
} else if (this.dirtyInput() && await this.wantsToSaveChanges()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.groupingsComponent != null) {
|
||||||
|
this.groupingsComponent.clearSelections();
|
||||||
|
this.groupingsComponent.selectedFolder = true;
|
||||||
|
this.groupingsComponent.selectedFolderId = folderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.action === 'add' || this.action === 'edit' || this.action === 'clone') {
|
||||||
|
this.cancelledAddEdit(this.addEditComponent.cipher);
|
||||||
|
}
|
||||||
|
|
||||||
folderId = folderId === 'none' ? null : folderId;
|
folderId = folderId === 'none' ? null : folderId;
|
||||||
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchFolder');
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchFolder');
|
||||||
await this.ciphersComponent.reload((c) => c.folderId === folderId);
|
await this.ciphersComponent.reload((c) => c.folderId === folderId);
|
||||||
@ -516,6 +577,21 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async filterCollection(collectionId: string) {
|
async filterCollection(collectionId: string) {
|
||||||
|
if (this.groupingsComponent.selectedCollectionId === collectionId) {
|
||||||
|
return;
|
||||||
|
} else if (this.dirtyInput() && await this.wantsToSaveChanges()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.groupingsComponent != null) {
|
||||||
|
this.groupingsComponent.clearSelections();
|
||||||
|
this.groupingsComponent.selectedCollectionId = collectionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.action === 'add' || this.action === 'edit' || this.action === 'clone') {
|
||||||
|
this.cancelledAddEdit(this.addEditComponent.cipher);
|
||||||
|
}
|
||||||
|
|
||||||
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchCollection');
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchCollection');
|
||||||
await this.ciphersComponent.reload((c) => c.collectionIds != null &&
|
await this.ciphersComponent.reload((c) => c.collectionIds != null &&
|
||||||
c.collectionIds.indexOf(collectionId) > -1);
|
c.collectionIds.indexOf(collectionId) > -1);
|
||||||
@ -526,6 +602,14 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async openPasswordGenerator(showSelect: boolean) {
|
async openPasswordGenerator(showSelect: boolean) {
|
||||||
|
if (this.dirtyInput() && await this.wantsToSaveChanges()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.action === 'add' || this.action === 'edit' || this.action === 'clone') {
|
||||||
|
this.cancelledAddEdit(this.addEditComponent.cipher);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.modal != null) {
|
if (this.modal != null) {
|
||||||
this.modal.close();
|
this.modal.close();
|
||||||
}
|
}
|
||||||
@ -549,6 +633,14 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async openExportVault() {
|
async openExportVault() {
|
||||||
|
if (this.dirtyInput() && await this.wantsToSaveChanges()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.action === 'add' || this.action === 'edit' || this.action === 'clone') {
|
||||||
|
this.cancelledAddEdit(this.addEditComponent.cipher);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.modal != null) {
|
if (this.modal != null) {
|
||||||
this.modal.close();
|
this.modal.close();
|
||||||
}
|
}
|
||||||
@ -567,6 +659,14 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async addFolder() {
|
async addFolder() {
|
||||||
|
if (this.dirtyInput() && await this.wantsToSaveChanges()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.action === 'add' || this.action === 'edit' || this.action === 'clone') {
|
||||||
|
this.cancelledAddEdit(this.addEditComponent.cipher);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.modal != null) {
|
if (this.modal != null) {
|
||||||
this.modal.close();
|
this.modal.close();
|
||||||
}
|
}
|
||||||
@ -587,6 +687,14 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async editFolder(folderId: string) {
|
async editFolder(folderId: string) {
|
||||||
|
if (this.dirtyInput() && await this.wantsToSaveChanges()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.action === 'add' || this.action === 'edit' || this.action === 'clone') {
|
||||||
|
this.cancelledAddEdit(this.addEditComponent.cipher);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.modal != null) {
|
if (this.modal != null) {
|
||||||
this.modal.close();
|
this.modal.close();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user