This commit is contained in:
crusader 2018-05-28 18:06:33 +09:00
parent 7f10b3dd8a
commit e980403faf
3 changed files with 94 additions and 65 deletions

View File

@ -1,73 +1,78 @@
<h1>Unauthorized</h1> <p-blockUI [target]="content" [blocked]="pending">
<i class="fa ui-icon-lock block-icon"></i>
</p-blockUI>
<p-table #dt [value]="noauthProbes" selectionMode="single" dataKey="id"> <p-panel #content [showHeader]="false" class="block-panel">
<h1>Unauthorized</h1>
<p-table #dt [value]="noauthProbes" selectionMode="single" dataKey="id">
<ng-template pTemplate="header"> <ng-template pTemplate="header">
<tr> <tr>
<th style="width: 3.25em" pResizableColumn></th> <th style="width: 3.25em" pResizableColumn></th>
<th style="width: 20em">Probe Key</th> <th style="width: 20em">Probe Key</th>
<th>Host Name</th> <th>Host Name</th>
<th>OS</th> <th>OS</th>
<th style="width: 7em">Created at</th> <th style="width: 7em">Created at</th>
</tr> </tr>
</ng-template> </ng-template>
<ng-template pTemplate="body" let-rowData let-expanded="expanded" let-columns="columns"> <ng-template pTemplate="body" let-rowData let-expanded="expanded" let-columns="columns">
<tr [pSelectableRow]="rowData" [pRowToggler]="rowData"> <tr [pSelectableRow]="rowData" [pRowToggler]="rowData">
<td> <td>
<a href="#"> <a href="#">
<i [ngClass]="expanded ? 'fa fa-fw fa-chevron-circle-down' : 'fa fa-fw fa-chevron-circle-right'"></i> <i [ngClass]="expanded ? 'fa fa-fw fa-chevron-circle-down' : 'fa fa-fw fa-chevron-circle-right'"></i>
</a> </a>
</td> </td>
<td>{{rowData.tempProbeKey}}</td> <td>{{rowData.tempProbeKey}}</td>
<td>{{rowData.descriptions.host.name}}</td> <td>{{rowData.descriptions.host.name}}</td>
<td>{{rowData.descriptions.host.os}}</td> <td>{{rowData.descriptions.host.os}}</td>
<td>{{rowData.createDate | date: 'dd/MM/yyyy'}}</td> <td>{{rowData.createDate | date: 'dd/MM/yyyy'}}</td>
</tr> </tr>
</ng-template> </ng-template>
<ng-template pTemplate="rowexpansion" let-rowData let-columns="columns"> <ng-template pTemplate="rowexpansion" let-rowData let-columns="columns">
<tr> <tr>
<td [attr.colspan]="5"> <td [attr.colspan]="5">
<div class="ui-g ui-g-12"> <div class="ui-g ui-g-12">
<div class="ui-g-12 ui-md-6"> <div class="ui-g-12 ui-md-6">
<div class="ui-g-12"> <div class="ui-g-12">
<b>Platform:</b> {{rowData.descriptions.host.platform}} <b>Platform:</b> {{rowData.descriptions.host.platform}}
</div> </div>
<div class="ui-g-12"> <div class="ui-g-12">
<b>Platform family:</b> {{rowData.descriptions.host.platformFamily}} <b>Platform family:</b> {{rowData.descriptions.host.platformFamily}}
</div> </div>
<div class="ui-g-12"> <div class="ui-g-12">
<b>Kernel:</b> {{rowData.descriptions.host.kernelVersion}} <b>Kernel:</b> {{rowData.descriptions.host.kernelVersion}}
</div> </div>
<div class="ui-g-12"> <div class="ui-g-12">
<b>HostID:</b> {{rowData.descriptions.host.hostID}} <b>HostID:</b> {{rowData.descriptions.host.hostID}}
</div> </div>
</div> </div>
<div class="ui-g-12 ui-md-6"> <div class="ui-g-12 ui-md-6">
<div class="ui-g"> <div class="ui-g">
<div class="ui-g-12"> <div class="ui-g-12">
<b>NIC:</b> {{rowData.descriptions.network.name}} <b>NIC:</b> {{rowData.descriptions.network.name}}
</div>
<div class="ui-g-12">
<b>Network Address:</b> {{rowData.descriptions.network.address}}
</div>
<div class="ui-g-12">
<b>Gateway:</b> {{rowData.descriptions.network.gateway}}
</div>
<div class="ui-g-12">
<b>Mac Address:</b> {{rowData.descriptions.network.macAddress}}
</div>
</div>
</div>
<div class="ui-g-12" dir="rtl">
<button class="ui-button-danger ui-button-width-fit" type="button" label="Deny" icon="ui-icon-close" pButton (click)="onAcceptOrDeny(false, rowData)"></button>
<button class=" ui-button-width-fit" type="button" label="Accept" icon="fa-check" pButton (click)="onAcceptOrDeny(true, rowData)"></button>
</div>
</div> </div>
</td> <div class="ui-g-12">
</tr> <b>Network Address:</b> {{rowData.descriptions.network.address}}
</div>
<div class="ui-g-12">
<b>Gateway:</b> {{rowData.descriptions.network.gateway}}
</div>
<div class="ui-g-12">
<b>Mac Address:</b> {{rowData.descriptions.network.macAddress}}
</div>
</div>
</div>
<div class="ui-g-12" dir="rtl">
<button class="ui-button-danger ui-button-width-fit" type="button" label="Deny" icon="ui-icon-close" pButton (click)="onAcceptOrDeny(false, rowData)"></button>
<button class=" ui-button-width-fit" type="button" label="Accept" icon="fa-check" pButton (click)="onAcceptOrDeny(true, rowData)"></button>
</div>
</div>
</td>
</tr>
</ng-template> </ng-template>
</p-table> </p-table>
<p-confirmDialog header="Confirmation" icon="fa ui-icon-warning" width="425"></p-confirmDialog> <p-confirmDialog header="Confirmation" icon="fa ui-icon-warning" width="425"></p-confirmDialog>
<p-growl [(value)]="msgs"></p-growl> <p-growl [(value)]="msgs"></p-growl>
</p-panel>

View File

@ -20,7 +20,7 @@ import { RPCClientError } from '@loafer/ng-rpc';
export class NoAuthProbeListContainerComponent implements OnInit { export class NoAuthProbeListContainerComponent implements OnInit {
noauthProbes$: Observable<NoAuthProbe[]>; noauthProbes$: Observable<NoAuthProbe[]>;
pending$: Observable<boolean>; pending$: Observable<boolean>;
error$: Observable<RPCClientError>; error$: Observable<any>;
constructor( constructor(
private store: Store<any>, private store: Store<any>,

View File

@ -15,15 +15,39 @@ export function reducer(state = initialState, action: Actions): State {
pending: true, pending: true,
}; };
} }
case ActionType.ReadAllByDomainIDSuccess: { case ActionType.ReadAllByDomainIDSuccess: {
return noAuthProbeListContainerAdapter.setAll(action.payload, {...state, pending: false}); return noAuthProbeListContainerAdapter.setAll(action.payload, {...state, pending: false});
} }
case ActionType.ReadAllByDomainIDFailure: { case ActionType.ReadAllByDomainIDFailure: {
return noAuthProbeListContainerAdapter.setError(action.payload, {...state, pending: false}); return noAuthProbeListContainerAdapter.setError(action.payload, {...state, pending: false});
} }
case ActionType.Accept: {
return {
...state,
pending: true,
};
}
case ActionType.AcceptSuccess: {
return noAuthProbeListContainerAdapter.setAll(action.payload, {...state, pending: false});
}
case ActionType.AcceptFailure: {
return noAuthProbeListContainerAdapter.setError(action.payload, {...state, pending: false});
}
case ActionType.Deny: {
return {
...state,
pending: true,
};
}
case ActionType.DenySuccess: {
return noAuthProbeListContainerAdapter.setAll(action.payload, {...state, pending: false});
}
case ActionType.DenyFailure: {
return noAuthProbeListContainerAdapter.setError(action.payload, {...state, pending: false});
}
default: { default: {
return state; return state;
} }