From d994faa8a606c7d5c773a6cd532582c5575857ac Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Mon, 28 Nov 2022 18:59:46 +0100 Subject: [PATCH] [SM-252] Enable strict templates (#3601) --- .../accounts/set-password.component.html | 11 ++---- .../popup/accounts/two-factor.component.html | 4 +- .../popup/generator/generator.component.html | 4 +- .../popup/send/send-add-edit.component.html | 7 +++- .../settings/folder-add-edit.component.html | 7 +++- .../src/popup/settings/premium.component.html | 6 +-- .../src/popup/settings/sync.component.html | 10 +++-- .../add-edit-custom-fields.component.html | 4 +- .../src/popup/vault/add-edit.component.html | 27 +++++++------ .../popup/vault/attachments.component.html | 6 +-- .../popup/vault/collections.component.html | 2 +- .../src/popup/vault/current-tab.component.ts | 2 +- .../popup/vault/vault-select.component.html | 8 +--- .../src/popup/vault/view.component.html | 10 ++--- apps/browser/tsconfig.json | 1 + .../src/app/accounts/premium.component.html | 8 ++-- .../app/accounts/two-factor.component.html | 2 +- .../src/app/components/avatar.component.ts | 9 +---- .../layout/account-switcher.component.html | 4 +- .../src/app/send/add-edit.component.html | 10 +++-- .../src/app/send/efflux-dates.component.html | 1 - .../add-edit-custom-fields.component.html | 4 +- .../src/app/vault/add-edit.component.html | 38 +++++++++++++------ .../src/app/vault/attachments.component.html | 6 +-- .../src/app/vault/collections.component.html | 2 +- .../app/vault/folder-add-edit.component.html | 6 +-- .../src/app/vault/generator.component.html | 4 +- .../organization-filter.component.html | 1 - .../desktop/src/app/vault/view.component.html | 10 ++--- apps/desktop/tsconfig.json | 1 + .../src/app/accounts/register.component.html | 2 +- .../vertical-stepper.component.ts | 6 ++- .../app/accounts/two-factor.component.html | 2 +- .../user-verification.component.html | 0 .../components/user-verification.component.ts | 23 +++++++++++ .../organization-subscription.component.html | 10 ++--- .../access-selector.component.html | 10 +++-- .../manage/collection-add-edit.component.html | 16 ++++---- .../manage/entity-events.component.html | 6 +-- .../manage/events.component.html | 2 +- .../manage/group-add-edit.component.html | 12 +++--- .../manage/user-add-edit.component.html | 12 +++--- .../manage/user-groups.component.html | 2 +- .../policies/policies.component.ts | 2 +- .../organization-billing.component.ts | 0 .../organizations/vault/add-edit.component.ts | 2 - .../vault/vault-items.component.ts | 5 +-- .../organizations/vault/vault.component.html | 2 +- .../app/organizations/vault/vault.module.ts | 3 +- .../pages/weak-passwords-report.component.ts | 5 ++- .../report-card/report-card.component.ts | 4 +- apps/web/src/app/send/access.component.html | 2 +- apps/web/src/app/send/add-edit.component.html | 17 +++------ .../src/app/send/efflux-dates.component.html | 3 -- apps/web/src/app/send/send.component.html | 2 +- .../emergency-access-add-edit.component.html | 6 +-- .../organization-plans.component.html | 19 ---------- .../sponsoring-org-row.component.html | 4 +- .../two-factor-authenticator.component.html | 2 +- .../settings/two-factor-duo.component.html | 2 +- .../settings/two-factor-email.component.html | 4 +- .../two-factor-recovery.component.html | 7 +--- .../two-factor-webauthn.component.html | 15 ++++---- .../two-factor-yubikey.component.html | 4 +- .../settings/user-subscription.component.html | 4 +- .../app/settings/verify-email.component.html | 2 +- .../src/app/shared/loose-components.module.ts | 12 +----- .../src/app/tools/generator.component.html | 2 +- .../tools/import-export/export.component.html | 3 +- .../tools/import-export/import.component.html | 2 + .../add-edit-custom-fields.component.html | 4 +- .../web/src/app/vault/add-edit.component.html | 12 +++--- .../src/app/vault/attachments.component.html | 16 +++++--- .../src/app/vault/bulk-share.component.html | 2 +- .../src/app/vault/collections.component.html | 2 +- .../app/vault/folder-add-edit.component.html | 6 +-- .../organization-filter.component.html | 1 - .../shared/vault-filter-shared.module.ts | 9 +++++ .../vault/vault-filter/vault-filter.module.ts | 10 +---- .../src/app/vault/vault-items.component.html | 2 +- .../src/app/vault/vault-items.component.ts | 4 ++ apps/web/src/app/vault/vault.component.html | 2 +- apps/web/tsconfig.json | 1 + .../organizations/manage/scim.component.html | 4 +- .../app/organizations/manage/sso.component.ts | 10 ++--- .../providers/manage/events.component.html | 2 +- .../providers/manage/people.component.html | 11 ------ .../manage/user-add-edit.component.html | 6 +-- .../app/providers/setup/setup.component.html | 3 -- .../src/components/add-edit.component.ts | 2 + .../src/components/attachments.component.ts | 4 ++ .../components/user-verification.component.ts | 20 ++-------- .../src/components/vault-items.component.ts | 3 ++ libs/angular/src/pipes/i18n.pipe.ts | 2 +- libs/common/src/abstractions/i18n.service.ts | 2 +- libs/common/src/services/i18n.service.ts | 8 ++-- libs/components/src/badge/badge.directive.ts | 2 +- 97 files changed, 302 insertions(+), 301 deletions(-) rename {libs/angular/src => apps/web/src/app}/components/user-verification.component.html (100%) create mode 100644 apps/web/src/app/components/user-verification.component.ts delete mode 100644 apps/web/src/app/organizations/settings/organization-billing.component.ts diff --git a/apps/browser/src/popup/accounts/set-password.component.html b/apps/browser/src/popup/accounts/set-password.component.html index 517374578c..9eb551bf26 100644 --- a/apps/browser/src/popup/accounts/set-password.component.html +++ b/apps/browser/src/popup/accounts/set-password.component.html @@ -39,13 +39,10 @@
-
diff --git a/apps/desktop/src/app/vault/folder-add-edit.component.html b/apps/desktop/src/app/vault/folder-add-edit.component.html index ea7303dceb..4e9adec817 100644 --- a/apps/desktop/src/app/vault/folder-add-edit.component.html +++ b/apps/desktop/src/app/vault/folder-add-edit.component.html @@ -47,17 +47,17 @@ class="danger" appA11yTitle="{{ 'delete' | i18n }}" *ngIf="editMode" - [disabled]="deleteBtn.loading" + [disabled]="$any(deleteBtn).loading" [appApiAction]="deletePromise" > diff --git a/apps/desktop/src/app/vault/generator.component.html b/apps/desktop/src/app/vault/generator.component.html index 6111bcc3c6..bddaa7d343 100644 --- a/apps/desktop/src/app/vault/generator.component.html +++ b/apps/desktop/src/app/vault/generator.component.html @@ -52,11 +52,11 @@ appStopClick appA11yTitle="{{ 'regenerateUsername' | i18n }}" (click)="regenerate()" - [disabled]="form.loading" + [disabled]="$any(form).loading" > diff --git a/apps/desktop/src/app/vault/vault-filter/filters/organization-filter.component.html b/apps/desktop/src/app/vault/vault-filter/filters/organization-filter.component.html index 3663b69fc4..dbba1353c9 100644 --- a/apps/desktop/src/app/vault/vault-filter/filters/organization-filter.component.html +++ b/apps/desktop/src/app/vault/vault-filter/filters/organization-filter.component.html @@ -112,7 +112,6 @@ diff --git a/apps/desktop/src/app/vault/view.component.html b/apps/desktop/src/app/vault/view.component.html index 8b1b044574..5b3896f68e 100644 --- a/apps/desktop/src/app/vault/view.component.html +++ b/apps/desktop/src/app/vault/view.component.html @@ -64,16 +64,16 @@ appA11yTitle="{{ 'checkPassword' | i18n }}" (click)="checkPassword()" [appApiAction]="checkPasswordPromise" - [disabled]="checkPasswordBtn.loading" + [disabled]="$any(checkPasswordBtn).loading" > @@ -472,12 +472,12 @@ {{ attachment.sizeName }} diff --git a/apps/desktop/tsconfig.json b/apps/desktop/tsconfig.json index f2f28c7306..74b0670b3e 100644 --- a/apps/desktop/tsconfig.json +++ b/apps/desktop/tsconfig.json @@ -16,6 +16,7 @@ } }, "angularCompilerOptions": { + "strictTemplates": true, "preserveWhitespaces": true }, "include": ["src", "../../libs/common/src/services/**/*.worker.ts"] diff --git a/apps/web/src/app/accounts/register.component.html b/apps/web/src/app/accounts/register.component.html index ed492a6bb8..8a68d32b03 100644 --- a/apps/web/src/app/accounts/register.component.html +++ b/apps/web/src/app/accounts/register.component.html @@ -55,7 +55,7 @@

- Start Your Teams
Teams
Enterprise Free Trial Now

diff --git a/apps/web/src/app/accounts/trial-initiation/vertical-stepper/vertical-stepper.component.ts b/apps/web/src/app/accounts/trial-initiation/vertical-stepper/vertical-stepper.component.ts index 2c66dae7be..745bb5767f 100644 --- a/apps/web/src/app/accounts/trial-initiation/vertical-stepper/vertical-stepper.component.ts +++ b/apps/web/src/app/accounts/trial-initiation/vertical-stepper/vertical-stepper.component.ts @@ -1,5 +1,7 @@ import { CdkStepper } from "@angular/cdk/stepper"; -import { Component, Input } from "@angular/core"; +import { Component, Input, QueryList } from "@angular/core"; + +import { VerticalStep } from "./vertical-step.component"; @Component({ selector: "app-vertical-stepper", @@ -7,6 +9,8 @@ import { Component, Input } from "@angular/core"; providers: [{ provide: CdkStepper, useExisting: VerticalStepperComponent }], }) export class VerticalStepperComponent extends CdkStepper { + readonly steps: QueryList; + @Input() activeClass = "active"; diff --git a/apps/web/src/app/accounts/two-factor.component.html b/apps/web/src/app/accounts/two-factor.component.html index 835fd12e78..94066d684b 100644 --- a/apps/web/src/app/accounts/two-factor.component.html +++ b/apps/web/src/app/accounts/two-factor.component.html @@ -80,7 +80,7 @@
- +
{{ "reinstateSubscription" | i18n }} @@ -113,8 +113,8 @@ @@ -143,7 +143,7 @@ class="btn btn-outline-danger btn-submit" (click)="removeSponsorship()" [appApiAction]="removeSponsorshipPromise" - [disabled]="removeSponsorshipBtn.loading" + [disabled]="$any(removeSponsorshipBtn).loading" *ngIf="isSponsoredSubscription" > @@ -230,7 +230,7 @@ class="btn btn-outline-danger btn-submit ml-1" (click)="cancel()" [appApiAction]="cancelPromise" - [disabled]="cancelBtn.loading" + [disabled]="$any(cancelBtn).loading" *ngIf="subscription && !subscription.cancelled && !subscriptionMarkedForCancel" > diff --git a/apps/web/src/app/organizations/components/access-selector/access-selector.component.html b/apps/web/src/app/organizations/components/access-selector/access-selector.component.html index 10390b3e05..cc4d1d7fa7 100644 --- a/apps/web/src/app/organizations/components/access-selector/access-selector.component.html +++ b/apps/web/src/app/organizations/components/access-selector/access-selector.component.html @@ -53,11 +53,13 @@
{{ item.labelName }} - + {{ "invited" | i18n }}
-
{{ item.email }}
+
+ {{ $any(item).email }} +

@@ -110,11 +112,11 @@ - {{ item.role | userType: "-" }} + {{ $any(item).role | userType: "-" }} - {{ item.viaGroupName ?? "-" }} + {{ $any(item).viaGroupName ?? "-" }} diff --git a/apps/web/src/app/organizations/manage/collection-add-edit.component.html b/apps/web/src/app/organizations/manage/collection-add-edit.component.html index 97c973a419..41368d589a 100644 --- a/apps/web/src/app/organizations/manage/collection-add-edit.component.html +++ b/apps/web/src/app/organizations/manage/collection-add-edit.component.html @@ -81,7 +81,7 @@ @@ -140,17 +140,17 @@ class="btn btn-outline-danger" appA11yTitle="{{ 'delete' | i18n }}" *ngIf="editMode" - [disabled]="deleteBtn.loading" + [disabled]="$any(deleteBtn).loading" [appApiAction]="deletePromise" > diff --git a/apps/web/src/app/organizations/manage/entity-events.component.html b/apps/web/src/app/organizations/manage/entity-events.component.html index 122d0b8188..b41e6f3ba1 100644 --- a/apps/web/src/app/organizations/manage/entity-events.component.html +++ b/apps/web/src/app/organizations/manage/entity-events.component.html @@ -52,11 +52,11 @@ type="button" class="btn btn-sm btn-outline-primary ml-3" (click)="loadEvents(true)" - [disabled]="loaded && refreshBtn.loading" + [disabled]="loaded && $any(refreshBtn).loading" > {{ "refresh" | i18n }} @@ -101,7 +101,7 @@ type="button" class="btn btn-block btn-link btn-submit" (click)="loadEvents(false)" - [disabled]="loaded && moreBtn.loading" + [disabled]="loaded && $any(moreBtn).loading" *ngIf="continuationToken" > diff --git a/apps/web/src/app/organizations/manage/events.component.html b/apps/web/src/app/organizations/manage/events.component.html index a7468bcf37..e2c03f0dde 100644 --- a/apps/web/src/app/organizations/manage/events.component.html +++ b/apps/web/src/app/organizations/manage/events.component.html @@ -95,7 +95,7 @@ bitButton buttonType="primary" (click)="loadEvents(false)" - [disabled]="loaded && moreBtn.loading" + [disabled]="loaded && $any(moreBtn).loading" *ngIf="continuationToken" > @@ -132,7 +132,7 @@ type="checkbox" [(ngModel)]="c.hidePasswords" name="Collection[{{ i }}].HidePasswords" - [disabled]="!c.checked" + [disabled]="!$any(c).checked" /> @@ -140,7 +140,7 @@ type="checkbox" [(ngModel)]="c.readOnly" name="Collection[{{ i }}].ReadOnly" - [disabled]="!c.checked" + [disabled]="!$any(c).checked" /> @@ -164,17 +164,17 @@ class="btn btn-outline-danger" appA11yTitle="{{ 'delete' | i18n }}" *ngIf="editMode" - [disabled]="deleteBtn.loading" + [disabled]="$any(deleteBtn).loading" [appApiAction]="deletePromise" > diff --git a/apps/web/src/app/organizations/manage/user-add-edit.component.html b/apps/web/src/app/organizations/manage/user-add-edit.component.html index 7d15eaa22f..458d1d0bab 100644 --- a/apps/web/src/app/organizations/manage/user-add-edit.component.html +++ b/apps/web/src/app/organizations/manage/user-add-edit.component.html @@ -341,7 +341,7 @@ @@ -354,7 +354,7 @@ type="checkbox" [(ngModel)]="c.hidePasswords" name="Collection[{{ i }}].HidePasswords" - [disabled]="!c.checked" + [disabled]="!$any(c).checked" /> @@ -362,7 +362,7 @@ type="checkbox" [(ngModel)]="c.readOnly" name="Collection[{{ i }}].ReadOnly" - [disabled]="!c.checked" + [disabled]="!$any(c).checked" /> @@ -416,17 +416,17 @@ class="btn btn-outline-danger" appA11yTitle="{{ 'delete' | i18n }}" *ngIf="editMode" - [disabled]="deleteBtn.loading" + [disabled]="$any(deleteBtn).loading" [appApiAction]="deletePromise" > diff --git a/apps/web/src/app/organizations/manage/user-groups.component.html b/apps/web/src/app/organizations/manage/user-groups.component.html index 347125e982..217af6ea44 100644 --- a/apps/web/src/app/organizations/manage/user-groups.component.html +++ b/apps/web/src/app/organizations/manage/user-groups.component.html @@ -34,7 +34,7 @@ diff --git a/apps/web/src/app/organizations/policies/policies.component.ts b/apps/web/src/app/organizations/policies/policies.component.ts index 0a316f5597..717e35ac96 100644 --- a/apps/web/src/app/organizations/policies/policies.component.ts +++ b/apps/web/src/app/organizations/policies/policies.component.ts @@ -29,7 +29,7 @@ export class PoliciesComponent implements OnInit { organization: Organization; private orgPolicies: PolicyResponse[]; - private policiesEnabledMap: Map = new Map(); + protected policiesEnabledMap: Map = new Map(); constructor( private route: ActivatedRoute, diff --git a/apps/web/src/app/organizations/settings/organization-billing.component.ts b/apps/web/src/app/organizations/settings/organization-billing.component.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/apps/web/src/app/organizations/vault/add-edit.component.ts b/apps/web/src/app/organizations/vault/add-edit.component.ts index e8138b1abc..27a2b9a11d 100644 --- a/apps/web/src/app/organizations/vault/add-edit.component.ts +++ b/apps/web/src/app/organizations/vault/add-edit.component.ts @@ -18,7 +18,6 @@ import { StateService } from "@bitwarden/common/abstractions/state.service"; import { TotpService } from "@bitwarden/common/abstractions/totp.service"; import { CipherData } from "@bitwarden/common/models/data/cipher.data"; import { Cipher } from "@bitwarden/common/models/domain/cipher"; -import { Organization } from "@bitwarden/common/models/domain/organization"; import { CipherCreateRequest } from "@bitwarden/common/models/request/cipher-create.request"; import { CipherRequest } from "@bitwarden/common/models/request/cipher.request"; @@ -29,7 +28,6 @@ import { AddEditComponent as BaseAddEditComponent } from "../../vault/add-edit.c templateUrl: "../../vault/add-edit.component.html", }) export class AddEditComponent extends BaseAddEditComponent { - organization: Organization; originalCipher: Cipher = null; constructor( diff --git a/apps/web/src/app/organizations/vault/vault-items.component.ts b/apps/web/src/app/organizations/vault/vault-items.component.ts index 670217a724..044b3d6d75 100644 --- a/apps/web/src/app/organizations/vault/vault-items.component.ts +++ b/apps/web/src/app/organizations/vault/vault-items.component.ts @@ -12,7 +12,6 @@ import { SearchService } from "@bitwarden/common/abstractions/search.service"; import { StateService } from "@bitwarden/common/abstractions/state.service"; import { TokenService } from "@bitwarden/common/abstractions/token.service"; import { TotpService } from "@bitwarden/common/abstractions/totp.service"; -import { Organization } from "@bitwarden/common/models/domain/organization"; import { CipherView } from "@bitwarden/common/models/view/cipher.view"; import { VaultItemsComponent as BaseVaultItemsComponent } from "../../vault/vault-items.component"; @@ -24,9 +23,6 @@ import { VaultItemsComponent as BaseVaultItemsComponent } from "../../vault/vaul export class VaultItemsComponent extends BaseVaultItemsComponent { @Output() onEventsClicked = new EventEmitter(); - organization: Organization; - accessEvents = false; - protected allCiphers: CipherView[] = []; constructor( @@ -86,6 +82,7 @@ export class VaultItemsComponent extends BaseVaultItemsComponent { async search(timeout: number = null) { await super.search(timeout, this.allCiphers); } + events(c: CipherView) { this.onEventsClicked.emit(c); } diff --git a/apps/web/src/app/organizations/vault/vault.component.html b/apps/web/src/app/organizations/vault/vault.component.html index dcc20913b9..7a75ce01c4 100644 --- a/apps/web/src/app/organizations/vault/vault.component.html +++ b/apps/web/src/app/organizations/vault/vault.component.html @@ -19,7 +19,7 @@

{{ "vaultItems" | i18n }} - + (); + passwordStrengthMap = new Map(); private passwordStrengthCache = new Map(); @@ -110,7 +111,7 @@ export class WeakPasswordsReportComponent extends CipherReportComponent implemen return true; } - private scoreKey(score: number): [string, string] { + private scoreKey(score: number): [string, BadgeTypes] { switch (score) { case 4: return ["strong", "success"]; diff --git a/apps/web/src/app/reports/shared/report-card/report-card.component.ts b/apps/web/src/app/reports/shared/report-card/report-card.component.ts index 063d52bc68..13a2a04e0d 100644 --- a/apps/web/src/app/reports/shared/report-card/report-card.component.ts +++ b/apps/web/src/app/reports/shared/report-card/report-card.component.ts @@ -1,5 +1,7 @@ import { Component, Input } from "@angular/core"; +import { Icon } from "@bitwarden/components"; + import { ReportVariant } from "../models/report-variant"; @Component({ @@ -10,7 +12,7 @@ export class ReportCardComponent { @Input() title: string; @Input() description: string; @Input() route: string; - @Input() icon: string; + @Input() icon: Icon; @Input() variant: ReportVariant; protected get disabled() { diff --git a/apps/web/src/app/send/access.component.html b/apps/web/src/app/send/access.component.html index b581861020..91ae288d3c 100644 --- a/apps/web/src/app/send/access.component.html +++ b/apps/web/src/app/send/access.component.html @@ -81,7 +81,7 @@ id="text" rows="8" name="Text" - [(ngModel)]="sendText" + [ngModel]="sendText" class="form-control" readonly > diff --git a/apps/web/src/app/send/add-edit.component.html b/apps/web/src/app/send/add-edit.component.html index dcc60a3c7a..dd9f61c6c5 100644 --- a/apps/web/src/app/send/add-edit.component.html +++ b/apps/web/src/app/send/add-edit.component.html @@ -55,7 +55,7 @@ name="Type_{{ o.value }}" id="type_{{ o.value }}" [value]="o.value" - (change)="typeChanged(o)" + (change)="typeChanged()" [checked]="send.type === o.value" />