1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-09 21:20:27 +00:00

feat(archive): Desktop - Desktop initial work.

This commit is contained in:
Patrick Pimentel
2025-04-21 15:29:07 -04:00
parent 1fae2d5b4c
commit 67971ff860
7 changed files with 72 additions and 1 deletions

View File

@@ -443,6 +443,9 @@
"deleteAttachment": {
"message": "Delete attachment"
},
"archiveItemConfirmation": {
"message": "Do you really want to archive this item?"
},
"deleteItemConfirmation": {
"message": "Do you really want to send to the trash?"
},
@@ -1864,6 +1867,10 @@
"message": "Lock",
"description": "Verb form: to make secure or inaccessible by"
},
"archive": {
"message": "Archive",
"description": "Noun: a special folder to hold archived items"
},
"trash": {
"message": "Trash",
"description": "Noun: a special folder to hold deleted items"

View File

@@ -29,6 +29,22 @@
</button>
</span>
</li>
<li
class="filter-option"
*ngIf="!hideArchive"
[ngClass]="{ active: activeFilter.status === 'archive' }"
>
<span class="filter-buttons">
<button
type="button"
class="filter-button"
(click)="applyFilter('archive')"
[attr.aria-pressed]="activeFilter.status === 'archive'"
>
<i class="bwi bwi-fw bwi-archive" aria-hidden="true"></i>&nbsp;{{ "archive" | i18n }}
</button>
</span>
</li>
<li
class="filter-option"
*ngIf="!hideTrash"

View File

@@ -674,6 +674,11 @@
<i class="bwi bwi-files bwi-fw bwi-lg" aria-hidden="true"></i>
</button>
</ng-container>
<div class="right">
<button type="button" (click)="archive()" class="danger" [appA11yTitle]="'archive' | i18n">
<i class="bwi bwi-archive bwi-lg bwi-fw" aria-hidden="true"></i>
</button>
</div>
<div class="right" *ngIf="canDeleteCipher$ | async">
<button
type="button"

View File

@@ -37,6 +37,13 @@
route="integrations"
[relativeTo]="route.parent"
></bit-nav-item>
<!-- <bit-nav-item-->
<!-- icon="bwi-trash"-->
<!-- [text]="'archive' | i18n"-->
<!-- route="trash"-->
<!-- [relativeTo]="route.parent"-->
<!-- *ngIf="isAdmin$ | async"-->
<!-- ></bit-nav-item>-->
<bit-nav-item
icon="bwi-trash"
[text]="'trash' | i18n"

View File

@@ -212,6 +212,41 @@ export class ViewComponent implements OnDestroy, OnInit {
return false;
}
async archive(): Promise<boolean> {
if (!(await this.promptPassword())) {
return;
}
const confirmed = await this.dialogService.openSimpleDialog({
title: { key: "archiveItem" },
content: {
key: "archiveItemConfirmation",
},
type: "warning",
});
if (!confirmed) {
return false;
}
try {
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
await this.deleteCipher(activeUserId);
this.toastService.showToast({
variant: "success",
title: null,
message: this.i18nService.t(
this.cipher.isDeleted ? "permanentlyDeletedItem" : "deletedItem",
),
});
this.onDeletedCipher.emit(this.cipher);
} catch (e) {
this.logService.error(e);
}
return true;
}
async delete(): Promise<boolean> {
if (!(await this.promptPassword())) {
return;

View File

@@ -8,6 +8,7 @@ import { VaultFilter } from "../models/vault-filter.model";
@Directive()
export class StatusFilterComponent {
@Input() hideFavorites = false;
@Input() hideArchive = false;
@Input() hideTrash = false;
@Output() onFilterChange: EventEmitter<VaultFilter> = new EventEmitter<VaultFilter>();
@Input() activeFilter: VaultFilter;

View File

@@ -1 +1 @@
export type CipherStatus = "all" | "favorites" | "trash";
export type CipherStatus = "all" | "favorites" | "archive" | "trash";