mirror of
https://github.com/zitadel/zitadel.git
synced 2025-05-02 05:31:07 +00:00
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { Component, Inject } from '@angular/core';
|
|
import { UntypedFormControl } from '@angular/forms';
|
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|
import { KeyType } from 'src/app/proto/generated/zitadel/auth_n_key_pb';
|
|
|
|
export enum AddKeyDialogType {
|
|
MACHINE = 'MACHINE',
|
|
AUTHNKEY = 'AUTHNKEY',
|
|
}
|
|
|
|
@Component({
|
|
selector: 'cnsl-add-key-dialog',
|
|
templateUrl: './add-key-dialog.component.html',
|
|
styleUrls: ['./add-key-dialog.component.scss'],
|
|
})
|
|
export class AddKeyDialogComponent {
|
|
public startDate: Date = new Date();
|
|
types: KeyType[] = [];
|
|
public type!: KeyType;
|
|
public dateControl: UntypedFormControl = new UntypedFormControl('', []);
|
|
|
|
constructor(
|
|
public dialogRef: MatDialogRef<AddKeyDialogComponent>,
|
|
@Inject(MAT_DIALOG_DATA) public data: any,
|
|
) {
|
|
this.types = [KeyType.KEY_TYPE_JSON];
|
|
this.type = KeyType.KEY_TYPE_JSON;
|
|
const today = new Date();
|
|
this.startDate.setDate(today.getDate() + 1);
|
|
}
|
|
|
|
public closeDialog(): void {
|
|
this.dialogRef.close(false);
|
|
}
|
|
|
|
public closeDialogWithSuccess(): void {
|
|
this.dialogRef.close({ type: this.type, date: this.dateControl.value });
|
|
}
|
|
}
|