From b737c70712ba7054e492b0441a822a2d032a44e4 Mon Sep 17 00:00:00 2001 From: Robyn MacCallum Date: Thu, 6 Jul 2023 09:58:12 -0400 Subject: [PATCH] [PM-2067] Update Folder Add-Edit modal to use the Component Library (#5648) * Add formGroup to base FolderAddEditComponent * [web] use DialogService to open the modal * [web] migrate FolderAddEditComponent use component library * [desktop] use the formGroup in the template * [browser] use the formGroup in the template * [browser & desktop] remove disable on form invalid * [web] Migrate to async actions * [web] Strengthen typing for FolderAddEdit dialog * Show form error instead of error toast * Move browser folder add edit component to vault * Remove extra template variables * Remove inner form * Remove inner form * Update apps/web/src/app/vault/individual-vault/folder-add-edit.component.html Co-authored-by: Oscar Hinton --------- Co-authored-by: Oscar Hinton --- apps/browser/src/popup/app-routing.module.ts | 2 +- apps/browser/src/popup/app.module.ts | 2 +- .../settings/folder-add-edit.component.html | 10 +- .../settings/folder-add-edit.component.ts | 7 +- .../app/vault/folder-add-edit.component.html | 16 ++-- .../app/vault/folder-add-edit.component.ts | 7 +- .../folder-add-edit.component.html | 94 ++++++------------- .../folder-add-edit.component.ts | 87 ++++++++++++++++- .../vault/individual-vault/vault.component.ts | 49 ++++------ .../components/folder-add-edit.component.ts | 12 ++- 10 files changed, 161 insertions(+), 125 deletions(-) rename apps/browser/src/{ => vault}/popup/settings/folder-add-edit.component.html (86%) rename apps/browser/src/{ => vault}/popup/settings/folder-add-edit.component.ts (93%) diff --git a/apps/browser/src/popup/app-routing.module.ts b/apps/browser/src/popup/app-routing.module.ts index 2fd71557f5..7da3d3049f 100644 --- a/apps/browser/src/popup/app-routing.module.ts +++ b/apps/browser/src/popup/app-routing.module.ts @@ -33,11 +33,11 @@ import { ShareComponent } from "../vault/popup/components/vault/share.component" import { VaultFilterComponent } from "../vault/popup/components/vault/vault-filter.component"; import { VaultItemsComponent } from "../vault/popup/components/vault/vault-items.component"; import { ViewComponent } from "../vault/popup/components/vault/view.component"; +import { FolderAddEditComponent } from "../vault/popup/settings/folder-add-edit.component"; import { DebounceNavigationService } from "./services/debounceNavigationService"; import { AutofillComponent } from "./settings/autofill.component"; import { ExcludedDomainsComponent } from "./settings/excluded-domains.component"; -import { FolderAddEditComponent } from "./settings/folder-add-edit.component"; import { FoldersComponent } from "./settings/folders.component"; import { HelpAndFeedbackComponent } from "./settings/help-and-feedback.component"; import { OptionsComponent } from "./settings/options.component"; diff --git a/apps/browser/src/popup/app.module.ts b/apps/browser/src/popup/app.module.ts index d48465b0a4..3665df7dec 100644 --- a/apps/browser/src/popup/app.module.ts +++ b/apps/browser/src/popup/app.module.ts @@ -52,6 +52,7 @@ import { VaultItemsComponent } from "../vault/popup/components/vault/vault-items import { VaultSelectComponent } from "../vault/popup/components/vault/vault-select.component"; import { ViewCustomFieldsComponent } from "../vault/popup/components/vault/view-custom-fields.component"; import { ViewComponent } from "../vault/popup/components/vault/view.component"; +import { FolderAddEditComponent } from "../vault/popup/settings/folder-add-edit.component"; import { AppRoutingModule } from "./app-routing.module"; import { AppComponent } from "./app.component"; @@ -63,7 +64,6 @@ import { ServicesModule } from "./services/services.module"; import { AboutComponent } from "./settings/about.component"; import { AutofillComponent } from "./settings/autofill.component"; import { ExcludedDomainsComponent } from "./settings/excluded-domains.component"; -import { FolderAddEditComponent } from "./settings/folder-add-edit.component"; import { FoldersComponent } from "./settings/folders.component"; import { HelpAndFeedbackComponent } from "./settings/help-and-feedback.component"; import { OptionsComponent } from "./settings/options.component"; diff --git a/apps/browser/src/popup/settings/folder-add-edit.component.html b/apps/browser/src/vault/popup/settings/folder-add-edit.component.html similarity index 86% rename from apps/browser/src/popup/settings/folder-add-edit.component.html rename to apps/browser/src/vault/popup/settings/folder-add-edit.component.html index 3568a971b8..14393b83dd 100644 --- a/apps/browser/src/popup/settings/folder-add-edit.component.html +++ b/apps/browser/src/vault/popup/settings/folder-add-edit.component.html @@ -1,4 +1,4 @@ -
+
@@ -18,13 +18,7 @@
- +
diff --git a/apps/browser/src/popup/settings/folder-add-edit.component.ts b/apps/browser/src/vault/popup/settings/folder-add-edit.component.ts similarity index 93% rename from apps/browser/src/popup/settings/folder-add-edit.component.ts rename to apps/browser/src/vault/popup/settings/folder-add-edit.component.ts index 781dbff572..9acd0a7b4f 100644 --- a/apps/browser/src/popup/settings/folder-add-edit.component.ts +++ b/apps/browser/src/vault/popup/settings/folder-add-edit.component.ts @@ -1,4 +1,5 @@ import { Component } from "@angular/core"; +import { FormBuilder } from "@angular/forms"; import { ActivatedRoute, Router } from "@angular/router"; import { first } from "rxjs/operators"; @@ -24,7 +25,8 @@ export class FolderAddEditComponent extends BaseFolderAddEditComponent { private router: Router, private route: ActivatedRoute, logService: LogService, - dialogService: DialogServiceAbstraction + dialogService: DialogServiceAbstraction, + formBuilder: FormBuilder ) { super( folderService, @@ -32,7 +34,8 @@ export class FolderAddEditComponent extends BaseFolderAddEditComponent { i18nService, platformUtilsService, logService, - dialogService + dialogService, + formBuilder ); } diff --git a/apps/desktop/src/vault/app/vault/folder-add-edit.component.html b/apps/desktop/src/vault/app/vault/folder-add-edit.component.html index 4e9adec817..5a757cfeac 100644 --- a/apps/desktop/src/vault/app/vault/folder-add-edit.component.html +++ b/apps/desktop/src/vault/app/vault/folder-add-edit.component.html @@ -1,6 +1,12 @@