From 3b4bbd9c95f2fff7a8bc414390e281b9f42be826 Mon Sep 17 00:00:00 2001 From: insanity Date: Thu, 8 Mar 2018 15:25:57 +0900 Subject: [PATCH] target filter --- .../noauth/component/list/list.component.html | 2 +- .../component/detail/detail.component.html | 2 +- .../probe/component/list/list.component.html | 2 +- .../probe/component/list/list.component.ts | 5 +- src/packages/target/component/index.ts | 2 + .../list/filter/filter.component.html | 21 ++++++++ .../list/filter/filter.component.scss | 9 ++++ .../list/filter/filter.component.spec.ts | 25 +++++++++ .../component/list/filter/filter.component.ts | 17 +++++++ .../target/component/list/list.component.html | 51 +++++++------------ .../target/component/list/list.component.ts | 46 ++++++++--------- 11 files changed, 120 insertions(+), 62 deletions(-) create mode 100644 src/packages/target/component/list/filter/filter.component.html create mode 100644 src/packages/target/component/list/filter/filter.component.scss create mode 100644 src/packages/target/component/list/filter/filter.component.spec.ts create mode 100644 src/packages/target/component/list/filter/filter.component.ts diff --git a/src/packages/noauth/component/list/list.component.html b/src/packages/noauth/component/list/list.component.html index cba3b01..d84e594 100644 --- a/src/packages/noauth/component/list/list.component.html +++ b/src/packages/noauth/component/list/list.component.html @@ -26,7 +26,7 @@ Created At - {{element.createDate}} + {{element.createDate.toLocaleString()}} diff --git a/src/packages/probe/component/detail/detail.component.html b/src/packages/probe/component/detail/detail.component.html index 7992ad1..1fb8fc9 100644 --- a/src/packages/probe/component/detail/detail.component.html +++ b/src/packages/probe/component/detail/detail.component.html @@ -1,7 +1,7 @@

{{probeAlias}}

- Status: UP + Status: UP
diff --git a/src/packages/probe/component/list/list.component.html b/src/packages/probe/component/list/list.component.html index 422fbd3..f489401 100644 --- a/src/packages/probe/component/list/list.component.html +++ b/src/packages/probe/component/list/list.component.html @@ -40,6 +40,6 @@ - +
\ No newline at end of file diff --git a/src/packages/probe/component/list/list.component.ts b/src/packages/probe/component/list/list.component.ts index c994fb2..ab4e547 100644 --- a/src/packages/probe/component/list/list.component.ts +++ b/src/packages/probe/component/list/list.component.ts @@ -14,6 +14,9 @@ import { Domain } from '../../../domain/model'; }) export class ListComponent implements OnInit, AfterContentInit { + pageSize = '25'; + length = '100'; + displayedColumns = ['name', 'ip', 'os', 'cidr', 'targetCnt', 'date', 'authBy']; dataSource: MatTableDataSource; @ViewChild(MatSort) sort: MatSort; @@ -31,7 +34,7 @@ export class ListComponent implements OnInit, AfterContentInit { // temporary data const data: Probe[] = new Array(); - for (let i = 0; i < 10; i++) { + for (let i = 0; i < 100; i++) { const p: Probe = { id: i, displayName: String('displayName' + i), diff --git a/src/packages/target/component/index.ts b/src/packages/target/component/index.ts index 8898b9a..9e79653 100644 --- a/src/packages/target/component/index.ts +++ b/src/packages/target/component/index.ts @@ -1,7 +1,9 @@ import { DetailComponent } from './detail/detail.component'; import { ListComponent } from './list/list.component'; +import { FilterComponent } from './list/filter/filter.component'; export const COMPONENTS = [ ListComponent, DetailComponent, + FilterComponent ]; diff --git a/src/packages/target/component/list/filter/filter.component.html b/src/packages/target/component/list/filter/filter.component.html new file mode 100644 index 0000000..7833e71 --- /dev/null +++ b/src/packages/target/component/list/filter/filter.component.html @@ -0,0 +1,21 @@ +
+ + + +
+
+
Status
+ + All + Active + Inactive + +
+
+
Type
+ + All + Host + Application + +
\ No newline at end of file diff --git a/src/packages/target/component/list/filter/filter.component.scss b/src/packages/target/component/list/filter/filter.component.scss new file mode 100644 index 0000000..97910d9 --- /dev/null +++ b/src/packages/target/component/list/filter/filter.component.scss @@ -0,0 +1,9 @@ +.radio-group { + display: inline-flex; + flex-direction: column; + } + + .radio-button { + margin: 5px; + } + \ No newline at end of file diff --git a/src/packages/target/component/list/filter/filter.component.spec.ts b/src/packages/target/component/list/filter/filter.component.spec.ts new file mode 100644 index 0000000..fc30049 --- /dev/null +++ b/src/packages/target/component/list/filter/filter.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FilterComponent } from './filter.component'; + +describe('FilterComponent', () => { + let component: FilterComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ FilterComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(FilterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/packages/target/component/list/filter/filter.component.ts b/src/packages/target/component/list/filter/filter.component.ts new file mode 100644 index 0000000..2a9a63a --- /dev/null +++ b/src/packages/target/component/list/filter/filter.component.ts @@ -0,0 +1,17 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; + + +@Component({ + selector: 'of-target-filter', + templateUrl: './filter.component.html', + styleUrls: ['./filter.component.scss'] +}) +export class FilterComponent implements OnInit { + + + constructor(private router: Router) { } + + ngOnInit() { + } +} diff --git a/src/packages/target/component/list/list.component.html b/src/packages/target/component/list/list.component.html index c670bbe..2c0e619 100644 --- a/src/packages/target/component/list/list.component.html +++ b/src/packages/target/component/list/list.component.html @@ -1,49 +1,34 @@
-
- Filter Area +
+
-
+
+ + Status + ? + + + + Type + {{element.infraType.name}} + + Name - {{element.name}} + {{element.target.displayName}} - - IP - {{element.ip}} - - - - OS - {{element.os}} - - - - CIDR - {{element.cidr}} - - - - Targets - {{element.targetCnt}} - - - - Date - {{element.date}} - - - - AuthBy - {{element.authBy}} - + + Sensors + ? + diff --git a/src/packages/target/component/list/list.component.ts b/src/packages/target/component/list/list.component.ts index 005f86f..42bac62 100644 --- a/src/packages/target/component/list/list.component.ts +++ b/src/packages/target/component/list/list.component.ts @@ -2,17 +2,7 @@ import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core'; import { MatTableDataSource, MatSort } from '@angular/material'; import { AfterContentInit } from '@angular/core/src/metadata/lifecycle_hooks'; import { Router } from '@angular/router'; - -export interface Probe { - id: string; - name: string; - ip: string; - os: string; - cidr: string; - targetCnt: number; - date: string; - authBy: string; -} +import { Infra } from '../../../infra/model'; @Component({ @@ -22,8 +12,8 @@ export interface Probe { }) export class ListComponent implements OnInit, AfterContentInit { - displayedColumns = ['name', 'ip', 'os', 'cidr', 'targetCnt', 'date', 'authBy']; - dataSource: MatTableDataSource; + displayedColumns = ['status', 'type', 'name', 'sensors']; + dataSource: MatTableDataSource; @ViewChild(MatSort) sort: MatSort; /** @@ -32,19 +22,25 @@ export class ListComponent implements OnInit, AfterContentInit { */ ngAfterContentInit() { // temporary data - const data: Probe[] = new Array(); + const data: Infra[] = new Array(); for (let i = 0; i < 10; i++) { - const p: Probe = { - id: String(i), - name: String('name' + i), - ip: String('ip' + i), - os: String('os' + i), - cidr: String('cidr' + i), - targetCnt: i, - date: String('date' + i), - authBy: String('insanity') + const t: Infra = { + id: i, + infraType: { + id: 1, + name: 'Host' + }, + childId: 1, + createDate: new Date(), + probe: { + id: 1, + }, + target: { + id: 1, + displayName: 'Target Name' + } }; - data.push(p); + data.push(t); } this.dataSource = new MatTableDataSource(data); @@ -56,7 +52,7 @@ export class ListComponent implements OnInit, AfterContentInit { ngOnInit() { } - handleRowClick(obj: Probe) { + handleRowClick(obj: Infra) { this.router.navigate(['target', obj.id]); } }