mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +00:00
[PS-1341] Add folder to item view (#3347)
* Initial - add folder id to popup item view * Add folder service to view component * Move folder info higher in the item view as proper box * Add folder name handling to component * Add folder field to browser view * Add folder field to desktop view * Make folder field draggable following the merging of https://github.com/bitwarden/clients/pull/3321 also make the folder field draggable * Use `<label>` and readonly `<input>` In anticipation of https://github.com/bitwarden/clients/pull/3485 being merged * Changes from review - change input name to `folderName`, match it in the `for` attribute on the `<label>` - add an `if` check before querying folder names * Match `name` to `id` Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
@@ -475,6 +475,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="box" *ngIf="cipher.folderId">
|
||||||
|
<div class="box-content">
|
||||||
|
<div class="box-content-row">
|
||||||
|
<label
|
||||||
|
for="folderName"
|
||||||
|
class="draggable"
|
||||||
|
draggable="true"
|
||||||
|
(dragstart)="setTextDataOnDrag($event, folder.name)"
|
||||||
|
>{{ "folder" | i18n }}</label
|
||||||
|
>
|
||||||
|
<input id="folderName" type="text" name="folderName" [value]="folder.name" readonly />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="box" *ngIf="cipher.notes">
|
<div class="box" *ngIf="cipher.notes">
|
||||||
<h2 class="box-header">
|
<h2 class="box-header">
|
||||||
<label
|
<label
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
|||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
||||||
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
||||||
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
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 { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
@@ -43,6 +44,7 @@ export class ViewComponent extends BaseViewComponent {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
cipherService: CipherService,
|
cipherService: CipherService,
|
||||||
|
folderService: FolderService,
|
||||||
totpService: TotpService,
|
totpService: TotpService,
|
||||||
tokenService: TokenService,
|
tokenService: TokenService,
|
||||||
i18nService: I18nService,
|
i18nService: I18nService,
|
||||||
@@ -67,6 +69,7 @@ export class ViewComponent extends BaseViewComponent {
|
|||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
cipherService,
|
cipherService,
|
||||||
|
folderService,
|
||||||
totpService,
|
totpService,
|
||||||
tokenService,
|
tokenService,
|
||||||
i18nService,
|
i18nService,
|
||||||
|
|||||||
@@ -422,6 +422,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="box" *ngIf="cipher.folderId">
|
||||||
|
<div class="box-content">
|
||||||
|
<div class="box-content-row">
|
||||||
|
<label
|
||||||
|
for="folderName"
|
||||||
|
class="draggable"
|
||||||
|
draggable="true"
|
||||||
|
(dragstart)="setTextDataOnDrag($event, folder.name)"
|
||||||
|
>{{ "folder" | i18n }}</label
|
||||||
|
>
|
||||||
|
<input id="folderName" type="text" name="folderName" [value]="folder.name" readonly />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="box" *ngIf="cipher.notes">
|
<div class="box" *ngIf="cipher.notes">
|
||||||
<h2 class="box-header">
|
<h2 class="box-header">
|
||||||
<span
|
<span
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
|||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
||||||
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
||||||
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
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 { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
@@ -36,6 +37,7 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
cipherService: CipherService,
|
cipherService: CipherService,
|
||||||
|
folderService: FolderService,
|
||||||
totpService: TotpService,
|
totpService: TotpService,
|
||||||
tokenService: TokenService,
|
tokenService: TokenService,
|
||||||
i18nService: I18nService,
|
i18nService: I18nService,
|
||||||
@@ -55,6 +57,7 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
|
|||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
cipherService,
|
cipherService,
|
||||||
|
folderService,
|
||||||
totpService,
|
totpService,
|
||||||
tokenService,
|
tokenService,
|
||||||
i18nService,
|
i18nService,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
OnInit,
|
OnInit,
|
||||||
Output,
|
Output,
|
||||||
} from "@angular/core";
|
} from "@angular/core";
|
||||||
|
import { firstValueFrom } from "rxjs";
|
||||||
|
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||||
@@ -16,6 +17,7 @@ import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
|||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
||||||
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
||||||
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
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 { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
||||||
@@ -31,6 +33,7 @@ import { EncArrayBuffer } from "@bitwarden/common/models/domain/enc-array-buffer
|
|||||||
import { ErrorResponse } from "@bitwarden/common/models/response/error.response";
|
import { ErrorResponse } from "@bitwarden/common/models/response/error.response";
|
||||||
import { AttachmentView } from "@bitwarden/common/models/view/attachment.view";
|
import { AttachmentView } from "@bitwarden/common/models/view/attachment.view";
|
||||||
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
||||||
|
import { FolderView } from "@bitwarden/common/models/view/folder.view";
|
||||||
import { LoginUriView } from "@bitwarden/common/models/view/login-uri.view";
|
import { LoginUriView } from "@bitwarden/common/models/view/login-uri.view";
|
||||||
|
|
||||||
const BroadcasterSubscriptionId = "ViewComponent";
|
const BroadcasterSubscriptionId = "ViewComponent";
|
||||||
@@ -58,6 +61,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
totpLow: boolean;
|
totpLow: boolean;
|
||||||
fieldType = FieldType;
|
fieldType = FieldType;
|
||||||
checkPasswordPromise: Promise<number>;
|
checkPasswordPromise: Promise<number>;
|
||||||
|
folder: FolderView;
|
||||||
|
|
||||||
private totpInterval: any;
|
private totpInterval: any;
|
||||||
private previousCipherId: string;
|
private previousCipherId: string;
|
||||||
@@ -65,6 +69,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected cipherService: CipherService,
|
protected cipherService: CipherService,
|
||||||
|
protected folderService: FolderService,
|
||||||
protected totpService: TotpService,
|
protected totpService: TotpService,
|
||||||
protected tokenService: TokenService,
|
protected tokenService: TokenService,
|
||||||
protected i18nService: I18nService,
|
protected i18nService: I18nService,
|
||||||
@@ -112,6 +117,12 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
this.showPremiumRequiredTotp =
|
this.showPremiumRequiredTotp =
|
||||||
this.cipher.login.totp && !this.canAccessPremium && !this.cipher.organizationUseTotp;
|
this.cipher.login.totp && !this.canAccessPremium && !this.cipher.organizationUseTotp;
|
||||||
|
|
||||||
|
if (this.cipher.folderId) {
|
||||||
|
this.folder = await (
|
||||||
|
await firstValueFrom(this.folderService.folderViews$)
|
||||||
|
).find((f) => f.id == this.cipher.folderId);
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.cipher.type === CipherType.Login &&
|
this.cipher.type === CipherType.Login &&
|
||||||
this.cipher.login.totp &&
|
this.cipher.login.totp &&
|
||||||
|
|||||||
Reference in New Issue
Block a user