mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 09:43:23 +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:
@@ -2,9 +2,9 @@
|
|||||||
// @ts-strict-ignore
|
// @ts-strict-ignore
|
||||||
import { Component, Inject, OnInit } from "@angular/core";
|
import { Component, Inject, OnInit } from "@angular/core";
|
||||||
import { FormControl, FormGroup, Validators } from "@angular/forms";
|
import { FormControl, FormGroup, Validators } from "@angular/forms";
|
||||||
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
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 { DialogRef, DIALOG_DATA, BitValidators, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { ServiceAccountView } from "../../models/view/service-account.view";
|
import { ServiceAccountView } from "../../models/view/service-account.view";
|
||||||
@@ -46,8 +46,8 @@ export class ServiceAccountDialogComponent implements OnInit {
|
|||||||
@Inject(DIALOG_DATA) private data: ServiceAccountOperation,
|
@Inject(DIALOG_DATA) private data: ServiceAccountOperation,
|
||||||
private serviceAccountService: ServiceAccountService,
|
private serviceAccountService: ServiceAccountService,
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
|
||||||
private toastService: ToastService,
|
private toastService: ToastService,
|
||||||
|
private router: Router,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -87,8 +87,17 @@ export class ServiceAccountDialogComponent implements OnInit {
|
|||||||
let serviceAccountMessage: string;
|
let serviceAccountMessage: string;
|
||||||
|
|
||||||
if (this.data.operation == OperationType.Add) {
|
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");
|
serviceAccountMessage = this.i18nService.t("machineAccountCreated");
|
||||||
|
await this.router.navigate([
|
||||||
|
"sm",
|
||||||
|
this.data.organizationId,
|
||||||
|
"machine-accounts",
|
||||||
|
newServiceAccount.id,
|
||||||
|
]);
|
||||||
} else {
|
} else {
|
||||||
await this.serviceAccountService.update(
|
await this.serviceAccountService.update(
|
||||||
this.data.serviceAccountId,
|
this.data.serviceAccountId,
|
||||||
|
|||||||
@@ -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 orgKey = await this.getOrganizationKey(organizationId);
|
||||||
const request = await this.getServiceAccountRequest(orgKey, serviceAccountView);
|
const request = await this.getServiceAccountRequest(orgKey, serviceAccountView);
|
||||||
const r = await this.apiService.send(
|
const r = await this.apiService.send(
|
||||||
@@ -101,9 +104,14 @@ export class ServiceAccountService {
|
|||||||
true,
|
true,
|
||||||
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[]> {
|
async delete(serviceAccounts: ServiceAccountView[]): Promise<BulkOperationStatus[]> {
|
||||||
|
|||||||
Reference in New Issue
Block a user