mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-08 15:15:12 +00:00
fix(console): add model for api keys, fix toast, binding (#1757)
* fix: add model for api keys, fix toast, binding * show api clientid
This commit is contained in:
@@ -1,30 +1,33 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { saveAs } from 'file-saver';
|
||||
import { AddMachineKeyResponse } from 'src/app/proto/generated/zitadel/management_pb';
|
||||
import { AddAppKeyResponse, AddMachineKeyResponse } from 'src/app/proto/generated/zitadel/management_pb';
|
||||
|
||||
@Component({
|
||||
selector: 'app-show-key-dialog',
|
||||
templateUrl: './show-key-dialog.component.html',
|
||||
styleUrls: ['./show-key-dialog.component.scss'],
|
||||
selector: 'app-show-key-dialog',
|
||||
templateUrl: './show-key-dialog.component.html',
|
||||
styleUrls: ['./show-key-dialog.component.scss'],
|
||||
})
|
||||
export class ShowKeyDialogComponent {
|
||||
public keyResponse!: AddMachineKeyResponse.AsObject;
|
||||
public keyResponse!: AddMachineKeyResponse.AsObject | AddAppKeyResponse.AsObject;
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ShowKeyDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
) {
|
||||
this.keyResponse = data.key;
|
||||
}
|
||||
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' });
|
||||
saveAs(blob, `${this.keyResponse.keyId}.json`);
|
||||
}
|
||||
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;
|
||||
saveAs(blob, `${name}.json`);
|
||||
}
|
||||
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user