parent
544c07cf8d
commit
862fb6b338
18 changed files with 125 additions and 31 deletions
@ -1,15 +1,64 @@ |
||||
<h2 mat-dialog-title *ngIf="is_preview">Agent info</h2> |
||||
<h2 mat-dialog-title *ngIf="!is_preview">Editing agent info</h2> |
||||
<mat-dialog-content> |
||||
<div> |
||||
<p>ID: {{data.id}}</p> |
||||
<p>Alias: {{data.alias}}</p> |
||||
<p>Username: {{data.username}}</p> |
||||
<p>Hostname: {{data.hostname}}</p> |
||||
<p>Platform: {{data.platform}}</p> |
||||
<p>Registration time: {{data.regtime.secs_since_epoch * 1000 | date:'long'}}</p> |
||||
<p>Last active time: {{data.last_active.secs_since_epoch * 1000 | date:'long'}}</p> |
||||
</div> |
||||
<p> |
||||
<mat-form-field class="info-dlg-field" cdkFocusInitial> |
||||
<mat-label>ID</mat-label> |
||||
<input matInput disabled value="{{data.id}}"> |
||||
</mat-form-field> |
||||
</p> |
||||
<p> |
||||
<mat-form-field class="info-dlg-field"> |
||||
<mat-label>Alias</mat-label> |
||||
<input matInput [readonly]="is_preview" [(ngModel)]="data.alias"> |
||||
</mat-form-field> |
||||
</p> |
||||
<p> |
||||
<mat-form-field class="info-dlg-field"> |
||||
<mat-label>Username</mat-label> |
||||
<input matInput [readonly]="is_preview" [(ngModel)]="data.username"> |
||||
</mat-form-field> |
||||
</p> |
||||
<p> |
||||
<mat-form-field class="info-dlg-field"> |
||||
<mat-label>Hostname</mat-label> |
||||
<input matInput [readonly]="is_preview" [(ngModel)]="data.hostname"> |
||||
</mat-form-field> |
||||
</p> |
||||
<p> |
||||
<mat-form-field class="info-dlg-field"> |
||||
<mat-label>Host info</mat-label> |
||||
<textarea matInput [readonly]="is_preview" [(ngModel)]="data.host_info"> |
||||
</textarea> |
||||
</mat-form-field> |
||||
</p> |
||||
<p> |
||||
<mat-form-field class="info-dlg-field"> |
||||
<mat-label>Platform</mat-label> |
||||
<input matInput [readonly]="is_preview" [(ngModel)]="data.platform"> |
||||
</mat-form-field> |
||||
</p> |
||||
<p> |
||||
<mat-form-field class="info-dlg-field"> |
||||
<mat-label>Is root</mat-label> |
||||
<input matInput disabled value="{{data.is_root}}"> |
||||
</mat-form-field> |
||||
</p> |
||||
<p> |
||||
<mat-form-field class="info-dlg-field"> |
||||
<mat-label>Registration time</mat-label> |
||||
<input matInput disabled value="{{data.regtime.secs_since_epoch * 1000 | date:'long'}}"> |
||||
</mat-form-field> |
||||
</p> |
||||
<p> |
||||
<mat-form-field class="info-dlg-field"> |
||||
<mat-label>Last active time</mat-label> |
||||
<input matInput disabled value="{{data.last_active.secs_since_epoch * 1000 | date:'long'}}"> |
||||
</mat-form-field> |
||||
</p> |
||||
</mat-dialog-content> |
||||
<mat-dialog-actions align="end"> |
||||
<button mat-button cdkFocusInitial>Edit</button> |
||||
<button mat-raised-button *ngIf="is_preview" (click)="is_preview = false">Edit</button> |
||||
<button mat-raised-button *ngIf="!is_preview" (click)="updateAgent()">Save</button> |
||||
<button mat-button mat-dialog-close>Cancel</button> |
||||
</mat-dialog-actions> |
@ -1,11 +1,23 @@ |
||||
import { Component, Inject } from '@angular/core'; |
||||
import { MAT_DIALOG_DATA } from '@angular/material/dialog'; |
||||
import { AgentModel } from '../../models/agent.model'; |
||||
import { EventEmitter } from '@angular/core'; |
||||
import { Input } from '@angular/core'; |
||||
|
||||
@Component({ |
||||
selector: 'agent-info-dialog', |
||||
templateUrl: 'agent-info-dialog.html', |
||||
styleUrls: ['info-dialog.component.less'] |
||||
}) |
||||
export class AgentInfoDialogComponent { |
||||
is_preview = true; |
||||
onSave = new EventEmitter(); |
||||
|
||||
|
||||
constructor(@Inject(MAT_DIALOG_DATA) public data: AgentModel) { } |
||||
|
||||
updateAgent() { |
||||
console.log(this.data); |
||||
this.onSave.emit(this.data); |
||||
} |
||||
}
|
@ -0,0 +1,3 @@ |
||||
.info-dlg-field { |
||||
width: 100%; |
||||
} |
Loading…
Reference in new issue