diff --git a/src/app/pages/pages-routing.module.ts b/src/app/pages/pages-routing.module.ts index 6a579b1..9cddf6f 100644 --- a/src/app/pages/pages-routing.module.ts +++ b/src/app/pages/pages-routing.module.ts @@ -12,6 +12,7 @@ const routes: Routes = [ { path: 'probes', loadChildren: './probes/probes-page.module#ProbesPageModule' }, { path: 'probe', loadChildren: './probe/probe-page.module#ProbePageModule' }, { path: 'sensors', loadChildren: './sensors/sensors-page.module#SensorsPageModule' }, + { path: 'sensor', loadChildren: './sensor/sensor-page.module#SensorPageModule' }, { path: 'discovery', loadChildren: './discovery/discovery-page.module#DiscoveryPageModule' }, { path: 'map', loadChildren: './infra/infra-page.module#InfraPageModule' }, { path: 'sensor-setting', loadChildren: './sensor-setting/sensor-setting-page.module#SensorSettingPageModule' }, diff --git a/src/app/pages/sensor/sensor-page-routing.module.ts b/src/app/pages/sensor/sensor-page-routing.module.ts new file mode 100644 index 0000000..67c5f71 --- /dev/null +++ b/src/app/pages/sensor/sensor-page-routing.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { SensorPageComponent } from './sensor-page.component'; +import { DetailComponent } from 'packages/sensor/component/detail/detail.component'; + +const routes: Routes = [ + { + path: '', + component: SensorPageComponent, + children: [ + { path: ':id', component: DetailComponent }, + { path: ':id/history', component: null }, + ] + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class SensorPageRoutingModule { } diff --git a/src/app/pages/sensor/sensor-page.component.html b/src/app/pages/sensor/sensor-page.component.html new file mode 100644 index 0000000..975a544 --- /dev/null +++ b/src/app/pages/sensor/sensor-page.component.html @@ -0,0 +1,6 @@ +
+ +
+ +
+
\ No newline at end of file diff --git a/src/app/pages/sensor/sensor-page.component.scss b/src/app/pages/sensor/sensor-page.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/sensor/sensor-page.component.spec.ts b/src/app/pages/sensor/sensor-page.component.spec.ts new file mode 100644 index 0000000..8c96fd5 --- /dev/null +++ b/src/app/pages/sensor/sensor-page.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SensorPageComponent } from './sensor-page.component'; + +describe('SensorPageComponent', () => { + let component: SensorPageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SensorPageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SensorPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/sensor/sensor-page.component.ts b/src/app/pages/sensor/sensor-page.component.ts new file mode 100644 index 0000000..28cafbe --- /dev/null +++ b/src/app/pages/sensor/sensor-page.component.ts @@ -0,0 +1,25 @@ +import { Component, OnInit } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; + +@Component({ + selector: 'of-pages-sensor', + templateUrl: './sensor-page.component.html', + styleUrls: ['./sensor-page.component.scss'] +}) +export class SensorPageComponent implements OnInit { + + tabs = undefined; + + constructor(private route: ActivatedRoute, private router: Router) { + } + + ngOnInit() { + const id = this.router.url.split('sensor/')[1].split('/')[0]; + + this.tabs = [ + { label: 'Info', path: '/sensor/' + id }, + { label: 'History', path: '/sensor/' + id + '/history' }, + ]; + } + +} diff --git a/src/app/pages/sensor/sensor-page.module.ts b/src/app/pages/sensor/sensor-page.module.ts new file mode 100644 index 0000000..f2f52d7 --- /dev/null +++ b/src/app/pages/sensor/sensor-page.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { MaterialModule } from 'app/commons/ui/material/material.module'; +import { SubMenubarModule } from 'app/commons/component/sub-menubar/sub-menubar.module'; +import { SensorPageComponent } from './sensor-page.component'; +import { SensorModule } from 'packages/sensor/sensor.module'; +import { SensorPageRoutingModule } from './sensor-page-routing.module'; + +@NgModule({ + imports: [ + CommonModule, + SensorPageRoutingModule, + MaterialModule, + SensorModule, + SubMenubarModule, + ], + declarations: [ + SensorPageComponent, + ] +}) +export class SensorPageModule { } diff --git a/src/packages/probe/component/detail/detail.component.html b/src/packages/probe/component/detail/detail.component.html index 1fb8fc9..c9f0c55 100644 --- a/src/packages/probe/component/detail/detail.component.html +++ b/src/packages/probe/component/detail/detail.component.html @@ -12,12 +12,12 @@
- + - + - +
\ No newline at end of file diff --git a/src/packages/probe/component/detail/detail.component.ts b/src/packages/probe/component/detail/detail.component.ts index b700ec8..18b82b3 100644 --- a/src/packages/probe/component/detail/detail.component.ts +++ b/src/packages/probe/component/detail/detail.component.ts @@ -14,22 +14,52 @@ export class DetailComponent implements OnInit { probeId = undefined; isUpState = false; - data = [ + networkInfo = [ { - key: 'key1', - value: 'this is value' + key: 'IP', + value: '192.168.1.1' }, { - key: 'key2', - value: 'this is value' + key: 'NIC', + value: 'enps30' }, { - key: 'key3', - value: 'this is value' + key: 'Targets', + value: '12' + }, + ]; + + deviceInfo = [ + { + key: 'OS', + value: 'Linux' }, { - key: 'key4', - value: 'this is value' + key: 'CPU', + value: 'intel7...' + }, + { + key: 'Memory', + value: '16GB' + }, + { + key: '...', + value: '...' + }, + ]; + + probeInfo = [ + { + key: 'Authorized at', + value: String(new Date()) + }, + { + key: 'Authorized by', + value: 'insanity' + }, + { + key: 'Installed at', + value: String(new Date()) }, ]; @@ -57,11 +87,6 @@ export class DetailComponent implements OnInit { } }); - // const dialogRef = this.dialog.open(RemoveWarningComponent, { - // width: '250px', - // data: { } - // }); - dialogRef.afterClosed().subscribe(confirmed => { if (confirmed) { console.log('confirmed'); diff --git a/src/packages/sensor/component/detail/detail.component.html b/src/packages/sensor/component/detail/detail.component.html new file mode 100644 index 0000000..7592354 --- /dev/null +++ b/src/packages/sensor/component/detail/detail.component.html @@ -0,0 +1 @@ +

Sensor Detail

\ No newline at end of file diff --git a/src/packages/sensor/component/detail/detail.component.scss b/src/packages/sensor/component/detail/detail.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/packages/sensor/component/detail/detail.component.spec.ts b/src/packages/sensor/component/detail/detail.component.spec.ts new file mode 100644 index 0000000..149b9be --- /dev/null +++ b/src/packages/sensor/component/detail/detail.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DetailComponent } from './detail.component'; + +describe('DetailComponent', () => { + let component: DetailComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DetailComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DetailComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/packages/sensor/component/detail/detail.component.ts b/src/packages/sensor/component/detail/detail.component.ts new file mode 100644 index 0000000..aa37841 --- /dev/null +++ b/src/packages/sensor/component/detail/detail.component.ts @@ -0,0 +1,22 @@ +import { Component, OnInit, Inject } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; +import { ConfirmDialogComponent } from 'app/commons/component/confirm-dialog/confirm-dialog.component'; + +@Component({ + selector: 'of-sensor-detail', + templateUrl: './detail.component.html', + styleUrls: ['./detail.component.scss'] +}) +export class DetailComponent implements OnInit { + + constructor( + private route: ActivatedRoute, + private router: Router, + public dialog: MatDialog, + ) { } + + ngOnInit() { + } +} + diff --git a/src/packages/sensor/component/index.ts b/src/packages/sensor/component/index.ts index ccb2864..840a72b 100644 --- a/src/packages/sensor/component/index.ts +++ b/src/packages/sensor/component/index.ts @@ -2,10 +2,12 @@ import { DiscoverySettingComponent } from './setting/setting.component'; import { SettingResultComponent } from './setting-result/setting-result.component'; import { FilterComponent } from './list/filter/filter.component'; import { ListComponent } from './list/list.component'; +import { DetailComponent } from './detail/detail.component'; export const COMPONENTS = [ DiscoverySettingComponent, SettingResultComponent, ListComponent, - FilterComponent + FilterComponent, + DetailComponent, ]; diff --git a/src/packages/target/component/detail/detail.component.html b/src/packages/target/component/detail/detail.component.html index 46a51e7..1f785a3 100644 --- a/src/packages/target/component/detail/detail.component.html +++ b/src/packages/target/component/detail/detail.component.html @@ -29,19 +29,19 @@

Sensors

- + SensorType - {{element.sensorType}} + {{element.crawler.name}} Items - {{element.itemCnt}} items + {{element.itemCount}} items Status - {{element.status}} + {{element.status.name}} diff --git a/src/packages/target/component/detail/detail.component.ts b/src/packages/target/component/detail/detail.component.ts index fa83ecc..a812c7e 100644 --- a/src/packages/target/component/detail/detail.component.ts +++ b/src/packages/target/component/detail/detail.component.ts @@ -1,6 +1,8 @@ import { Component, ViewChild, OnInit, Input } from '@angular/core'; import { MatPaginator, MatTableDataSource } from '@angular/material'; import { AfterContentInit, AfterViewInit } from '@angular/core/src/metadata/lifecycle_hooks'; +import { Sensor } from '../../../sensor/model'; +import { Router } from '@angular/router'; @Component({ selector: 'of-target-detail', @@ -9,8 +11,8 @@ import { AfterContentInit, AfterViewInit } from '@angular/core/src/metadata/life }) export class DetailComponent implements OnInit, AfterViewInit, AfterContentInit { - displayedColumns = ['sensorType', 'itemCnt', 'status']; - sensors: MatTableDataSource = null; + displayedColumns = ['crawler', 'itemCnt', 'status']; + sensors: MatTableDataSource = null; @ViewChild(MatPaginator) paginator: MatPaginator; basicInfo = [ @@ -50,7 +52,7 @@ export class DetailComponent implements OnInit, AfterViewInit, AfterContentInit }, ]; - constructor() { } + constructor(private router: Router) { } ngOnInit() { } @@ -60,23 +62,37 @@ export class DetailComponent implements OnInit, AfterViewInit, AfterContentInit } ngAfterContentInit() { - const sensors = [ + const temporaryData: Sensor[] = [ { - sensorType: 'WMI', - itemCnt: '5', - status: 'Up', + id: 0, + crawler: { + id: 0, + name: 'WMI', + }, + status: { + id: 0, + name: 'UP' + }, + itemCount: 5, }, { - sensorType: 'SSH', - itemCnt: '5', - status: 'Up', + id: 1, + crawler: { + id: 0, + name: 'SSH', + }, + status: { + id: 0, + name: 'UP' + }, + itemCount: 5, }, ]; - this.sensors = new MatTableDataSource(sensors); + this.sensors = new MatTableDataSource(temporaryData); } - handleSensorClick(row: any) { - console.log(row); + handleSensorClick(sensor: Sensor) { + this.router.navigate(['sensor', sensor.id]); } handleCheckAlive() {