diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/layout/no-items.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/layout/no-items.component.html index c2add8e479..90e93dfc81 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/layout/no-items.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/layout/no-items.component.html @@ -4,13 +4,13 @@

- +

- +

- +
diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/projects/projects-list/projects-list.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/projects/projects-list/projects-list.component.html index 89e7010c1d..5e66994ed8 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/projects/projects-list/projects-list.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/projects/projects-list/projects-list.component.html @@ -3,9 +3,9 @@ - {{ "projectsNoItemsTitle" | i18n }} - {{ "projectsNoItemsMessage" | i18n }} - diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-list.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-list.component.html index d40b845646..42a55dac60 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-list.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-list.component.html @@ -3,9 +3,9 @@ - {{ "accessTokensNoItemsTitle" | i18n }} - {{ "accessTokensNoItemsDesc" | i18n }} - diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-tokens.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-tokens.component.ts index 8729dcb015..d453afd429 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-tokens.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access-tokens.component.ts @@ -4,14 +4,10 @@ import { combineLatestWith, Observable, startWith, switchMap } from "rxjs"; import { DialogService } from "@bitwarden/components"; -import { ServiceAccountView } from "../../models/view/service-account.view"; import { AccessTokenView } from "../models/view/access-token.view"; import { AccessService } from "./access.service"; -import { - AccessTokenOperation, - AccessTokenCreateDialogComponent, -} from "./dialogs/access-token-create-dialog.component"; +import { AccessTokenCreateDialogComponent } from "./dialogs/access-token-create-dialog.component"; @Component({ selector: "sm-access-tokens", @@ -45,17 +41,11 @@ export class AccessTokenComponent implements OnInit { return await this.accessService.getAccessTokens(this.organizationId, this.serviceAccountId); } - async openNewAccessTokenDialog() { - // TODO once service account names are implemented in service account contents page pass in here. - const serviceAccountView = new ServiceAccountView(); - serviceAccountView.id = this.serviceAccountId; - serviceAccountView.name = "placeholder"; - - this.dialogService.open(AccessTokenCreateDialogComponent, { - data: { - organizationId: this.organizationId, - serviceAccountView: serviceAccountView, - }, - }); + protected openNewAccessTokenDialog() { + AccessTokenCreateDialogComponent.openNewAccessTokenDialog( + this.dialogService, + this.serviceAccountId, + this.organizationId + ); } } diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/dialogs/access-token-create-dialog.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/dialogs/access-token-create-dialog.component.ts index 93ef185f6a..ad06778697 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/dialogs/access-token-create-dialog.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/dialogs/access-token-create-dialog.component.ts @@ -82,4 +82,22 @@ export class AccessTokenCreateDialogComponent implements OnInit { }, }); } + + static openNewAccessTokenDialog( + dialogService: DialogService, + serviceAccountId: string, + organizationId: string + ) { + // TODO once service account names are implemented in service account contents page pass in here. + const serviceAccountView = new ServiceAccountView(); + serviceAccountView.id = serviceAccountId; + serviceAccountView.name = "placeholder"; + + return dialogService.open(AccessTokenCreateDialogComponent, { + data: { + organizationId: organizationId, + serviceAccountView: serviceAccountView, + }, + }); + } } diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-account.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-account.component.html index a22dc5f13c..0636ba2121 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-account.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-account.component.html @@ -14,5 +14,9 @@ {{ "people" | i18n }} {{ "accessTokens" | i18n }} + diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-account.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-account.component.ts index d0288866f3..7be88fc9a8 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-account.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/service-account.component.ts @@ -2,6 +2,9 @@ import { Component } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { switchMap } from "rxjs"; +import { DialogService } from "@bitwarden/components"; + +import { AccessTokenCreateDialogComponent } from "./access/dialogs/access-token-create-dialog.component"; import { ServiceAccountService } from "./service-account.service"; @Component({ @@ -9,19 +12,34 @@ import { ServiceAccountService } from "./service-account.service"; templateUrl: "./service-account.component.html", }) export class ServiceAccountComponent { + private organizationId: string; + private serviceAccountId: string; + /** * TODO: remove when a server method is available that fetches a service account by ID */ protected serviceAccount$ = this.route.params.pipe( - switchMap((params) => - this.serviceAccountService + switchMap((params) => { + this.serviceAccountId = params.serviceAccountId; + this.organizationId = params.organizationId; + + return this.serviceAccountService .getServiceAccounts(params.organizationId) - .then((saList) => saList.find((sa) => sa.id === params.serviceAccountId)) - ) + .then((saList) => saList.find((sa) => sa.id === params.serviceAccountId)); + }) ); constructor( private route: ActivatedRoute, - private serviceAccountService: ServiceAccountService + private serviceAccountService: ServiceAccountService, + private dialogService: DialogService ) {} + + protected openNewAccessTokenDialog() { + AccessTokenCreateDialogComponent.openNewAccessTokenDialog( + this.dialogService, + this.serviceAccountId, + this.organizationId + ); + } } diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/shared/secrets-list.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/shared/secrets-list.component.html index aed896b3ff..0c19bb2066 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/shared/secrets-list.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/shared/secrets-list.component.html @@ -3,9 +3,9 @@ - {{ "secretsNoItemsTitle" | i18n }} - {{ "secretsNoItemsMessage" | i18n }} -