This commit is contained in:
insanity 2018-04-24 14:47:03 +09:00
parent 2ba7ecb888
commit 0e45ff03cf
2 changed files with 10 additions and 57 deletions

View File

@ -65,37 +65,11 @@
</tr>
<tr>
<td [attr.colspan]="5">
<button class="ui-button-danger ui-button-width-fit" type="button" label="Deny" icon="ui-icon-close" pButton (click)="onAcceptOrDeny(false)"></button>
<button class=" ui-button-width-fit" type="button" label="Accept" icon="fa-check" pButton (click)="onAcceptOrDeny(true)"></button>
<button class="ui-button-danger ui-button-width-fit" type="button" label="Deny" icon="ui-icon-close" pButton (click)="onAcceptOrDeny(false, rowData.data)"></button>
<button class=" ui-button-width-fit" type="button" label="Accept" icon="fa-check" pButton (click)="onAcceptOrDeny(true, rowData.data)"></button>
</td>
</tr>
</ng-template>
</p-table>
<!-- <p-table [value]="noauthProbes" selectionMode="single" [(selection)]="selected" [resizableColumns]="true">
<ng-template pTemplate="header" let-columns>
<tr>
<th style="width: 3.25em" pResizableColumn></th>
<th style="width: 20em">Probe Key</th>
<th>Description</th>
<th style="width: 7em">Created at</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-probe>
<tr [pSelectableRow]="probe">
<td>
<p-tableRadioButton [value]="probe"></p-tableRadioButton>
</td>
<td>{{probe.data.tempProbeKey}}</td>
<td style="overflow: auto;">{{probe.meta.host.name}}</td>
<td>{{probe.data.createDate | date: 'dd/MM/yyyy'}}</td>
</tr>
</ng-template>
</p-table>
<div class="ui-top-space-10" dir="rtl">
<button [disabled]="!selected" class="ui-button-danger ui-button-width-fit" type="button" label="Deny" icon="ui-icon-close" pButton (click)="onAcceptOrDeny(false)"></button>
<button [disabled]="!selected" class=" ui-button-width-fit" type="button" label="Accept" icon="fa-check" pButton (click)="onAcceptOrDeny(true)"></button>
</div>
<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>

View File

@ -44,7 +44,6 @@ class NoauthProbeResult {
export class ListComponent implements OnInit, AfterContentInit {
noAuthProbes$ = this.store.pipe(select(NoAuthProbeSelector.select('noAuthProbes')));
noauthProbes: NoauthProbeResult[];
selected: NoAuthProbe = null;
msgs: Message[];
@ -93,7 +92,8 @@ export class ListComponent implements OnInit, AfterContentInit {
}
}
onAcceptOrDeny(isAccept: boolean) {
onAcceptOrDeny(isAccept: boolean, selected: NoAuthProbe) {
console.log(selected);
this.msgs = [];
const title = isAccept ?
'Are you sure to accept this Probe?' : 'Are you sure to deny this Probe';
@ -105,39 +105,18 @@ export class ListComponent implements OnInit, AfterContentInit {
message: message,
icon: isAccept ? 'fa-check' : 'fa fa-trash',
accept: () => {
isAccept ? this.handleAccept() : this.handleDeny();
this.msgs.push({ severity: 'error', summary: 'Failed', detail: '연동 안했지롱' });
isAccept ? this.handleAccept(selected) : this.handleDeny(selected);
},
reject: () => {
}
});
}
handleAccept() {
this.store.dispatch(new ListStore.Accept(this.selected));
this.noAuthProbes$.subscribe(
(noAuthProbes: NoAuthProbe[]) => {
if (noAuthProbes) {
this.msgs.push({ severity: 'success', summary: 'Success', detail: '개굿' });
}
},
(error: RPCClientError) => {
this.msgs.push({ severity: 'error', summary: 'Failed', detail: error.response.message });
}
);
handleAccept(selected) {
this.store.dispatch(new ListStore.Accept(selected));
}
handleDeny() {
this.store.dispatch(new ListStore.Deny(this.selected));
this.noAuthProbes$.subscribe(
(noAuthProbes: NoAuthProbe[]) => {
if (noAuthProbes) {
this.msgs.push({ severity: 'success', summary: 'Success', detail: '개굿' });
}
},
(error: RPCClientError) => {
this.msgs.push({ severity: 'error', summary: 'Failed', detail: error.response.message });
}
);
handleDeny(selected) {
this.store.dispatch(new ListStore.Deny(selected));
}
}