From c385efdbd2f38149132ab1251c4f02bb088ac200 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Tue, 21 Sep 2021 10:48:17 +1000 Subject: [PATCH] Move custom fields to separate components (#1076) * Move custom fields to own component * Update jslib * Fix import statements * Fix linting --- src/app/app.module.ts | 4 ++ .../add-edit-custom-fields.component.html | 52 ++++++++++++++++++ .../vault/add-edit-custom-fields.component.ts | 18 +++++++ src/app/vault/add-edit.component.html | 53 +------------------ .../vault/view-custom-fields.component.html | 38 +++++++++++++ src/app/vault/view-custom-fields.component.ts | 19 +++++++ src/app/vault/view.component.html | 41 ++------------ 7 files changed, 135 insertions(+), 90 deletions(-) create mode 100644 src/app/vault/add-edit-custom-fields.component.html create mode 100644 src/app/vault/add-edit-custom-fields.component.ts create mode 100644 src/app/vault/view-custom-fields.component.html create mode 100644 src/app/vault/view-custom-fields.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 1895d07f64..641333f183 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -49,6 +49,7 @@ import { ColorPasswordPipe } from 'jslib-angular/pipes/color-password.pipe'; import { I18nPipe } from 'jslib-angular/pipes/i18n.pipe'; import { SearchCiphersPipe } from 'jslib-angular/pipes/search-ciphers.pipe'; +import { AddEditCustomFieldsComponent } from './vault/add-edit-custom-fields.component'; import { AddEditComponent } from './vault/add-edit.component'; import { AttachmentsComponent } from './vault/attachments.component'; import { CiphersComponent } from './vault/ciphers.component'; @@ -61,6 +62,7 @@ import { PasswordGeneratorComponent } from './vault/password-generator.component import { PasswordHistoryComponent } from './vault/password-history.component'; import { ShareComponent } from './vault/share.component'; import { VaultComponent } from './vault/vault.component'; +import { ViewCustomFieldsComponent } from './vault/view-custom-fields.component'; import { ViewComponent } from './vault/view.component'; import { AddEditComponent as SendAddEditComponent } from './send/add-edit.component'; @@ -226,6 +228,8 @@ registerLocaleData(localeZhTw, 'zh-TW'); PasswordRepromptComponent, SetPinComponent, VaultTimeoutInputComponent, + AddEditCustomFieldsComponent, + ViewCustomFieldsComponent, ], providers: [DatePipe], bootstrap: [AppComponent], diff --git a/src/app/vault/add-edit-custom-fields.component.html b/src/app/vault/add-edit-custom-fields.component.html new file mode 100644 index 0000000000..fc519f4794 --- /dev/null +++ b/src/app/vault/add-edit-custom-fields.component.html @@ -0,0 +1,52 @@ +
+
+ {{'customFields' | i18n}} +
+
+
+
+ + + + + +
+ + + +
+ +
+ + + +
+
+ +
+
+
+
+ + {{'newCustomField' | i18n}} + + + +
+
+
diff --git a/src/app/vault/add-edit-custom-fields.component.ts b/src/app/vault/add-edit-custom-fields.component.ts new file mode 100644 index 0000000000..ff0d983476 --- /dev/null +++ b/src/app/vault/add-edit-custom-fields.component.ts @@ -0,0 +1,18 @@ +import { Component } from '@angular/core'; + +import { + AddEditCustomFieldsComponent as BaseAddEditCustomFieldsComponent +} from 'jslib-angular/components/add-edit-custom-fields.component'; + +import { EventService } from 'jslib-common/abstractions/event.service'; +import { I18nService } from 'jslib-common/abstractions/i18n.service'; + +@Component({ + selector: 'app-vault-add-edit-custom-fields', + templateUrl: 'add-edit-custom-fields.component.html', +}) +export class AddEditCustomFieldsComponent extends BaseAddEditCustomFieldsComponent { + constructor(i18nService: I18nService, eventService: EventService) { + super(i18nService, eventService); + } +} diff --git a/src/app/vault/add-edit.component.html b/src/app/vault/add-edit.component.html index cd026986e7..d7f4ecec45 100644 --- a/src/app/vault/add-edit.component.html +++ b/src/app/vault/add-edit.component.html @@ -281,58 +281,7 @@ -
-
- {{'customFields' | i18n}} -
-
-
-
- - - - - -
- - - -
- -
- - - -
-
- -
-
-
-
- - {{'newCustomField' | i18n}} - - - -
-
-
+
{{'ownership' | i18n}} diff --git a/src/app/vault/view-custom-fields.component.html b/src/app/vault/view-custom-fields.component.html new file mode 100644 index 0000000000..0649434305 --- /dev/null +++ b/src/app/vault/view-custom-fields.component.html @@ -0,0 +1,38 @@ +
+
+ {{'customFields' | i18n}} +
+
+
+
+ {{field.name}} +
+ {{field.value || ' '}} +
+
+ {{field.value}} + {{field.maskedValue}} +
+
+ + + {{field.value}} +
+
+ +
+
+
diff --git a/src/app/vault/view-custom-fields.component.ts b/src/app/vault/view-custom-fields.component.ts new file mode 100644 index 0000000000..916a1df2eb --- /dev/null +++ b/src/app/vault/view-custom-fields.component.ts @@ -0,0 +1,19 @@ +import { + Component, +} from '@angular/core'; + +import { EventService } from 'jslib-common/abstractions/event.service'; + +import { + ViewCustomFieldsComponent as BaseViewCustomFieldsComponent +} from 'jslib-angular/components/view-custom-fields.component'; + +@Component({ + selector: 'app-vault-view-custom-fields', + templateUrl: 'view-custom-fields.component.html', +}) +export class ViewCustomFieldsComponent extends BaseViewCustomFieldsComponent { + constructor(eventService: EventService) { + super(eventService); + } +} diff --git a/src/app/vault/view.component.html b/src/app/vault/view.component.html index 4a94f68f35..e659f80053 100644 --- a/src/app/vault/view.component.html +++ b/src/app/vault/view.component.html @@ -204,44 +204,9 @@
{{cipher.notes}}
-
-
- {{'customFields' | i18n}} -
-
-
-
- {{field.name}} -
- {{field.value || ' '}} -
-
- {{field.value}} - {{field.maskedValue}} -
-
- - - {{field.value}} -
-
- -
-
-
+ +
{{'attachments' | i18n}}