1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +00:00

[SM-1246] Routing to new machine account after machine account is created (#15080)

* Routing to new machine account after machine account is created

* Updating the width of the tabbed content during responsive size changes

* Removing responsive UI changes
This commit is contained in:
cd-bitwarden
2025-06-18 13:57:21 -04:00
committed by GitHub
parent a3d870c6aa
commit 95667310a2
2 changed files with 23 additions and 6 deletions

View File

@@ -2,9 +2,9 @@
// @ts-strict-ignore
import { Component, Inject, OnInit } from "@angular/core";
import { FormControl, FormGroup, Validators } from "@angular/forms";
import { Router } from "@angular/router";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { DialogRef, DIALOG_DATA, BitValidators, ToastService } from "@bitwarden/components";
import { ServiceAccountView } from "../../models/view/service-account.view";
@@ -46,8 +46,8 @@ export class ServiceAccountDialogComponent implements OnInit {
@Inject(DIALOG_DATA) private data: ServiceAccountOperation,
private serviceAccountService: ServiceAccountService,
private i18nService: I18nService,
private platformUtilsService: PlatformUtilsService,
private toastService: ToastService,
private router: Router,
) {}
async ngOnInit() {
@@ -87,8 +87,17 @@ export class ServiceAccountDialogComponent implements OnInit {
let serviceAccountMessage: string;
if (this.data.operation == OperationType.Add) {
await this.serviceAccountService.create(this.data.organizationId, serviceAccountView);
const newServiceAccount = await this.serviceAccountService.create(
this.data.organizationId,
serviceAccountView,
);
serviceAccountMessage = this.i18nService.t("machineAccountCreated");
await this.router.navigate([
"sm",
this.data.organizationId,
"machine-accounts",
newServiceAccount.id,
]);
} else {
await this.serviceAccountService.update(
this.data.serviceAccountId,

View File

@@ -91,7 +91,10 @@ export class ServiceAccountService {
);
}
async create(organizationId: string, serviceAccountView: ServiceAccountView) {
async create(
organizationId: string,
serviceAccountView: ServiceAccountView,
): Promise<ServiceAccountView> {
const orgKey = await this.getOrganizationKey(organizationId);
const request = await this.getServiceAccountRequest(orgKey, serviceAccountView);
const r = await this.apiService.send(
@@ -101,9 +104,14 @@ export class ServiceAccountService {
true,
true,
);
this._serviceAccount.next(
await this.createServiceAccountView(orgKey, new ServiceAccountResponse(r)),
const serviceAccount = await this.createServiceAccountView(
orgKey,
new ServiceAccountResponse(r),
);
this._serviceAccount.next(serviceAccount);
return serviceAccount;
}
async delete(serviceAccounts: ServiceAccountView[]): Promise<BulkOperationStatus[]> {