From a40643d9d6bff53a7ce3e32173228ad30334ba28 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Mon, 11 Dec 2023 18:22:37 +0100 Subject: [PATCH] Move SM header into web (#6976) --- .../src/app/layouts/header/header.module.ts | 14 +++++++ .../layouts/header/web-header.component.html | 0 .../layouts/header/web-header.component.ts | 6 +-- .../app/layouts/header/web-header.stories.ts | 41 ++++++++++--------- .../overview/overview.component.html | 4 +- .../projects/project/project.component.html | 4 +- .../projects/projects/projects.component.html | 4 +- .../secrets/secrets.component.html | 4 +- .../service-account.component.html | 4 +- .../service-accounts.component.html | 4 +- .../settings/porting/sm-export.component.html | 2 +- .../settings/porting/sm-import.component.html | 2 +- .../shared/org-suspended.component.html | 4 +- .../shared/sm-shared.module.ts | 22 +++++----- .../trash/trash.component.html | 4 +- 15 files changed, 68 insertions(+), 51 deletions(-) create mode 100644 apps/web/src/app/layouts/header/header.module.ts rename bitwarden_license/bit-web/src/app/secrets-manager/shared/header.component.html => apps/web/src/app/layouts/header/web-header.component.html (100%) rename bitwarden_license/bit-web/src/app/secrets-manager/shared/header.component.ts => apps/web/src/app/layouts/header/web-header.component.ts (95%) rename bitwarden_license/bit-web/src/app/secrets-manager/shared/header.stories.ts => apps/web/src/app/layouts/header/web-header.stories.ts (81%) diff --git a/apps/web/src/app/layouts/header/header.module.ts b/apps/web/src/app/layouts/header/header.module.ts new file mode 100644 index 0000000000..2730888a24 --- /dev/null +++ b/apps/web/src/app/layouts/header/header.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from "@angular/core"; + +import { DynamicAvatarComponent } from "../../components/dynamic-avatar.component"; +import { SharedModule } from "../../shared"; +import { ProductSwitcherModule } from "../product-switcher/product-switcher.module"; + +import { WebHeaderComponent } from "./web-header.component"; + +@NgModule({ + imports: [SharedModule, DynamicAvatarComponent, ProductSwitcherModule], + declarations: [WebHeaderComponent], + exports: [WebHeaderComponent], +}) +export class HeaderModule {} diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/shared/header.component.html b/apps/web/src/app/layouts/header/web-header.component.html similarity index 100% rename from bitwarden_license/bit-web/src/app/secrets-manager/shared/header.component.html rename to apps/web/src/app/layouts/header/web-header.component.html diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/shared/header.component.ts b/apps/web/src/app/layouts/header/web-header.component.ts similarity index 95% rename from bitwarden_license/bit-web/src/app/secrets-manager/shared/header.component.ts rename to apps/web/src/app/layouts/header/web-header.component.ts index 8e3e3ee83e..ff934d33e8 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/shared/header.component.ts +++ b/apps/web/src/app/layouts/header/web-header.component.ts @@ -10,10 +10,10 @@ import { StateService } from "@bitwarden/common/platform/abstractions/state.serv import { AccountProfile } from "@bitwarden/common/platform/models/domain/account"; @Component({ - selector: "sm-header", - templateUrl: "./header.component.html", + selector: "app-header", + templateUrl: "./web-header.component.html", }) -export class HeaderComponent { +export class WebHeaderComponent { /** * Custom title that overrides the route data `titleId` */ diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/shared/header.stories.ts b/apps/web/src/app/layouts/header/web-header.stories.ts similarity index 81% rename from bitwarden_license/bit-web/src/app/secrets-manager/shared/header.stories.ts rename to apps/web/src/app/layouts/header/web-header.stories.ts index 412dedd8ea..d3efe22cf9 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/shared/header.stories.ts +++ b/apps/web/src/app/layouts/header/web-header.stories.ts @@ -1,3 +1,4 @@ +import { CommonModule } from "@angular/common"; import { Component, Injectable, importProvidersFrom } from "@angular/core"; import { RouterModule } from "@angular/router"; import { @@ -27,9 +28,9 @@ import { TypographyModule, InputModule, } from "@bitwarden/components"; -import { PreloadedEnglishI18nModule } from "@bitwarden/web-vault/app/core/tests"; -import { HeaderComponent } from "./header.component"; +import { PreloadedEnglishI18nModule } from "../../core/tests"; +import { WebHeaderComponent } from "../header/web-header.component"; @Injectable({ providedIn: "root", @@ -66,6 +67,8 @@ class MockProductSwitcher {} @Component({ selector: "dynamic-avatar", template: ``, + standalone: true, + imports: [CommonModule, AvatarModule], }) class MockDynamicAvatar { protected name$ = combineLatest([ @@ -81,7 +84,7 @@ class MockDynamicAvatar { export default { title: "Web/Header", - component: HeaderComponent, + component: WebHeaderComponent, decorators: [ componentWrapperDecorator( (story) => `
${story}
`, @@ -89,7 +92,6 @@ export default { moduleMetadata({ imports: [ JslibModule, - RouterModule, AvatarModule, BreadcrumbsModule, ButtonModule, @@ -100,8 +102,9 @@ export default { TabsModule, TypographyModule, NavigationModule, + MockDynamicAvatar, ], - declarations: [HeaderComponent, MockProductSwitcher, MockDynamicAvatar], + declarations: [WebHeaderComponent, MockProductSwitcher], providers: [ { provide: StateService, useClass: MockStateService }, { provide: PlatformUtilsService, useClass: MockPlatformUtilsService }, @@ -126,7 +129,7 @@ export default { export const KitchenSink: Story = (args) => ({ props: args, template: ` - + Foo Bar @@ -142,75 +145,75 @@ export const KitchenSink: Story = (args) => ({ Foo Bar - + `, }); export const Basic: Story = (args) => ({ props: args, template: ` - + `, }); export const WithLongTitle: Story = (args) => ({ props: args, template: ` - + `, }); export const WithBreadcrumbs: Story = (args) => ({ props: args, template: ` - + Foo Bar - + `, }); export const WithSearch: Story = (args) => ({ props: args, template: ` - + - + `, }); export const WithSecondaryContent: Story = (args) => ({ props: args, template: ` - + - + `, }); export const WithTabs: Story = (args) => ({ props: args, template: ` - + Foo Bar - + `, }); export const WithCustomTitleComponent: Story = (args) => ({ props: args, template: ` - +

Bitwarden

-
+ `, }); diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.html index b4db6d1a01..f097481633 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.html @@ -1,6 +1,6 @@ - + - +
diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project.component.html index 55ae752a48..efcbe89f08 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project.component.html @@ -1,4 +1,4 @@ - + {{ "projects" | i18n }} @@ -20,5 +20,5 @@ > {{ "editProject" | i18n }} - + diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/projects/projects/projects.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/projects/projects/projects.component.html index d7bc89af02..b3d4aea5cc 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/projects/projects/projects.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/projects/projects/projects.component.html @@ -1,11 +1,11 @@ - + - + + - +