From 18f7d64a6d34e940445ffb37f70759a20548e434 Mon Sep 17 00:00:00 2001 From: Jordan Aasen <166539328+jaasen-livefront@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:25:06 -0700 Subject: [PATCH] [PM-14038] - priority applications UI (#11723) * priority applications UI * add security icon --- .../no-priority-apps.component.ts | 2 +- .../password-health-members.component.html | 66 ++++++++++++++----- .../password-health-members.component.ts | 41 +++++++++++- apps/web/src/locales/en/messages.json | 3 + libs/components/src/icon/icons/index.ts | 1 + libs/components/src/icon/icons/security.ts | 50 ++++++++++++++ 6 files changed, 145 insertions(+), 18 deletions(-) create mode 100644 libs/components/src/icon/icons/security.ts diff --git a/apps/web/src/app/tools/access-intelligence/no-priority-apps.component.ts b/apps/web/src/app/tools/access-intelligence/no-priority-apps.component.ts index e4e54ca2f1..d0f53d0942 100644 --- a/apps/web/src/app/tools/access-intelligence/no-priority-apps.component.ts +++ b/apps/web/src/app/tools/access-intelligence/no-priority-apps.component.ts @@ -11,5 +11,5 @@ import { ButtonModule, NoItemsModule, Icons } from "@bitwarden/components"; imports: [ButtonModule, CommonModule, JslibModule, NoItemsModule], }) export class NoPriorityAppsComponent { - noItemsIcon = Icons.NoResults; + noItemsIcon = Icons.Security; } diff --git a/apps/web/src/app/tools/access-intelligence/password-health-members.component.html b/apps/web/src/app/tools/access-intelligence/password-health-members.component.html index 885c21f0a2..ca2936b282 100644 --- a/apps/web/src/app/tools/access-intelligence/password-health-members.component.html +++ b/apps/web/src/app/tools/access-intelligence/password-health-members.component.html @@ -1,15 +1,38 @@ - -

{{ "passwordsReportDesc" | i18n }}

-
- - {{ "loading" | i18n }} +

{{ "passwordsReportDesc" | i18n }}

+
+ + {{ "loading" | i18n }} +
+
+ +
+
+
+ + + +
-
- +
+ +
@@ -30,7 +53,15 @@
- @@ -47,9 +78,14 @@ - + - + @@ -84,4 +120,4 @@
- +
diff --git a/apps/web/src/app/tools/access-intelligence/password-health-members.component.ts b/apps/web/src/app/tools/access-intelligence/password-health-members.component.ts index 17b2456406..975b9c7125 100644 --- a/apps/web/src/app/tools/access-intelligence/password-health-members.component.ts +++ b/apps/web/src/app/tools/access-intelligence/password-health-members.component.ts @@ -11,7 +11,13 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; -import { BadgeVariant, SearchModule, TableDataSource, TableModule } from "@bitwarden/components"; +import { + BadgeVariant, + SearchModule, + TableDataSource, + TableModule, + ToastService, +} from "@bitwarden/components"; import { CardComponent } from "@bitwarden/tools-card"; import { HeaderModule } from "../../layouts/header/header.module"; @@ -53,6 +59,8 @@ export class PasswordHealthMembersComponent implements OnInit { loading = true; + selectedIds: Set = new Set(); + protected searchControl = new FormControl("", { nonNullable: true }); private destroyRef = inject(DestroyRef); @@ -63,6 +71,7 @@ export class PasswordHealthMembersComponent implements OnInit { protected auditService: AuditService, protected i18nService: I18nService, protected activatedRoute: ActivatedRoute, + protected toastService: ToastService, ) { this.searchControl.valueChanges .pipe(debounceTime(200), takeUntilDestroyed()) @@ -91,7 +100,7 @@ export class PasswordHealthMembersComponent implements OnInit { await passwordHealthService.generateReport(); - this.dataSource.data = passwordHealthService.reportCiphers; + this.dataSource.data = []; //passwordHealthService.reportCiphers; this.exposedPasswordMap = passwordHealthService.exposedPasswordMap; this.passwordStrengthMap = passwordHealthService.passwordStrengthMap; @@ -99,4 +108,32 @@ export class PasswordHealthMembersComponent implements OnInit { this.totalMembersMap = passwordHealthService.totalMembersMap; this.loading = false; } + + markAppsAsCritical = async () => { + // TODO: Send to API once implemented + return new Promise((resolve) => { + setTimeout(() => { + this.selectedIds.clear(); + this.toastService.showToast({ + variant: "success", + title: null, + message: this.i18nService.t("appsMarkedAsCritical"), + }); + resolve(true); + }, 1000); + }); + }; + + trackByFunction(_: number, item: CipherView) { + return item.id; + } + + onCheckboxChange(id: number, event: Event) { + const isChecked = (event.target as HTMLInputElement).checked; + if (isChecked) { + this.selectedIds.add(id); + } else { + this.selectedIds.delete(id); + } + } } diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index 277f834c69..3189777aa7 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -65,6 +65,9 @@ "markAppAsCritical": { "message": "Mark app as critical" }, + "appsMarkedAsCritical": { + "message": "Apps marked as critical" + }, "application": { "message": "Application" }, diff --git a/libs/components/src/icon/icons/index.ts b/libs/components/src/icon/icons/index.ts index 0ed0cc1897..b52903e15e 100644 --- a/libs/components/src/icon/icons/index.ts +++ b/libs/components/src/icon/icons/index.ts @@ -1,3 +1,4 @@ export * from "./search"; +export * from "./security"; export * from "./no-access"; export * from "./no-results"; diff --git a/libs/components/src/icon/icons/security.ts b/libs/components/src/icon/icons/security.ts new file mode 100644 index 0000000000..5732b8066c --- /dev/null +++ b/libs/components/src/icon/icons/security.ts @@ -0,0 +1,50 @@ +import { svgIcon } from "../icon"; + +export const Security = svgIcon` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`;