This commit is contained in:
insanity 2018-04-18 18:28:54 +09:00
parent 5adeb5e411
commit c57f1193f3
4 changed files with 41 additions and 37 deletions

View File

@ -6,8 +6,6 @@
</p-dialog>
<button type="button" label="Add Sensor" icon="ui-icon-add" pButton class="ui-button-width-fit" (click)="onAddSensor()"></button>
<button type="button" label="Add Sensor with Target(temp)" icon="ui-icon-add" pButton class="ui-button-width-fit" (click)="onAddSensorWithTarget()"></button>
<button type="button" label="Add Sensor with Target2(temp)" icon="ui-icon-add" pButton class="ui-button-width-fit" (click)="onAddSensorWithTarget2()"></button>
</div>
<div class="ui-g">
@ -17,7 +15,7 @@
<h3>Search</h3>
<div class="ui-g-12 ui-inputgroup ui-bottom-space-10">
<span class="md-inputfield">
<input type="text" pInputText>
<input type="text" pInputText [(ngModel)]="filteredName">
<label>IP or Application name</label>
</span>
</div>
@ -29,10 +27,10 @@
<div class="ui-g-6">
<p-checkbox name="cg" value="Active" label="Active" [(ngModel)]="checkboxValues"></p-checkbox>
<p-checkbox name="cg" value="Active" label="Active" [(ngModel)]="selectedStatus"></p-checkbox>
</div>
<div class="ui-g-6">
<p-checkbox name="cg" value="Inactive" label="Inactive" [(ngModel)]="checkboxValues"></p-checkbox>
<p-checkbox name="cg" value="Inactive" label="Inactive" [(ngModel)]="selectedStatus"></p-checkbox>
</div>
<button pButton type="button" label="Search" class="ui-button-secondary ui-top-space-10" (click)="onSearch()"></button>
</div>
@ -52,7 +50,7 @@
<a href="javascript:void(0)" (click)="onSensorClick(sensor)">{{sensor.crawler.name}} | {{sensor.itemCount}} items | {{sensor.status.name}}</a>
</div>
</div>
<!-- <button type="button" pButton icon="ui-icon-search" style="margin:24px 24px 0 0;float:right"></button> -->
<button type="button" pButton icon="ui-icon-add" style="margin:24px 24px 0 0;float:right" (click)="onAddSensorWithTarget(item.target)"></button>
</div>
</ng-template>
</p-dataList>

View File

@ -36,7 +36,10 @@ export class ListComponent implements OnInit, AfterContentInit {
// filter
targetOptions: SelectItem[];
filteredName: string;
selectedTargets: string[] = [];
selectedStatus: string[] = [];
constructor(private router: Router,
private store: Store<ListStore.State>,
@ -127,6 +130,11 @@ export class ListComponent implements OnInit, AfterContentInit {
this.sensorSettingDisplay = true;
}
onAddSensorWithTarget(target: Target) {
this.target = target;
this.sensorSettingDisplay = true;
}
onSensorSettingClose() {
this.sensorSettingDisplay = false;
}
@ -135,31 +143,11 @@ export class ListComponent implements OnInit, AfterContentInit {
}
onSearch() {
console.log(this.filteredName);
console.log(this.selectedTargets);
console.log(this.selectedStatus);
alert('서버-검색 기능 구현 필요');
}
// Test
onAddSensorWithTarget() {
this.target = {
id: 1,
createDate: new Date(),
displayName: 'Alredy selected target111',
description: 'Desc..',
};
this.sensorSettingDisplay = true;
}
onAddSensorWithTarget2() {
this.target = {
id: 2,
createDate: new Date(),
displayName: 'Alredy selected target222',
description: 'Desc..',
};
this.sensorSettingDisplay = true;
}
}

View File

@ -1,8 +1,9 @@
<h1>Targets</h1>
<p-table [value]="infras" selectionMode="single" (onRowSelect)="onRowSelect($event)" [resizableColumns]="true">
<ng-template pTemplate="header">
<p-table [value]="infras" selectionMode="single" (onRowSelect)="onRowSelect($event)" [resizableColumns]="true" dataKey="id">
<ng-template pTemplate="header" let-columns>
<tr>
<th style="width: 3.5em"></th>
<th style="width: 4em">No.</th>
<th style="width: 8em">Status</th>
<th style="width: 8em">Type</th>
@ -12,8 +13,13 @@
<th style="width: 10em"></th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-infra let-rowIndex="rowIndex">
<tr [pSelectableRow]="infra">
<ng-template pTemplate="body" let-infra let-rowIndex="rowIndex" let-expanded="expanded" let-columns="infras">
<tr>
<td>
<a href="javascript:void(0)" [pRowToggler]="infra">
<i [ngClass]="expanded ? 'fa fa-fw fa-chevron-circle-down' : 'fa fa-fw fa-chevron-circle-right'"></i>
</a>
</td>
<td>{{rowIndex}}</td>
<td>??</td>
<td>{{infra.infraType.name}}</td>
@ -21,12 +27,23 @@
<td>??</td>
<td>{{infra.createDate | date: 'dd.MM.yyyy'}}</td>
<td>
<button type="button" label="AddSensor" icon="ui-icon-add" pButton class="ui-s-button" (click)="onAddSensor(infra.target)"></button>
<button type="button" label="Add Sensor" icon="ui-icon-add" pButton class="ui-s-button" (click)="onAddSensor(infra.target)"></button>
</td>
</tr>
</ng-template>
<ng-template pTemplate="rowexpansion" let-rowData let-columns="infras">
<tr>
<td [attr.colspan]="8">
<div class="ui-g ui-fluid" style="font-size:16px;padding:20px">
<div>요기다가 센서 리스트와 상태 출력</div>
</div>
</td>
</tr>
</ng-template>
</p-table>
<p-dialog [modal]="true" [width]="800" [(visible)]="sensorSettingDisplay" [showHeader]="false" [closeOnEscape]="false">
<of-sensor-setting [visible]="sensorSettingDisplay" [preTarget]="target" (close)="onSensorSettingClose()"></of-sensor-setting>
</p-dialog>
</p-dialog>

View File

@ -124,7 +124,8 @@ export class ListComponent implements OnInit, AfterContentInit {
}
onRowSelect(event) {
console.log(event.data);
console.log(event.data.target);
// this.router.navigate(['notification']);
}
onAddSensor(target: Target) {