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
@@ -1,17 +1,19 @@
<span class="title" mat-dialog-title>{{'USER.MACHINE.ADDED.TITLE' | translate}}</span>
<span class="title" mat-dialog-title>{{ 'USER.MACHINE.ADDED.TITLE' | translate }}</span>
<div mat-dialog-content>
<p class="desc"> {{'USER.MACHINE.ADDED.DESCRIPTION' | translate}}</p>
<cnsl-info-section class="desc" [type]="InfoSectionType.WARN">{{
'USER.MACHINE.ADDED.DESCRIPTION' | translate
}}</cnsl-info-section>
<ng-container *ngIf="keyResponse">
<div class="row">
<p class="left cnsl-secondary-text">{{'USER.MACHINE.ID' | translate}}</p>
<p class="right">{{$any(keyResponse)?.id}}</p>
<p class="right">{{$any(keyResponse)?.keyId}}</p>
<p class="left cnsl-secondary-text">{{ 'USER.MACHINE.ID' | translate }}</p>
<p class="right">{{ $any(keyResponse)?.id }}</p>
<p class="right">{{ $any(keyResponse)?.keyId }}</p>
</div>
<div class="row">
<p class="left cnsl-secondary-text">{{'USER.MACHINE.CREATIONDATE' | translate}}</p>
<p class="left cnsl-secondary-text">{{ 'USER.MACHINE.CREATIONDATE' | translate }}</p>
<p *ngIf="keyResponse.details && keyResponse.details.creationDate" class="right">
{{ keyResponse.details.creationDate | timestampToDate | localizedDate: 'EEE dd. MMM YYYY, HH:mm' }}
{{ keyResponse.details.creationDate | timestampToDate | localizedDate: 'EEE dd. MMM YYYY, HH:mm' }}
</p>
</div>
@@ -19,7 +21,8 @@
</ng-container>
</div>
<div mat-dialog-actions class="action">
<span class="fill-space"></span>
<button color="primary" mat-raised-button class="ok-button" (click)="closeDialog()">
{{'ACTIONS.CLOSE' | translate}}
{{ 'ACTIONS.CLOSE' | translate }}
</button>
</div>
</div>
@@ -3,11 +3,6 @@
margin-top: 0;
}
.desc {
color: rgb(201, 51, 71);
font-size: 0.9rem;
}
.form-field {
width: 100%;
}
@@ -16,6 +11,10 @@
display: flex;
justify-content: space-between;
.fill-space {
flex: 1;
}
.ok-button {
margin-left: 0.5rem;
}
@@ -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`);
}
@@ -4,17 +4,19 @@ import { MatButtonModule } from '@angular/material/button';
import { TranslateModule } from '@ngx-translate/core';
import { LocalizedDatePipeModule } from 'src/app/pipes/localized-date-pipe/localized-date-pipe.module';
import { TimestampToDatePipeModule } from 'src/app/pipes/timestamp-to-date-pipe/timestamp-to-date-pipe.module';
import { InfoSectionModule } from '../info-section/info-section.module';
import { ShowKeyDialogComponent } from './show-key-dialog.component';
@NgModule({
declarations: [ShowKeyDialogComponent],
imports: [
CommonModule,
TranslateModule,
MatButtonModule,
LocalizedDatePipeModule,
TimestampToDatePipeModule,
],
declarations: [ShowKeyDialogComponent],
imports: [
CommonModule,
TranslateModule,
MatButtonModule,
LocalizedDatePipeModule,
InfoSectionModule,
TimestampToDatePipeModule,
],
})
export class ShowKeyDialogModule { }
export class ShowKeyDialogModule {}