fix(console): Auth method dialog title, layout issues (#4216)

* fix(console): app auth method dialog title

* lint
This commit is contained in:
Max Peintner
2022-08-26 08:13:38 +02:00
committed by GitHub
parent 47930c6a85
commit 3c67c9756d
6 changed files with 85 additions and 57 deletions
@@ -2,6 +2,7 @@ import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { saveAs } from 'file-saver';
import { AddAppKeyResponse, AddMachineKeyResponse } from 'src/app/proto/generated/zitadel/management_pb';
import { InfoSectionType } from '../info-section/info-section.component';
@Component({
selector: 'cnsl-show-key-dialog',
@@ -10,20 +11,18 @@ import { AddAppKeyResponse, AddMachineKeyResponse } from 'src/app/proto/generate
})
export class ShowKeyDialogComponent {
public keyResponse!: AddMachineKeyResponse.AsObject | AddAppKeyResponse.AsObject;
public InfoSectionType: any = InfoSectionType;
constructor(
public dialogRef: MatDialogRef<ShowKeyDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
) {
constructor(public dialogRef: MatDialogRef<ShowKeyDialogComponent>, @Inject(MAT_DIALOG_DATA) public data: any) {
this.keyResponse = data.key;
}
public saveFile(): void {
const json = atob(this.keyResponse.keyDetails.toString());
const blob = new Blob([json], { type: 'text/plain;charset=utf-8' });
const name = (this.keyResponse as AddMachineKeyResponse.AsObject).keyId ?
(this.keyResponse as AddMachineKeyResponse.AsObject).keyId :
(this.keyResponse as AddAppKeyResponse.AsObject).id;
const name = (this.keyResponse as AddMachineKeyResponse.AsObject).keyId
? (this.keyResponse as AddMachineKeyResponse.AsObject).keyId
: (this.keyResponse as AddAppKeyResponse.AsObject).id;
saveAs(blob, `${name}.json`);
}