diff --git a/src/packages/sensor/model/Sensor.ts b/src/packages/sensor/model/Sensor.ts
index 8f28d9d..f7eb7fe 100644
--- a/src/packages/sensor/model/Sensor.ts
+++ b/src/packages/sensor/model/Sensor.ts
@@ -11,4 +11,5 @@ export interface Sensor {
crawler?: MetaCrawler;
crawlerInputItems?: string;
itemCount?: number;
+ displayName?: string;
}
diff --git a/src/packages/target/component/detail/detail.component.html b/src/packages/target/component/detail/detail.component.html
index 88a87d2..8b85d86 100644
--- a/src/packages/target/component/detail/detail.component.html
+++ b/src/packages/target/component/detail/detail.component.html
@@ -1,4 +1,3 @@
-
Sensors
@@ -41,25 +40,24 @@
- No. |
- Description |
+ Alias |
Status |
Crawler |
Items |
Created at |
-
+
- {{rowIndex + 1}} |
- {{sensor.Description}} |
+ {{sensor.displayName}} |
{{sensor.status.name}} |
{{sensor.crawler.name}} |
- ??? |
+ {{sensor.itemCount}} |
{{sensor.createDate | date: 'dd.MM.yyyy'}} |
+
\ No newline at end of file
diff --git a/src/packages/target/component/detail/detail.component.ts b/src/packages/target/component/detail/detail.component.ts
index 61c4f4b..712ccb6 100644
--- a/src/packages/target/component/detail/detail.component.ts
+++ b/src/packages/target/component/detail/detail.component.ts
@@ -10,6 +10,7 @@ import { RPCClientError } from '@loafer/ng-rpc/protocol';
import { sensorListSelector } from 'packages/sensor/store';
import * as SensorListStore from 'packages/sensor/store/list';
+import { PageParams, Page } from 'app/commons/model';
@Component({
@@ -23,9 +24,16 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
sensorsSubscription$: Subscription;
sensors$ = this.sensorListStore.pipe(select(sensorListSelector.select('page')));
+ infraId = null;
infra: Infra;
+ sensors: Sensor[];
+ sensorsCount = 0;
sensorSettingDisplay = false;
+ pageSize = '10';
+ totalLength = 0;
+ currPage = 0;
+
constructor(
private router: Router,
private route: ActivatedRoute,
@@ -42,15 +50,23 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
console.log(error.response.message);
}
);
+ this.sensorsSubscription$ = this.sensors$.subscribe(
+ (page: Page) => {
+ if (page) {
+ this.sensorsCount = page.totalElements;
+ this.sensors = page.content;
+ }
+ },
+ (error: RPCClientError) => {
+ console.log(error.response.message);
+ }
+ );
}
ngAfterContentInit() {
- const infraId = this.route.snapshot.paramMap.get('id');
- this.infraDetailStore.dispatch(
- new InfraDetailStore.Read(
- { id: infraId }
- )
- );
+ this.infraId = this.route.snapshot.paramMap.get('id');
+ this.getInfra();
+ this.getSensors(this.currPage);
}
ngOnDestroy() {
@@ -59,6 +75,28 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
}
}
+ getInfra() {
+ this.infraDetailStore.dispatch(
+ new InfraDetailStore.Read(
+ { id: this.infraId }
+ )
+ );
+ }
+
+ getSensors(pageIndex) {
+ const pageParams: PageParams = {
+ pageNo: pageIndex + '',
+ countPerPage: this.pageSize,
+ sortCol: 'id',
+ sortDirection: 'descending'
+ };
+ this.sensorListStore.dispatch(
+ new SensorListStore.ReadAllByInfra(
+ { id: this.infraId, pageParams: pageParams }
+ )
+ );
+ }
+
onAddSensor() {
this.sensorSettingDisplay = true;
}
@@ -67,4 +105,8 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
this.sensorSettingDisplay = false;
}
+ onPaging(e) {
+ this.getSensors(e.page);
+}
+
}