diff --git a/@overflow/discovery/component/setting/probe-selector/probe-selector.component.html b/@overflow/discovery/component/discovery/probe-selector/probe-selector.component.html similarity index 100% rename from @overflow/discovery/component/setting/probe-selector/probe-selector.component.html rename to @overflow/discovery/component/discovery/probe-selector/probe-selector.component.html diff --git a/@overflow/discovery/component/setting/probe-selector/probe-selector.component.ts b/@overflow/discovery/component/discovery/probe-selector/probe-selector.component.ts similarity index 83% rename from @overflow/discovery/component/setting/probe-selector/probe-selector.component.ts rename to @overflow/discovery/component/discovery/probe-selector/probe-selector.component.ts index 3a3f0fa..2bd6417 100644 --- a/@overflow/discovery/component/setting/probe-selector/probe-selector.component.ts +++ b/@overflow/discovery/component/discovery/probe-selector/probe-selector.component.ts @@ -4,13 +4,9 @@ import { } from '@angular/core'; import { Store, select, StateObservable } from '@ngrx/store'; import { RPCClientError } from '@loafer/ng-rpc'; -// import * as ListStore from '@overflow/probe/store/list'; -// import { ListSelector } from '@overflow/probe/store'; + import { Subscription } from 'rxjs/Subscription'; import { Probe } from '@overflow/commons-typescript/model/probe'; -import { AuthSelector } from '@overflow/member/store'; -import { Domain } from '@overflow/commons-typescript/model/domain'; -import { Dropdown } from 'primeng/primeng'; @Component({ selector: 'of-probe-selector', @@ -33,7 +29,7 @@ export class ProbeSelectorComponent implements OnInit, AfterContentInit, OnDestr } ngOnInit() { - this.probesSubscription$ = this.probes$.subscribe( + this.probesSubscription$ = this.probes$.subscribe ( (list: Probe[]) => { if (list !== null) { this.probes = list; diff --git a/@overflow/discovery/component/discovery/search-config/ip-input.component.html b/@overflow/discovery/component/discovery/search-config/ip-input.component.html new file mode 100644 index 0000000..3556f0f --- /dev/null +++ b/@overflow/discovery/component/discovery/search-config/ip-input.component.html @@ -0,0 +1,12 @@ + +
+ {{title}} + + . + + . + + . + +
+ diff --git a/@overflow/discovery/component/discovery/search-config/ip-input.component.ts b/@overflow/discovery/component/discovery/search-config/ip-input.component.ts new file mode 100644 index 0000000..d05b3fe --- /dev/null +++ b/@overflow/discovery/component/discovery/search-config/ip-input.component.ts @@ -0,0 +1,56 @@ +import { + AfterContentInit, + Component, + EventEmitter, + Input, + Output, + OnInit, +} from '@angular/core'; + +@Component({ + selector: 'of-ip-input', + templateUrl: './ip-input.component.html', +}) +export class IpInputComponent implements OnInit, AfterContentInit { + + first: string; + second: string; + third: string; + fourth: string; + + @Input() hostIp; + @Input() title; + @Output() inputIp = new EventEmitter(); + + constructor( + ) { + } + + ngOnInit() { + if (this.hostIp !== '' && this.hostIp !== null && this.hostIp !== undefined) { + const tempIp = this.hostIp.split('.'); + + this.first = tempIp[0]; + this.second = tempIp[1]; + this.third = tempIp[2]; + this.fourth = tempIp[3]; + } + } + + ngAfterContentInit() { + } + + onIpInput(event) { + if ( + (this.first !== '' && this.first !== undefined) && + (this.second !== '' && this.second !== undefined) && + (this.third !== '' && this.third !== undefined) && + (this.fourth !== '' && this.fourth !== undefined) ) { + event.target.data = this.first + '.' + this.second + '.' + this.third + '.' + this.fourth; + this.inputIp.emit(event); + } else { + return; + } + } + +} diff --git a/@overflow/discovery/component/discovery/search-config/search-config.component.html b/@overflow/discovery/component/discovery/search-config/search-config.component.html index 97f4153..69e417e 100644 --- a/@overflow/discovery/component/discovery/search-config/search-config.component.html +++ b/@overflow/discovery/component/discovery/search-config/search-config.component.html @@ -5,7 +5,7 @@
- +
@@ -24,40 +24,13 @@
-
- Start - - . - - . - - . - -
+
-
- End - - . - - . - - . - -
+
-
- Exclud - - . - - . - - . - -
+
@@ -70,7 +43,7 @@
- +
@@ -85,12 +58,12 @@ - +
- +
diff --git a/@overflow/discovery/component/discovery/search-config/search-config.component.ts b/@overflow/discovery/component/discovery/search-config/search-config.component.ts index 24b6c5c..19cca17 100644 --- a/@overflow/discovery/component/discovery/search-config/search-config.component.ts +++ b/@overflow/discovery/component/discovery/search-config/search-config.component.ts @@ -16,6 +16,8 @@ export class SearchConfigComponent implements OnInit, AfterContentInit { @Output() discoverySearchStartClick = new EventEmitter(); @Output() selectProbe = new EventEmitter(); + includeServices = []; + discoveryFormGroup: FormGroup; ipVesion: number; @@ -28,6 +30,12 @@ export class SearchConfigComponent implements OnInit, AfterContentInit { endPort: string; excludePort: string; + probe: number; + + startHostIp: string; + endHostIp: string; + excludeHostIp: string; + constructor( private formBuilder: FormBuilder, ) { @@ -37,6 +45,7 @@ export class SearchConfigComponent implements OnInit, AfterContentInit { this.ipVesion = 0; this.portType = 0; this.initForm(); + // this.hostIp = '192.168.1.10'; } ngAfterContentInit() { @@ -56,4 +65,9 @@ export class SearchConfigComponent implements OnInit, AfterContentInit { console.log(probe); this.selectProbe.emit(probe); } + + onInputIP(event, idx) { + console.log(idx); + console.log(event.target.data); + } } diff --git a/@overflow/discovery/component/discovery/search-filter/search-filter.component.html b/@overflow/discovery/component/discovery/search-filter/search-filter.component.html index ffa9f93..2906917 100644 --- a/@overflow/discovery/component/discovery/search-filter/search-filter.component.html +++ b/@overflow/discovery/component/discovery/search-filter/search-filter.component.html @@ -4,28 +4,10 @@
-
- Start - - . - - . - - . - -
+
-
- End - - . - - . - - . - -
+
diff --git a/@overflow/discovery/component/discovery/search-filter/search-filter.component.ts b/@overflow/discovery/component/discovery/search-filter/search-filter.component.ts index da235cd..98837d6 100644 --- a/@overflow/discovery/component/discovery/search-filter/search-filter.component.ts +++ b/@overflow/discovery/component/discovery/search-filter/search-filter.component.ts @@ -9,6 +9,8 @@ import { }) export class SearchFilterComponent implements OnInit, AfterContentInit { + startHostIp: string; + endHostIp: string; constructor( ) { @@ -19,4 +21,8 @@ export class SearchFilterComponent implements OnInit, AfterContentInit { ngAfterContentInit() { } + + onInputIP(event, idx) { + + } } diff --git a/@overflow/discovery/component/setting/filter/service-selector/service-selector.component.html b/@overflow/discovery/component/discovery/service-selector/service-selector.component.html similarity index 100% rename from @overflow/discovery/component/setting/filter/service-selector/service-selector.component.html rename to @overflow/discovery/component/discovery/service-selector/service-selector.component.html diff --git a/@overflow/discovery/component/setting/filter/service-selector/service-selector.component.ts b/@overflow/discovery/component/discovery/service-selector/service-selector.component.ts similarity index 90% rename from @overflow/discovery/component/setting/filter/service-selector/service-selector.component.ts rename to @overflow/discovery/component/discovery/service-selector/service-selector.component.ts index 01b1577..16cf53a 100644 --- a/@overflow/discovery/component/setting/filter/service-selector/service-selector.component.ts +++ b/@overflow/discovery/component/discovery/service-selector/service-selector.component.ts @@ -1,4 +1,12 @@ -import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy } from '@angular/core'; +import { + Component, + OnInit, + Input, + AfterContentInit, + Output, + EventEmitter, + OnDestroy +} from '@angular/core'; import { Store, select, StateObservable } from '@ngrx/store'; import { RPCClientError } from '@loafer/ng-rpc'; import * as ListStore from '@overflow/meta/crawler/store/list'; @@ -18,8 +26,6 @@ export class ServiceSelectorComponent implements OnInit, AfterContentInit, OnDes @Output() crawlerSelected = new EventEmitter(); @Input() includeServices; - @Input() disabled: boolean; - constructor( private listStore: Store, ) { diff --git a/@overflow/discovery/component/index.ts b/@overflow/discovery/component/index.ts index ede4b22..0d18f7e 100644 --- a/@overflow/discovery/component/index.ts +++ b/@overflow/discovery/component/index.ts @@ -1,23 +1,17 @@ -import { SettingComponent } from './setting/setting.component'; -import { ProbeSelectorComponent } from './setting/probe-selector/probe-selector.component'; -import { ServiceSelectorComponent } from './setting/filter/service-selector/service-selector.component'; -import { FilterComponent } from './setting/filter/filter.component'; -import { ResultComponent } from './setting/result/result.component'; -import { FilterSummaryComponent } from './setting/filter-summary/filter-summary.component'; +import { ProbeSelectorComponent } from './discovery/probe-selector/probe-selector.component'; +import { ServiceSelectorComponent } from './discovery/service-selector/service-selector.component'; import { DiscoveryComponent } from './discovery/discovery.component'; import { SearchConfigComponent } from './discovery/search-config/search-config.component'; import { SearchFilterComponent } from './discovery/search-filter/search-filter.component'; import { SearchResultComponent } from './discovery/search-result/search-result.component'; +import { IpInputComponent } from './discovery/search-config/ip-input.component'; export const COMPONENTS = [ - SettingComponent, - FilterComponent, ServiceSelectorComponent, ProbeSelectorComponent, - ResultComponent, - FilterSummaryComponent, DiscoveryComponent, SearchConfigComponent, SearchFilterComponent, - SearchResultComponent + SearchResultComponent, + IpInputComponent ]; diff --git a/@overflow/discovery/component/setting/filter-summary/filter-summary.component.html b/@overflow/discovery/component/setting/filter-summary/filter-summary.component.html deleted file mode 100644 index 13f3ef0..0000000 --- a/@overflow/discovery/component/setting/filter-summary/filter-summary.component.html +++ /dev/null @@ -1,11 +0,0 @@ -
- - - - TCP - - - UDP - - -
\ No newline at end of file diff --git a/@overflow/discovery/component/setting/filter-summary/filter-summary.component.ts b/@overflow/discovery/component/setting/filter-summary/filter-summary.component.ts deleted file mode 100644 index 712cea5..0000000 --- a/@overflow/discovery/component/setting/filter-summary/filter-summary.component.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy, OnChanges, SimpleChanges } from '@angular/core'; -import { DiscoverZone } from '@overflow/commons-typescript/model/discovery'; - -@Component({ - selector: 'of-discovery-filter-summary', - templateUrl: './filter-summary.component.html', -}) -export class FilterSummaryComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges { - - @Output() click = new EventEmitter(); - @Input() data: DiscoverZone; - - private hostRange: string; - private portRange: string; - private includeTCP: boolean; - private includeUDP: boolean; - private services: string; - - constructor( - ) { - this.services = ''; - } - - ngOnInit() { - } - - ngAfterContentInit() { - } - - ngOnChanges(changes: SimpleChanges): void { - if (!this.data) { - return; - } - this.hostRange = this.data.discoverHost.firstScanRangev4 + ' ~ ' + this.data.discoverHost.lastScanRangev4; - if (this.data.discoverHost.discoverPort) { - this.portRange = this.data.discoverHost.discoverPort.firstScanRange + ' ~ ' + this.data.discoverHost.discoverPort.lastScanRange; - this.includeTCP = this.data.discoverHost.discoverPort.includeTCP; - this.includeUDP = this.data.discoverHost.discoverPort.includeUDP; - } - - if (this.data.discoverHost.discoverPort.discoverService) { - const services = this.data.discoverHost.discoverPort.discoverService.includeServices; - if (services.length > 3) { - this.services = String(services.length) + ' services selected.'; - return; - } - for (const service of services) { - this.services += service; - } - } - } - - ngOnDestroy() { - } - - onClick() { - this.click.emit(); - } -} diff --git a/@overflow/discovery/component/setting/filter/filter.component.html b/@overflow/discovery/component/setting/filter/filter.component.html deleted file mode 100644 index 51eb2cb..0000000 --- a/@overflow/discovery/component/setting/filter/filter.component.html +++ /dev/null @@ -1,66 +0,0 @@ -
-
-
-
- -
-
- -
-
- - - - -
-
- - - - -
-
- - -
-
- -
-
-
- TCP   - -
-
- UDP   - -
-
-
- -
-
- - - - -
- -
- - - - -
-
- -
-
- -
- - - -
-
-
\ No newline at end of file diff --git a/@overflow/discovery/component/setting/filter/filter.component.ts b/@overflow/discovery/component/setting/filter/filter.component.ts deleted file mode 100644 index d101bbb..0000000 --- a/@overflow/discovery/component/setting/filter/filter.component.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy, OnChanges, SimpleChanges } from '@angular/core'; -import * as CIDR from 'ip-cidr'; -import { Probe } from '@overflow/commons-typescript/model/probe'; -import { DiscoverZone, DiscoverPort, DiscoverService } from '@overflow/commons-typescript/model/discovery'; - -@Component({ - selector: 'of-discovery-filter', - templateUrl: './filter.component.html', -}) -export class FilterComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges { - - @Input() probe: Probe; - @Input() requestStart: boolean; - @Output() discoveryRequested = new EventEmitter(); - - private startIP: string; - private endIP: string; - private startPort: string; - private endPort: string; - private includeServices = []; - - private hostChecked = true; - private portChecked = true; - private serviceChecked = true; - private tcpChecked = true; - private udpChecked = true; - - constructor( - ) { - } - - ngOnInit() { - } - - ngAfterContentInit() { - } - - ngOnDestroy() { - } - - hostRange() { - if (!this.probe || this.probe === undefined) { - return; - } - const cidr = new CIDR(this.probe.cidr); - if (!cidr.isValid()) { - alert('Invalid cidr : ' + this.probe.cidr); - return; - } - this.startIP = cidr.addressStart.address; - this.endIP = cidr.addressEnd.address; - } - - portRange() { - this.startPort = '1'; - this.endPort = '1024'; - } - - ngOnChanges(changes: SimpleChanges): void { - if (changes['probe']) { - this.hostRange(); - this.portRange(); - } - if (changes['requestStart'] && this.requestStart) { - this.onStart(); - } - } - - onPortCheckChange(serviceCheckbox, checked) { - if (!checked) { - serviceCheckbox.checked = false; - this.serviceChecked = false; - } - } - - onServiceCheckChange(portCheckbox, checked) { - if (checked) { - portCheckbox.checked = true; - this.portChecked = true; - } - } - - onStart() { - let discoverPort: DiscoverPort = null; - let discoverService: DiscoverService = null; - - if (this.serviceChecked) { - const services = new Array(); - for (const service of this.includeServices) { - services.push(service.description); // FIXME to const name - } - discoverService = { - includeServices: services, - }; - } - if (this.portChecked) { - discoverPort = { - firstScanRange: Number(this.startPort), - lastScanRange: Number(this.endPort), - includeTCP: this.tcpChecked, - includeUDP: this.udpChecked, - excludePorts: null, - discoverService: discoverService - }; - } - const discoverZone: DiscoverZone = { - discoverHost: { - firstScanRangev4: this.startIP, - lastScanRangev4: this.endIP, - discoverPort: discoverPort - }, - }; - - this.discoveryRequested.emit(discoverZone); - } -} diff --git a/@overflow/discovery/component/setting/result/result.component.1.ts b/@overflow/discovery/component/setting/result/result.component.1.ts deleted file mode 100644 index 83f762a..0000000 --- a/@overflow/discovery/component/setting/result/result.component.1.ts +++ /dev/null @@ -1,190 +0,0 @@ -import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy } from '@angular/core'; -import { Store, select, StateObservable } from '@ngrx/store'; -import { RPCClientError } from '@loafer/ng-rpc'; -import { Subscription } from 'rxjs/Subscription'; -import { TreeNode } from 'primeng/primeng'; - -import * as DiscoveredStore from '@overflow/discovery/store/setting'; -import { SettingSelector, DiscoverSelector } from '@overflow/discovery/store'; -import * as DiscoverStore from '@overflow/discovery/store/discover'; -import * as RegistStore from '@overflow/discovery/store/regist'; - -import { Zone } from '@overflow/commons-typescript/model/discovery'; -import { Host } from '@overflow/commons-typescript/model/discovery'; -import { Port } from '@overflow/commons-typescript/model/discovery'; -import { Service } from '@overflow/commons-typescript/model/discovery'; - -@Component({ - selector: 'of-discovery-result', - templateUrl: './result.component.html', -}) -export class ResultComponent implements OnInit, AfterContentInit, OnDestroy { - - treeNodes = []; - selectedNodes = []; - zones: Map = null; - checkedSet = new Set(); - - resultSubscription$: Subscription; - result$: any; - startedSubscription$: Subscription; - started$: any; - endedSubscription$: Subscription; - ended$: any; - - inProgress = false; - - - selectedDiscoveryResult: TreeNode[]; - - constructor( - private discoverdStore: Store, - private discoverStore: Store, - private registStore: Store, - ) { - this.result$ = discoverStore.pipe(select(DiscoverSelector.select('zones'))); - this.started$ = discoverStore.pipe(select(DiscoverSelector.select('isStart'))); - this.ended$ = discoverStore.pipe(select(DiscoverSelector.select('isEnd'))); - } - - ngOnInit() { - this.resultSubscription$ = this.result$.subscribe( - (zones: Map) => { - if (zones !== undefined && zones !== null) { - console.log(zones); - this.treeNodes = this.convertTreeViewZone(zones); - this.zones = zones; - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); - this.startedSubscription$ = this.started$.subscribe( - (isStart: boolean) => { - if (isStart !== undefined && isStart !== null && isStart) { - this.inProgress = true; - console.log('##Discovery has started.##'); - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); - this.endedSubscription$ = this.ended$.subscribe( - (isEnd: boolean) => { - if (isEnd !== undefined && isEnd !== null && isEnd) { - console.log('##Discovery has done.##'); - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); - } - - ngAfterContentInit() { - } - - ngOnDestroy() { - if (this.startedSubscription$) { - this.startedSubscription$.unsubscribe(); - } - if (this.endedSubscription$) { - this.endedSubscription$.unsubscribe(); - } - if (this.resultSubscription$) { - this.resultSubscription$.unsubscribe(); - } - } - - save() { - } - - convertTreeViewZone(zones: Map) { - - if (zones === undefined || zones === null) { - return; - } - - const treeNodes: any[] = []; - - zones.forEach((value: Zone, key: string, map) => { - const jZone: any = { - label: 'Zone - ' + value.iface, - // className: 'cn' + value.ip, - expandedIcon: 'fa-folder-open', - collapsedIcon: 'fa-folder', - }; - jZone.obj = value; - jZone.children = this.convertViewHost(value.hosts); - treeNodes.push(jZone); - }); - - return treeNodes; - } - - convertViewHost(hosts): any[] { - if (hosts === undefined || hosts === null) { - return null; - } - const hostNodes: any[] = []; - - hosts.forEach((host, hostKey) => { - - const jHost: any = { - label: 'Host - ' + host.ipv4, - // className: 'cn' + host.ip - expandedIcon: 'fa-folder-open', - collapsedIcon: 'fa-folder', - }; - jHost.obj = host; - jHost.children = this.convertViewPort(host.ports); - hostNodes.push(jHost); - - }); - - return hostNodes; - - } - - convertViewPort(ports): any[] { - if (ports === undefined || ports === null || ports.size < 0) { - return null; - } - const portChildren: any[] = []; - ports.forEach((port, portKey) => { - const jPort: any = { - label: 'Port - ' + port.portNumber, - // className: 'cn' + port.portNumber, - expandedIcon: 'fa-folder-open', - collapsedIcon: 'fa-folder', - }; - jPort.obj = port; - jPort.children = this.convertViewService(port.services); - portChildren.push(jPort); - }); - - return portChildren; - } - - convertViewService(services): any[] { - if (services === undefined || services === null || services.size <= 0) { - return null; - } - const serviceChildren: any[] = []; - services.forEach((service, serviceKey) => { - const jService: any = { - label: 'Service - ' + service.serviceName, - // className: 'cn' + service.serviceName, - }; - jService.obj = service; - - serviceChildren.push(jService); - }); - - return serviceChildren; - } - - -} diff --git a/@overflow/discovery/component/setting/result/result.component.html b/@overflow/discovery/component/setting/result/result.component.html deleted file mode 100644 index 1e05858..0000000 --- a/@overflow/discovery/component/setting/result/result.component.html +++ /dev/null @@ -1,13 +0,0 @@ -
-
- -
- - - -
- result -
- -
-
diff --git a/@overflow/discovery/component/setting/result/result.component.ts b/@overflow/discovery/component/setting/result/result.component.ts deleted file mode 100644 index 6efa341..0000000 --- a/@overflow/discovery/component/setting/result/result.component.ts +++ /dev/null @@ -1,198 +0,0 @@ -import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy, OnChanges, SimpleChanges } from '@angular/core'; -import { Store, select, StateObservable } from '@ngrx/store'; -import { RPCClientError } from '@loafer/ng-rpc'; -import { Subscription } from 'rxjs/Subscription'; -import { TreeNode } from 'primeng/primeng'; - -import * as DiscoveredStore from '@overflow/discovery/store/setting'; -import { SettingSelector, DiscoverSelector } from '@overflow/discovery/store'; -import * as DiscoverStore from '@overflow/discovery/store/discover'; -import * as RegistStore from '@overflow/discovery/store/regist'; - -import { Zone } from '@overflow/commons-typescript/model/discovery'; -import { Host } from '@overflow/commons-typescript/model/discovery'; -import { Port } from '@overflow/commons-typescript/model/discovery'; -import { Service } from '@overflow/commons-typescript/model/discovery'; - -@Component({ - selector: 'of-discovery-result', - templateUrl: './result.component.html', -}) -export class ResultComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges { - - @Input() started: boolean; - - treeNodes = []; - selectedNodes = []; - zones: Map = null; - checkedSet = new Set(); - - resultSubscription$: Subscription; - result$: any; - startedSubscription$: Subscription; - started$: any; - endedSubscription$: Subscription; - ended$: any; - - inProgress = false; - - - selectedDiscoveryResult: TreeNode[]; - - constructor( - private discoverdStore: Store, - private discoverStore: Store, - private registStore: Store, - ) { - this.result$ = discoverStore.pipe(select(DiscoverSelector.select('zones'))); - this.started$ = discoverStore.pipe(select(DiscoverSelector.select('isStart'))); - this.ended$ = discoverStore.pipe(select(DiscoverSelector.select('isEnd'))); - } - - ngOnInit() { - this.inProgress = true; - this.resultSubscription$ = this.result$.subscribe( - (zones: Map) => { - if (zones !== undefined && zones !== null) { - console.log(zones); - this.treeNodes = this.convertTreeViewZone(zones); - this.zones = zones; - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); - this.startedSubscription$ = this.started$.subscribe( - (isStart: boolean) => { - if (isStart !== undefined && isStart !== null && isStart) { - console.log('##Discovery has started.##'); - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); - this.endedSubscription$ = this.ended$.subscribe( - (isEnd: boolean) => { - if (isEnd !== undefined && isEnd !== null && isEnd) { - console.log('##Discovery has done.##'); - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); - } - - ngAfterContentInit() { - } - - ngOnChanges(changes: SimpleChanges): void { - if (changes['started'] && !changes['started'].currentValue) { - this.inProgress = false; - } - } - - ngOnDestroy() { - if (this.startedSubscription$) { - this.startedSubscription$.unsubscribe(); - } - if (this.endedSubscription$) { - this.endedSubscription$.unsubscribe(); - } - if (this.resultSubscription$) { - this.resultSubscription$.unsubscribe(); - } - } - - save() { - } - - convertTreeViewZone(zones: Map) { - - if (zones === undefined || zones === null) { - return; - } - - const treeNodes: any[] = []; - - zones.forEach((value: Zone, key: string, map) => { - const jZone: any = { - label: 'Zone - ' + value.iface, - // className: 'cn' + value.ip, - expandedIcon: 'fa-folder-open', - collapsedIcon: 'fa-folder', - }; - jZone.obj = value; - jZone.children = this.convertViewHost(value.hosts); - treeNodes.push(jZone); - }); - - return treeNodes; - } - - convertViewHost(hosts): any[] { - if (hosts === undefined || hosts === null) { - return null; - } - const hostNodes: any[] = []; - - hosts.forEach((host, hostKey) => { - - const jHost: any = { - label: 'Host - ' + host.ipv4, - // className: 'cn' + host.ip - expandedIcon: 'fa-folder-open', - collapsedIcon: 'fa-folder', - }; - jHost.obj = host; - jHost.children = this.convertViewPort(host.ports); - hostNodes.push(jHost); - - }); - - return hostNodes; - - } - - convertViewPort(ports): any[] { - if (ports === undefined || ports === null || ports.size < 0) { - return null; - } - const portChildren: any[] = []; - ports.forEach((port, portKey) => { - const jPort: any = { - label: 'Port - ' + port.portNumber, - // className: 'cn' + port.portNumber, - expandedIcon: 'fa-folder-open', - collapsedIcon: 'fa-folder', - }; - jPort.obj = port; - jPort.children = this.convertViewService(port.services); - portChildren.push(jPort); - }); - - return portChildren; - } - - convertViewService(services): any[] { - if (services === undefined || services === null || services.size <= 0) { - return null; - } - const serviceChildren: any[] = []; - services.forEach((service, serviceKey) => { - const jService: any = { - label: 'Service - ' + service.serviceName, - // className: 'cn' + service.serviceName, - }; - jService.obj = service; - - serviceChildren.push(jService); - }); - - return serviceChildren; - } - - -} diff --git a/@overflow/discovery/component/setting/setting.component.html b/@overflow/discovery/component/setting/setting.component.html deleted file mode 100644 index 3592ffd..0000000 --- a/@overflow/discovery/component/setting/setting.component.html +++ /dev/null @@ -1,36 +0,0 @@ - diff --git a/@overflow/discovery/component/setting/setting.component.ts b/@overflow/discovery/component/setting/setting.component.ts deleted file mode 100644 index cb03e40..0000000 --- a/@overflow/discovery/component/setting/setting.component.ts +++ /dev/null @@ -1,156 +0,0 @@ -import { - Component, OnInit, AfterContentInit, Output, EventEmitter, - Input, OnDestroy, OnChanges, SimpleChanges, ViewChild -} from '@angular/core'; -import { Store } from '@ngrx/store'; -import { - DiscoverZone, -} from '@overflow/commons-typescript/model/discovery'; - -import * as DiscoverStore from '../../store/discover'; -import { Probe } from '@overflow/commons-typescript/model/probe'; -import { ResultComponent } from './result/result.component'; -import { ProbeSelectorComponent } from './probe-selector/probe-selector.component'; -import { FilterComponent } from './filter/filter.component'; - -import { trigger, state, transition, style, animate } from '@angular/animations'; - -@Component({ - selector: 'of-discovery-setting', - templateUrl: './setting.component.html', - animations: [ - trigger( - 'discoveryFilter', [ - state('summary', style({ - height: '70px', - opacity: 0.9, - })), - state('full', style({ - height: '500px', - opacity: 1, - })), - transition('* => *', animate('200ms ease-in')), - ]), - trigger( - 'result', [ - state('show', style({ - height: '300px', - opacity: 1, - })), - state('hidden', style({ - height: '0px', - opacity: 0, - })), - transition('* => *', animate('200ms ease-in')), - ] - ) - ] -}) -export class SettingComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges { - - @Input() visible: boolean; - @Input() probe: Probe; - @Output() close = new EventEmitter(); - private requestStart = false; - private started = false; - private filterData: DiscoverZone; - - private selectedProbe: Probe; - private height: number; - - @ViewChild('probeSelectorComponent') probeSelectorComponent: ProbeSelectorComponent; - @ViewChild('filterComponent') filterComponent: FilterComponent; - @ViewChild('resultComponent') resultComponent: ResultComponent; - - constructor( - private discoverStore: Store, - ) { - this.height = window.innerHeight * 0.9; - } - - ngOnInit() { - this.selectedProbe = this.probe; - } - - ngAfterContentInit() { - } - - ngOnChanges(changes: SimpleChanges): void { - if (changes['visible']) { - const change = changes['visible']; - if (!change.previousValue && change.currentValue) { - this.initAll(); - } else if (change.previousValue && !change.currentValue) { - this.destroyAll(); - } - } - } - - ngOnDestroy() { - this.selectedProbe = null; - this.started = false; - this.close.emit(); - this.requestStart = false; - } - - initAll() { - this.ngOnInit(); - if (this.probeSelectorComponent) { - this.probeSelectorComponent.ngOnInit(); - } - if (this.filterComponent) { - this.filterComponent.ngOnInit(); - } - if (this.resultComponent) { - this.resultComponent.ngOnInit(); - } - } - - destroyAll() { - this.ngOnDestroy(); - if (this.probeSelectorComponent) { - this.probeSelectorComponent.ngOnDestroy(); - } - if (this.filterComponent) { - this.filterComponent.ngOnDestroy(); - } - if (this.resultComponent) { - this.resultComponent.ngOnDestroy(); - } - } - - onProbeSelect(probe: Probe) { - this.selectedProbe = probe; - } - - onDiscoveryStart(discoverZone: DiscoverZone) { - this.filterData = discoverZone; - this.discoverStore.dispatch(new DiscoverStore.DiscoverZone( - { probeID: this.selectedProbe.probeKey, discoverZone: discoverZone })); - - setTimeout(() => { - this.started = true; - // this.requestStart = false; - }); - } - - onCancel() { - this.destroyAll(); - } - - onSave() { - this.resultComponent.save(); - } - - onStop() { - this.started = false; - } - - onSummaryClick() { - if (this.started) { - return; - } - this.requestStart = false; - } - -} diff --git a/@overflow/discovery/container/discovery/discovery-container.component.html b/@overflow/discovery/container/discovery/discovery-container.component.html index 8b13789..2a56852 100644 --- a/@overflow/discovery/container/discovery/discovery-container.component.html +++ b/@overflow/discovery/container/discovery/discovery-container.component.html @@ -1 +1 @@ - + diff --git a/@overflow/discovery/container/discovery/discovery-container.component.ts b/@overflow/discovery/container/discovery/discovery-container.component.ts index 257669e..7218e90 100644 --- a/@overflow/discovery/container/discovery/discovery-container.component.ts +++ b/@overflow/discovery/container/discovery/discovery-container.component.ts @@ -1,9 +1,8 @@ import { - AfterContentInit, Component, + AfterContentInit, Component, Input, OnInit } from '@angular/core'; import { select, StateObservable } from '@ngrx/store'; -import { ListSelector } from '../../../probe/store'; import { ActivatedRoute } from '@angular/router'; @Component({ @@ -17,13 +16,14 @@ export class DiscoveryContainerComponent implements OnInit, AfterContentInit { // discovery start // discovery stop // get service list - probes$: StateObservable; + @Input() hostID; constructor( private activatedRoute: ActivatedRoute, ) { - // this.returnURL = this.activatedRoute.snapshot.queryParams['probe'] || null; - // this.probes$ = listStore.pipe(select(ListSelector.select('probes'))); + if (this.hostID > 0 && this.hostID !== undefined ) { + console.log('ddddddddddddddddddddddddddddddddddddddd'); + } } ngOnInit() { diff --git a/@overflow/discovery/discovery.module.ts b/@overflow/discovery/discovery.module.ts index 58bb16e..7bbff37 100644 --- a/@overflow/discovery/discovery.module.ts +++ b/@overflow/discovery/discovery.module.ts @@ -9,8 +9,8 @@ import { DiscoveryLoggerModule } from './discovery-logger.module'; import { COMPONENTS } from './component'; import { SERVICES } from './service'; import { PrimeNGModules } from '@overflow/commons/prime-ng/prime-ng.module'; -import { BrowserModule } from '@angular/platform-browser'; import { KeyValueModule } from '@overflow/commons/component/key-value/key-value.module'; +import { CONTAINER_COMPONENTS } from './container'; @NgModule({ imports: [ @@ -24,10 +24,12 @@ import { KeyValueModule } from '@overflow/commons/component/key-value/key-value. KeyValueModule ], declarations: [ - COMPONENTS + COMPONENTS, + CONTAINER_COMPONENTS ], exports: [ COMPONENTS, + CONTAINER_COMPONENTS ], providers: [ SERVICES, diff --git a/@overflow/notification/component/list/list.component.html b/@overflow/notification/component/list/list.component.html index 61ea128..25c7b38 100644 --- a/@overflow/notification/component/list/list.component.html +++ b/@overflow/notification/component/list/list.component.html @@ -1,24 +1,31 @@

Notifications

-
- +
+ No data
- - - - - Date - Title - Message - User - - - - - {{notification.createDate | date: 'dd/MM/yyyy'}} - {{notification.title}} - {{notification.message}} - {{notification.member.name}} - - - - + +
+ +
+
왜 이 div가 없으면 위에 버튼이 안눌릴까요 ㅠㅠ 한참 헤맸자농ㅠㅠ
+ + + + Date + Title + Message + User + + + + + {{notification.createDate | date: 'dd/MM/yyyy'}} + {{notification.title}} + {{notification.message}} + {{notification.member.name}} + + + + + +
diff --git a/@overflow/notification/component/list/list.component.ts b/@overflow/notification/component/list/list.component.ts index 117cbc1..ffa957b 100644 --- a/@overflow/notification/component/list/list.component.ts +++ b/@overflow/notification/component/list/list.component.ts @@ -1,105 +1,35 @@ -import { Component, Input } from '@angular/core'; +import { Component, Input, EventEmitter, Output, ViewChild, OnInit, OnChanges, SimpleChanges } from '@angular/core'; import { Notification } from '@overflow/commons-typescript/model/notification'; import { Page } from '@overflow/commons-typescript/model/commons/Page'; +import { Paginator } from 'primeng/primeng'; @Component({ selector: 'of-notification-list', templateUrl: './list.component.html', }) -export class NotificationListComponent { +export class NotificationListComponent implements OnChanges { @Input() notificationPage: Page; + @Output() pageChange = new EventEmitter(); + @Output() markAll = new EventEmitter(); + @Output() select = new EventEmitter(); + @ViewChild('paginator') paginator: Paginator; - constructor( - ) { } + ngOnChanges(changes: SimpleChanges): void { + if (changes['notificationPage']) { + this.paginator.changePage(this.notificationPage.number); + } + } - // ngOnInit() { - // // this.notificationSubscription$ = this.notification$.subscribe( - // // (page: Page) => { - // // if (page !== null) { - // // this.notifications = page.content; - // // this.totalLength = page.totalElements; - // // } - // // }, - // // (error: RPCClientError) => { - // // console.log(error.response.message); - // // } - // // ); + onPaginate(e) { + this.pageChange.emit(e.page); + } - // this.readSuccess$.subscribe( - // (noti: Notification) => { - // if (noti) { - // this.getNotifications(this.currPage); - // } - // }, - // (error: RPCClientError) => { - // console.log(error.response.message); - // } - // ); - // } + onRowSelect(e) { + this.select.emit(e.data); + } - // ngAfterContentInit() { - // this.getNotifications(this.currPage); - // } - - // ngOnDestroy() { - // if (this.notificationSubscription$) { - // this.notificationSubscription$.unsubscribe(); - // } - // } - - // // updateData(noti: Notification) { - // // for (let i = 0; i < this.notifications.length; i++) { - // // const exist = this.notifications[i]; - // // if (exist.id === noti.id) { - // // this.notifications[i] = noti; - // // return; - // // } - // // } - // // } - - // getNotifications(pageIndex: number) { - // // this.listStore.select(AuthSelector.select('member')).subscribe( - // // (member: Member) => { - // // const pageParams: PageParams = { - // // pageNo: pageIndex + '', - // // countPerPage: this.pageSize, - // // sortCol: 'id', - // // sortDirection: 'descending' - // // }; - // // this.listStore.dispatch(new ListStore.ReadAllByMember({ member, pageParams })); - // // this.currPage = pageIndex; - // // }, - // // (error) => { - // // console.log(error); - // // } - // // ); - // } - - // onRowSelect(event) { - // this.detailStore.dispatch(new DetailStore.MarkAsRead(event.data)); - // alert('Will redirect to ' + event.data.url); - // // this.router.navigate([n.url]); - // } - - // onPaging(e) { - // this.getNotifications(e.page); - // } - - // onMarkAllAsRead() { - // // this.listStore.select(AuthSelector.select('member')).subscribe( - // // (member: Member) => { - // // const pageParams: PageParams = { - // // pageNo: this.currPage + '', - // // countPerPage: this.pageSize, - // // sortCol: 'id', - // // sortDirection: 'descending' - // // }; - // // this.listStore.dispatch(new ListStore.MarkAllAsRead({ member, pageParams })); - // // }, - // // (error) => { - // // console.log(error); - // // } - // // ); - // } + onMarkAllAsRead() { + this.markAll.emit(); + } } diff --git a/@overflow/notification/container/list/list-container.component.html b/@overflow/notification/container/list/list-container.component.html index cc147e0..5cd25d6 100644 --- a/@overflow/notification/container/list/list-container.component.html +++ b/@overflow/notification/container/list/list-container.component.html @@ -1 +1,5 @@ - + diff --git a/@overflow/notification/container/list/list-container.component.ts b/@overflow/notification/container/list/list-container.component.ts index 5a149d6..949f18c 100644 --- a/@overflow/notification/container/list/list-container.component.ts +++ b/@overflow/notification/container/list/list-container.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; import { AfterContentInit, OnDestroy } from '@angular/core/src/metadata/lifecycle_hooks'; import { Store, select } from '@ngrx/store'; import { Observable } from 'rxjs/Observable'; @@ -10,6 +10,7 @@ import { Member } from '@overflow/commons-typescript/model/member'; import { PageParams } from '@overflow/commons-typescript/model/commons/PageParams'; import { Page } from '@overflow/commons-typescript/model/commons/Page'; import { Notification } from '@overflow/commons-typescript/model/notification'; +import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'of-notification-container', @@ -17,23 +18,37 @@ import { Notification } from '@overflow/commons-typescript/model/notification'; }) export class NotificationListContainerComponent implements OnInit { notificationPage$: Observable>; + @Output() pageChange = new EventEmitter(); + pageNo: number; constructor( private store: Store, + private route: ActivatedRoute ) { this.notificationPage$ = store.pipe(select(NotificationSelector.select('page'))); } ngOnInit() { + this.route.queryParams.subscribe(queryParams => { + this.pageNo = queryParams['page'] || 0; + this.getNotifications(); + }); + } + + onPageChange(pageNo: number) { + this.pageChange.emit(pageNo); + } + + getNotifications() { this.store.select(AuthSelector.select('member')).subscribe( (member: Member) => { const pageParams: PageParams = { - pageNo: 0, + pageNo: this.pageNo, countPerPage: 10, sortCol: 'id', sortDirection: 'descending', }; - this.store.dispatch(new ListStore.ReadAllByMember({member, pageParams})); + this.store.dispatch(new ListStore.ReadAllByMember({ member, pageParams })); }, (error) => { console.log(error); @@ -41,4 +56,25 @@ export class NotificationListContainerComponent implements OnInit { ); } + markAllasRead() { + this.store.select(AuthSelector.select('member')).subscribe( + (member: Member) => { + const pageParams: PageParams = { + pageNo: this.pageNo, + countPerPage: 10, + sortCol: 'id', + sortDirection: 'descending' + }; + this.store.dispatch(new ListStore.MarkAllAsRead({ member, pageParams })); + }, + (error) => { + console.log(error); + } + ); + } + + notificationSelected(notification: Notification) { + // this.router.navigate([notification.url]); + alert('redirect to ' + notification.url); + } } diff --git a/@overflow/probe/component/detail/detail.component.html b/@overflow/probe/component/detail/detail.component.html index 9b7a7a7..cc107ab 100644 --- a/@overflow/probe/component/detail/detail.component.html +++ b/@overflow/probe/component/detail/detail.component.html @@ -1,65 +1,84 @@
-

Info

+

Info

+
- - - +
-
- - +
-
Name - +
- +
- +
- Description - - - -
- + Description + + + +
+
- +
- +
- -
-
- +
+ + + +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
- - \ No newline at end of file + \ No newline at end of file diff --git a/@overflow/probe/component/detail/detail.component.ts b/@overflow/probe/component/detail/detail.component.ts index 679cc82..9b2be79 100644 --- a/@overflow/probe/component/detail/detail.component.ts +++ b/@overflow/probe/component/detail/detail.component.ts @@ -1,129 +1,66 @@ -import { Component, OnInit, Inject, AfterContentInit, OnDestroy } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; -import { Store, select } from '@ngrx/store'; -import { RPCClientError } from '@loafer/ng-rpc'; -// import * as DetailStore from '../../store/detail'; -// import * as ModifyStore from '../../store/modify'; -// import { DetailSelector, ModifySelector } from '../../store'; -import { Probe } from '@overflow/commons-typescript/model/probe'; -import { ConfirmationService, Message } from 'primeng/primeng'; -import * as CIDR from 'ip-cidr'; -import { Subscription } from 'rxjs/Subscription'; +import { Component, Input, Output, EventEmitter, ViewChild } from '@angular/core'; +import { Probe, ProbeHost } from '@overflow/commons-typescript/model/probe'; import { MessageService } from 'primeng/components/common/messageservice'; -// import { SettingComponent as DiscoverySettingComponent } from '@overflow/discovery/component/setting/setting.component'; - @Component({ selector: 'of-probe-detail', templateUrl: './detail.component.html', - providers: [ConfirmationService, MessageService] + providers: [MessageService] }) -export class ProbeDetailComponent implements OnInit, AfterContentInit, OnDestroy { +export class ProbeDetailComponent { - probeSubscription$: Subscription; - // probe$ = this.detailStore.pipe(select(DetailSelector.select('probe'))); - // modifySuccess$ = this.modifyStore.pipe(select(ModifySelector.select('modifiedProbe'))); - probe: Probe = null; - IPRange: string; - display = false; - msgs: Message[] = []; + @Input() probeHost: ProbeHost; + @Output() modify = new EventEmitter(); + @Output() discovery = new EventEmitter(); - constructor( - private route: ActivatedRoute, - // private detailStore: Store, - // private modifyStore: Store, - private confirmationService: ConfirmationService, - private messageService: MessageService - ) { } + editMode = false; - ngOnInit() { - // this.probeSubscription$ = this.probe$.subscribe( - // (probe: Probe) => { - // if (probe) { - // this.probe = probe; - // this.arrangeInfo(); - // } - // }, - // (error: RPCClientError) => { - // console.log(error.response.message); - // } - // ); + constructor(private messageService: MessageService) { } - ngOnDestroy() { - if (this.probeSubscription$) { - this.probeSubscription$.unsubscribe(); - } - } - - ngAfterContentInit() { - // const probeId = this.route.snapshot.paramMap.get('id'); - // this.detailStore.dispatch( - // new DetailStore.Read( - // { id: probeId } - // ) - // ); - } - - arrangeInfo() { - const cidr = new CIDR(this.probe.cidr); - if (!cidr.isValid()) { + onEditSave() { + const displayNameValidation = this.checkValidDisplayName(); + if (displayNameValidation) { + alert(displayNameValidation); return; } - this.IPRange = cidr.addressStart.address + ' ~ ' + cidr.addressEnd.address; + + const descriptionValidation = this.checkValidDescription(); + if (descriptionValidation) { + alert(descriptionValidation); + return; + } + + this.modify.emit(this.probeHost); + this.editMode = false; } onDiscoveryClick() { - this.display = true; + this.discovery.emit(this.probeHost.id); } - onDiscoveryClose() { - this.display = false; - } - - onRemoveClick() { - this.confirmationService.confirm({ - header: 'Confirmation', - icon: 'fa fa-trash', - message: 'Are you sure to remove this Probe?', - accept: () => { - // this.router.navigate(['probes/list']); - }, - reject: () => { - } - }); - } - - onDisplayNameChange(value: string) { - // if (value === this.probe.displayName) { - // return; - // } - // this.probe.displayName = value; - // this.modifyStore.dispatch( - // new ModifyStore.Modify(this.probe) - // ); - - // const modifySuccessSubscription$: Subscription = this.modifySuccess$.subscribe( - // (probe: Probe) => { - // if (probe) { - // this.msgs = []; - // this.msgs.push({ severity: 'success', summary: 'Succeed', detail: 'Probe name has changed.' }); - // } - // if (modifySuccessSubscription$) { - // modifySuccessSubscription$.unsubscribe(); - // } - // }, - // (error: RPCClientError) => { - // console.log(error.response.message); - // } - // ); - } - - onDisplayNameChangeKeypress(event, value) { - if (event.key === 'Enter') { - this.onDisplayNameChange(value); + checkValidDisplayName(): string { + const displayName = this.probeHost.probe.displayName; + if (displayName.length <= 2 || displayName.length > 20) { + return 'displayname length : 3 ~ 20'; } + const regex = /[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi; + if (displayName.match(regex)) { + return 'Cannot use special characters.'; + } + return null; } + checkValidDescription(): string { + const description = this.probeHost.probe.description; + if (description.length > 50) { + return 'description length : 0 ~ 50'; + } + const regex = /[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi; + if (description.match(regex)) { + return 'Cannot use special characters.'; + } + return null; + } } diff --git a/@overflow/probe/container/probe-detail-container.html b/@overflow/probe/container/probe-detail-container.html index 1782169..92c26c4 100644 --- a/@overflow/probe/container/probe-detail-container.html +++ b/@overflow/probe/container/probe-detail-container.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/@overflow/probe/container/probe-detail-container.ts b/@overflow/probe/container/probe-detail-container.ts index ac40d86..d6fb7b0 100644 --- a/@overflow/probe/container/probe-detail-container.ts +++ b/@overflow/probe/container/probe-detail-container.ts @@ -1,9 +1,39 @@ -import { Component } from '@angular/core'; +import { Component, OnInit, Input, AfterViewInit, Output, EventEmitter } from '@angular/core'; +import { Observable } from 'rxjs'; +import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe'; +import { Store, select } from '@ngrx/store'; +import * as ProbeStore from '../store/entity/probe'; +import { ProbeSelector } from '../store'; +import { ActivatedRoute } from '@angular/router'; +import { RPCClientError } from '@loafer/ng-rpc'; @Component({ selector: 'of-probe-detail-container', templateUrl: './probe-detail-container.html', }) -export class ProbeDetailContainerComponent { +export class ProbeDetailContainerComponent implements OnInit { + @Input() probeHostID; + @Output() discovery = new EventEmitter(); + probeHosts$: Observable; + error$: Observable; + + constructor( + private store: Store, + private route: ActivatedRoute, + ) { + this.probeHosts$ = store.pipe(select(ProbeSelector.select('probeHosts'))); + } + + ngOnInit() { + this.store.dispatch(new ProbeStore.Read(this.probeHostID)); + } + + onModify(probeHost: ProbeHost) { + this.store.dispatch(new ProbeStore.Modify(probeHost.probe)); + } + + onDiscovery(probeHostID: number) { + this.discovery.emit(probeHostID); + } } diff --git a/@overflow/probe/container/probe-list-container.ts b/@overflow/probe/container/probe-list-container.ts index 71bf0dc..2870a10 100644 --- a/@overflow/probe/container/probe-list-container.ts +++ b/@overflow/probe/container/probe-list-container.ts @@ -1,8 +1,8 @@ -import { Component, EventEmitter, Output, OnInit, AfterContentInit } from '@angular/core'; +import { Component, EventEmitter, Output, OnInit } from '@angular/core'; import { ProbeHost } from '@overflow/commons-typescript/model/probe'; import { Observable } from 'rxjs'; import { Store, select } from '@ngrx/store'; -import * as ProbeStore from '../store/probe'; +import * as ProbeStore from '../store/entity/probe'; import { ProbeSelector } from '../store'; import { AuthSelector } from '@overflow/member/store'; import { Domain } from '@overflow/commons-typescript/model/domain'; @@ -11,7 +11,7 @@ import { Domain } from '@overflow/commons-typescript/model/domain'; selector: 'of-probe-list-container', templateUrl: './probe-list-container.html', }) -export class ProbeListContainerComponent implements OnInit, AfterContentInit { +export class ProbeListContainerComponent implements OnInit { probeHosts$: Observable; @Output() select = new EventEmitter(); @@ -20,10 +20,6 @@ export class ProbeListContainerComponent implements OnInit, AfterContentInit { this.probeHosts$ = store.pipe(select(ProbeSelector.select('probeHosts'))); } - onSelect(probeHost: ProbeHost) { - this.select.emit(probeHost); - } - ngOnInit() { this.store.select(AuthSelector.select('domain')).subscribe( (domain: Domain) => { @@ -35,7 +31,8 @@ export class ProbeListContainerComponent implements OnInit, AfterContentInit { ); } - ngAfterContentInit() { - + onSelect(probeHost: ProbeHost) { + this.select.emit(probeHost); } + } diff --git a/@overflow/probe/store/container/probe-list/index.ts b/@overflow/probe/store/container/probe-list/index.ts new file mode 100644 index 0000000..f022bff --- /dev/null +++ b/@overflow/probe/store/container/probe-list/index.ts @@ -0,0 +1,2 @@ +export * from './probe-list.reducer'; +export * from './probe-list.state'; diff --git a/@overflow/probe/store/container/probe-list/probe-list.reducer.ts b/@overflow/probe/store/container/probe-list/probe-list.reducer.ts new file mode 100644 index 0000000..fb86962 --- /dev/null +++ b/@overflow/probe/store/container/probe-list/probe-list.reducer.ts @@ -0,0 +1,36 @@ +import { ActionType, Actions } from '../../entity/probe'; +import { + State, + initialState, +} from './probe-list.state'; + +import { Probe } from '@overflow/commons-typescript/model/probe'; + +export function reducer(state = initialState, action: Actions): State { + switch (action.type) { + case ActionType.ReadAllByDomainID: { + return { + ...state, + pending: true, + }; + } + + case ActionType.ReadAllByDomainIDSuccess: { + return { + ...state, + pending: false, + }; + } + + case ActionType.ReadAllByDomainIDFailure: { + return { + ...state, + pending: true, + }; + } + + default: { + return state; + } + } +} diff --git a/@overflow/probe/store/container/probe-list/probe-list.state.ts b/@overflow/probe/store/container/probe-list/probe-list.state.ts new file mode 100644 index 0000000..cc91b89 --- /dev/null +++ b/@overflow/probe/store/container/probe-list/probe-list.state.ts @@ -0,0 +1,7 @@ +export interface State { + pending: boolean; +} + +export const initialState: State = { + pending: false, +}; diff --git a/@overflow/probe/store/probe/index.ts b/@overflow/probe/store/entity/probe/index.ts similarity index 100% rename from @overflow/probe/store/probe/index.ts rename to @overflow/probe/store/entity/probe/index.ts diff --git a/@overflow/probe/store/probe/probe.action.ts b/@overflow/probe/store/entity/probe/probe.action.ts similarity index 68% rename from @overflow/probe/store/probe/probe.action.ts rename to @overflow/probe/store/entity/probe/probe.action.ts index 368bccb..33e81f6 100644 --- a/@overflow/probe/store/probe/probe.action.ts +++ b/@overflow/probe/store/entity/probe/probe.action.ts @@ -1,6 +1,6 @@ import { Action } from '@ngrx/store'; import { RPCClientError } from '@loafer/ng-rpc'; -import { ProbeHost } from '@overflow/commons-typescript/model/probe'; +import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe'; export enum ActionType { ReadAllByDomainID = '[probe.list] ReadAllByDomainID', @@ -10,6 +10,10 @@ export enum ActionType { Read = '[probe.detail] Read', ReadSuccess = '[probe.detail] ReadSuccess', ReadFailure = '[probe.detail] ReadFailure', + + Modify = '[probe.detail] Modify', + ModifySuccess = '[probe.detail] ModifySuccess', + ModifyFailure = '[probe.detail] ModifyFailure', } export class ReadAllByDomainID implements Action { @@ -48,6 +52,24 @@ export class ReadFailure implements Action { constructor(public payload: RPCClientError) {} } +export class Modify implements Action { + readonly type = ActionType.Modify; + + constructor(public payload: Probe) {} +} + +export class ModifySuccess implements Action { + readonly type = ActionType.ModifySuccess; + + constructor(public payload: Probe) {} +} + +export class ModifyFailure implements Action { + readonly type = ActionType.ModifyFailure; + + constructor(public payload: RPCClientError) {} +} + export type Actions = | ReadAllByDomainID | ReadAllByDomainIDSuccess @@ -55,4 +77,7 @@ export type Actions = | Read | ReadSuccess | ReadFailure + | Modify + | ModifySuccess + | ModifyFailure ; diff --git a/@overflow/probe/store/probe/probe.effect.ts b/@overflow/probe/store/entity/probe/probe.effect.ts similarity index 75% rename from @overflow/probe/store/probe/probe.effect.ts rename to @overflow/probe/store/entity/probe/probe.effect.ts index 9d8faba..50dfcc0 100644 --- a/@overflow/probe/store/probe/probe.effect.ts +++ b/@overflow/probe/store/entity/probe/probe.effect.ts @@ -25,9 +25,13 @@ import { Read, ReadSuccess, ReadFailure, + Modify, + ModifySuccess, + ModifyFailure, ActionType } from './probe.action'; -import { ProbeHostService } from '../../service/probe-host.service'; +import { ProbeHostService } from '../../../service/probe-host.service'; +import { ProbeService } from '../../../service/probe.service'; @Injectable() export class Effects { @@ -35,6 +39,7 @@ export class Effects { constructor( private actions$: Actions, private probeHostService: ProbeHostService, + private probeService: ProbeService, private router: Router ) { } @@ -61,4 +66,16 @@ export class Effects { .catch((error: RPCClientError) => { return of(new ReadAllByDomainIDFailure(error)); }); + + @Effect() + Modify$: Observable = this.actions$ + .ofType(ActionType.Modify) + .map((action: Modify) => action.payload) + .switchMap(payload => this.probeService.modify(payload)) + .map(probe => { + return new ModifySuccess(probe); + }) + .catch((error: RPCClientError) => { + return of(new ModifyFailure(error)); + }); } diff --git a/@overflow/probe/store/probe/probe.reducer.ts b/@overflow/probe/store/entity/probe/probe.reducer.ts similarity index 66% rename from @overflow/probe/store/probe/probe.reducer.ts rename to @overflow/probe/store/entity/probe/probe.reducer.ts index c74f63d..6e84074 100644 --- a/@overflow/probe/store/probe/probe.reducer.ts +++ b/@overflow/probe/store/entity/probe/probe.reducer.ts @@ -1,7 +1,4 @@ import { - ReadAllByDomainID, - ReadAllByDomainIDFailure, - ReadAllByDomainIDSuccess, ActionType, Actions, } from './probe.action'; @@ -61,6 +58,36 @@ export function reducer(state = initialState, action: Actions): State { }; } + case ActionType.Modify: { + return { + ...state, + error: null, + }; + } + + case ActionType.ModifySuccess: { + return { + ...state, + probeHosts: state.probeHosts.map( + (probeHost, i) => probeHost.probe.id === action.payload.id ? + { + ...probeHost, + probe : action.payload + } : probeHost + ), + error: null, + }; + } + + + case ActionType.ModifyFailure: { + return { + ...state, + error: action.payload, + probeHosts: null, + }; + } + default: { return state; } diff --git a/@overflow/probe/store/probe/probe.state.ts b/@overflow/probe/store/entity/probe/probe.state.ts similarity index 100% rename from @overflow/probe/store/probe/probe.state.ts rename to @overflow/probe/store/entity/probe/probe.state.ts diff --git a/@overflow/probe/store/index.ts b/@overflow/probe/store/index.ts index 5e333f6..d88608e 100644 --- a/@overflow/probe/store/index.ts +++ b/@overflow/probe/store/index.ts @@ -8,7 +8,7 @@ import { StateSelector } from '@overflow/core/ngrx/store'; import { MODULE } from '../probe.constant'; -import * as ProbeStore from './probe'; +import * as ProbeStore from './entity/probe'; export interface State { probes: ProbeStore.State; diff --git a/@overflow/probe/store/trash/detail/detail.action.ts b/@overflow/probe/store/trash/detail/detail.action.ts deleted file mode 100644 index 944b678..0000000 --- a/@overflow/probe/store/trash/detail/detail.action.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Action } from '@ngrx/store'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; - - -export enum ActionType { - Read = '[probe.detail] Read', - ReadSuccess = '[probe.detail] ReadSuccess', - ReadFailure = '[probe.detail] ReadFailure', -} - -export class Read implements Action { - readonly type = ActionType.Read; - - constructor(public payload: {id: string}) {} -} - -export class ReadSuccess implements Action { - readonly type = ActionType.ReadSuccess; - - constructor(public payload: Probe) {} -} - -export class ReadFailure implements Action { - readonly type = ActionType.ReadFailure; - - constructor(public payload: RPCClientError) {} -} - - -export type Actions = - | Read - | ReadSuccess - | ReadFailure -; diff --git a/@overflow/probe/store/trash/detail/detail.effect.spec.ts b/@overflow/probe/store/trash/detail/detail.effect.spec.ts deleted file mode 100644 index b1c2217..0000000 --- a/@overflow/probe/store/trash/detail/detail.effect.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; - -import { Effects } from './detail.effect'; - -describe('ProbeDetail.Effects', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [Effects] - }); - }); - - it('should be created', inject([Effects], (effects: Effects) => { - expect(effects).toBeTruthy(); - })); -}); diff --git a/@overflow/probe/store/trash/detail/detail.effect.ts b/@overflow/probe/store/trash/detail/detail.effect.ts deleted file mode 100644 index aa792dd..0000000 --- a/@overflow/probe/store/trash/detail/detail.effect.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Router } from '@angular/router'; - -import { Effect, Actions, ofType } from '@ngrx/effects'; -import { Action } from '@ngrx/store'; - -import { Observable } from 'rxjs/Observable'; -import { of } from 'rxjs/observable/of'; - -import 'rxjs/add/operator/catch'; -import 'rxjs/add/operator/do'; -import 'rxjs/add/operator/exhaustMap'; -import 'rxjs/add/operator/switchMap'; -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/take'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; -import { ProbeService } from '../../service/probe.service'; - -import { - Read, - ReadFailure, - ReadSuccess, - ActionType -} from './detail.action'; - -@Injectable() -export class Effects { - - constructor( - private actions$: Actions, - private probeService: ProbeService, - private router: Router - ) { } - - @Effect() - read$: Observable = this.actions$ - .ofType(ActionType.Read) - .map((action: Read) => action.payload) - .switchMap(payload => this.probeService.read(payload.id)) - .map(probe => { - return new ReadSuccess(probe); - }) - .catch((error: RPCClientError) => { - return of(new ReadFailure(error)); - }); -} diff --git a/@overflow/probe/store/trash/detail/detail.reducer.ts b/@overflow/probe/store/trash/detail/detail.reducer.ts deleted file mode 100644 index c468e92..0000000 --- a/@overflow/probe/store/trash/detail/detail.reducer.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { - Read, - ReadFailure, - ReadSuccess, - ActionType, - Actions, -} from './detail.action'; - -import { - State, - initialState, -} from './detail.state'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; - - -export function reducer(state = initialState, action: Actions): State { - switch (action.type) { - case ActionType.Read: { - return { - ...state, - error: null, - isPending: true, - }; - } - - case ActionType.ReadSuccess: { - return { - ...state, - error: null, - isPending: false, - probe: action.payload, - }; - } - - case ActionType.ReadFailure: { - return { - ...state, - error: action.payload, - isPending: false, - probe: null, - }; - } - - default: { - return state; - } - } -} diff --git a/@overflow/probe/store/trash/detail/detail.state.ts b/@overflow/probe/store/trash/detail/detail.state.ts deleted file mode 100644 index bf9f4ea..0000000 --- a/@overflow/probe/store/trash/detail/detail.state.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; - -import { createEntityAdapter, EntityAdapter, EntityState } from '@ngrx/entity'; - -export interface State extends EntityState { - error: RPCClientError | null; - isPending: boolean; - probe: Probe | null; -} -export const adapter: EntityAdapter = createEntityAdapter(); -export const initialState: State = adapter.getInitialState({ - error: null, - isPending: false, - probe: null, -}); - diff --git a/@overflow/probe/store/trash/detail/index.ts b/@overflow/probe/store/trash/detail/index.ts deleted file mode 100644 index 23ae8ab..0000000 --- a/@overflow/probe/store/trash/detail/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './detail.action'; -export * from './detail.effect'; -export * from './detail.reducer'; -export * from './detail.state'; diff --git a/@overflow/probe/store/trash/list/index.ts b/@overflow/probe/store/trash/list/index.ts deleted file mode 100644 index 7fd86e0..0000000 --- a/@overflow/probe/store/trash/list/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './list.action'; -export * from './list.effect'; -export * from './list.reducer'; -export * from './list.state'; diff --git a/@overflow/probe/store/trash/list/list.action.ts b/@overflow/probe/store/trash/list/list.action.ts deleted file mode 100644 index 96d9c1b..0000000 --- a/@overflow/probe/store/trash/list/list.action.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Action } from '@ngrx/store'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Domain } from '@overflow/commons-typescript/model/domain'; -import { Probe } from '@overflow/commons-typescript/model/probe'; - - -export enum ActionType { - ReadAllByDomain = '[probe.list] ReadAllByDomain', - ReadAllByDomainSuccess = '[probe.list] ReadAllByDomainSuccess', - ReadAllByDomainFailure = '[probe.list] ReadAllByDomainFailure', -} - -export class ReadAllByDomain implements Action { - readonly type = ActionType.ReadAllByDomain; - - constructor(public payload: Domain) {} -} - -export class ReadAllByDomainSuccess implements Action { - readonly type = ActionType.ReadAllByDomainSuccess; - - constructor(public payload: Probe[]) {} -} - -export class ReadAllByDomainFailure implements Action { - readonly type = ActionType.ReadAllByDomainFailure; - - constructor(public payload: RPCClientError) {} -} - - -export type Actions = - | ReadAllByDomain - | ReadAllByDomainSuccess - | ReadAllByDomainFailure -; diff --git a/@overflow/probe/store/trash/list/list.effect.spec.ts b/@overflow/probe/store/trash/list/list.effect.spec.ts deleted file mode 100644 index fbff64a..0000000 --- a/@overflow/probe/store/trash/list/list.effect.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; - -import { Effects } from './list.effect'; - -describe('ProbeList.Effects', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [Effects] - }); - }); - - it('should be created', inject([Effects], (effects: Effects) => { - expect(effects).toBeTruthy(); - })); -}); diff --git a/@overflow/probe/store/trash/list/list.effect.ts b/@overflow/probe/store/trash/list/list.effect.ts deleted file mode 100644 index b29ca97..0000000 --- a/@overflow/probe/store/trash/list/list.effect.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Router } from '@angular/router'; - -import { Effect, Actions, ofType } from '@ngrx/effects'; -import { Action } from '@ngrx/store'; - -import { Observable } from 'rxjs/Observable'; -import { of } from 'rxjs/observable/of'; - -import 'rxjs/add/operator/catch'; -import 'rxjs/add/operator/do'; -import 'rxjs/add/operator/exhaustMap'; -import 'rxjs/add/operator/switchMap'; -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/take'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Domain } from '@overflow/commons-typescript/model/domain'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; -import { ProbeService } from '../../service/probe.service'; - -import { - ReadAllByDomain, - ReadAllByDomainFailure, - ReadAllByDomainSuccess, - ActionType -} from './list.action'; - -@Injectable() -export class Effects { - - constructor( - private actions$: Actions, - private probeService: ProbeService, - private router: Router - ) { } - - @Effect() - readAllByDomain$: Observable = this.actions$ - .ofType(ActionType.ReadAllByDomain) - .map((action: ReadAllByDomain) => action.payload) - .switchMap(payload => this.probeService.readAllByDomain(payload)) - .map(probes => { - return new ReadAllByDomainSuccess(probes); - }) - .catch((error: RPCClientError) => { - return of(new ReadAllByDomainFailure(error)); - }); -} diff --git a/@overflow/probe/store/trash/list/list.reducer.ts b/@overflow/probe/store/trash/list/list.reducer.ts deleted file mode 100644 index ca775ad..0000000 --- a/@overflow/probe/store/trash/list/list.reducer.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { - ReadAllByDomain, - ReadAllByDomainFailure, - ReadAllByDomainSuccess, - ActionType, - Actions, -} from './list.action'; - -import { - State, - initialState, -} from './list.state'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; - -export function reducer(state = initialState, action: Actions): State { - switch (action.type) { - case ActionType.ReadAllByDomain: { - return { - ...state, - error: null, - isPending: true, - }; - } - - case ActionType.ReadAllByDomainSuccess: { - return { - ...state, - error: null, - isPending: false, - probes: action.payload, - }; - } - - case ActionType.ReadAllByDomainFailure: { - return { - ...state, - error: action.payload, - isPending: false, - probes: null, - }; - } - - default: { - return state; - } - } -} diff --git a/@overflow/probe/store/trash/list/list.state.ts b/@overflow/probe/store/trash/list/list.state.ts deleted file mode 100644 index ebdbd3b..0000000 --- a/@overflow/probe/store/trash/list/list.state.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; - -export interface State { - error: RPCClientError | null; - isPending: boolean; - probes: Probe[] | null; -} - -export const initialState: State = { - error: null, - isPending: false, - probes: null, -}; diff --git a/@overflow/probe/store/trash/modify/index.ts b/@overflow/probe/store/trash/modify/index.ts deleted file mode 100644 index 9f23ca0..0000000 --- a/@overflow/probe/store/trash/modify/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './modify.action'; -export * from './modify.effect'; -export * from './modify.reducer'; -export * from './modify.state'; diff --git a/@overflow/probe/store/trash/modify/modify.action.ts b/@overflow/probe/store/trash/modify/modify.action.ts deleted file mode 100644 index 9daad75..0000000 --- a/@overflow/probe/store/trash/modify/modify.action.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Action } from '@ngrx/store'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; - - -export enum ActionType { - Modify = '[probe.modify] Modify', - ModifyDisplayName = '[probe.modify] ModifyDisplayName', - ModifySuccess = '[probe.modify] ModifySuccess', - ModifyFailure = '[probe.modify] ModifyFailure', -} - -export class Modify implements Action { - readonly type = ActionType.Modify; - - constructor(public payload: Probe) {} -} - -export class ModifySuccess implements Action { - readonly type = ActionType.ModifySuccess; - - constructor(public payload: Probe) {} -} - -export class ModifyFailure implements Action { - readonly type = ActionType.ModifyFailure; - - constructor(public payload: RPCClientError) {} -} - -export class ModifyDisplayName implements Action { - readonly type = ActionType.ModifyDisplayName; - - constructor(public payload: {id: string, displayName: string}) {} -} - - -export type Actions = - | Modify - | ModifySuccess - | ModifyFailure - | ModifyDisplayName -; diff --git a/@overflow/probe/store/trash/modify/modify.effect.spec.ts b/@overflow/probe/store/trash/modify/modify.effect.spec.ts deleted file mode 100644 index b1c2217..0000000 --- a/@overflow/probe/store/trash/modify/modify.effect.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; - -import { Effects } from './detail.effect'; - -describe('ProbeDetail.Effects', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [Effects] - }); - }); - - it('should be created', inject([Effects], (effects: Effects) => { - expect(effects).toBeTruthy(); - })); -}); diff --git a/@overflow/probe/store/trash/modify/modify.effect.ts b/@overflow/probe/store/trash/modify/modify.effect.ts deleted file mode 100644 index 71d1a06..0000000 --- a/@overflow/probe/store/trash/modify/modify.effect.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Router } from '@angular/router'; - -import { Effect, Actions, ofType } from '@ngrx/effects'; -import { Action } from '@ngrx/store'; - -import { Observable } from 'rxjs/Observable'; -import { of } from 'rxjs/observable/of'; - -import 'rxjs/add/operator/catch'; -import 'rxjs/add/operator/do'; -import 'rxjs/add/operator/exhaustMap'; -import 'rxjs/add/operator/switchMap'; -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/take'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; -import { ProbeService } from '../../service/probe.service'; - -import { - Modify, - ModifyDisplayName, - ModifySuccess, - ModifyFailure, - ActionType -} from './modify.action'; - -@Injectable() -export class Effects { - - constructor( - private actions$: Actions, - private probeService: ProbeService, - private router: Router - ) { } - - @Effect() - modify$: Observable = this.actions$ - .ofType(ActionType.Modify) - .map((action: Modify) => action.payload) - .switchMap(payload => this.probeService.modify(payload)) - .map(probe => { - return new ModifySuccess(probe); - }) - .catch((error: RPCClientError) => { - return of(new ModifyFailure(error)); - }); - - @Effect() - modifyDisplayName$: Observable = this.actions$ - .ofType(ActionType.ModifyDisplayName) - .map((action: ModifyDisplayName) => action.payload) - .switchMap(payload => this.probeService.modifyDisplayName(payload.id, payload.displayName)) - .map(probe => { - return new ModifySuccess(probe); - }) - .catch((error: RPCClientError) => { - return of(new ModifyFailure(error)); - }); -} diff --git a/@overflow/probe/store/trash/modify/modify.reducer.ts b/@overflow/probe/store/trash/modify/modify.reducer.ts deleted file mode 100644 index 2333c43..0000000 --- a/@overflow/probe/store/trash/modify/modify.reducer.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { - ActionType, - Actions, -} from './modify.action'; - -import { - State, - initialState, -} from './modify.state'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; - - -export function reducer(state = initialState, action: Actions): State { - switch (action.type) { - case ActionType.Modify: { - return { - ...state, - error: null, - isPending: true, - }; - } - - case ActionType.ModifySuccess: { - return { - ...state, - error: null, - isPending: false, - modifiedProbe: action.payload, - }; - } - - case ActionType.ModifyFailure: { - return { - ...state, - error: action.payload, - isPending: false, - modifiedProbe: null, - }; - } - - case ActionType.ModifyDisplayName: { - return { - ...state, - error: null, - isPending: true, - }; - } - - default: { - return state; - } - } -} diff --git a/@overflow/probe/store/trash/modify/modify.state.ts b/@overflow/probe/store/trash/modify/modify.state.ts deleted file mode 100644 index 33c73f7..0000000 --- a/@overflow/probe/store/trash/modify/modify.state.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; - -import { createEntityAdapter, EntityAdapter, EntityState } from '@ngrx/entity'; - -export interface State extends EntityState { - error: RPCClientError | null; - isPending: boolean; - modifiedProbe: Probe | null; -} -export const adapter: EntityAdapter = createEntityAdapter(); -export const initialState: State = adapter.getInitialState({ - error: null, - isPending: false, - modifiedProbe: null, -}); - diff --git a/@overflow/probe/store/trash/probe-host-list/index.ts b/@overflow/probe/store/trash/probe-host-list/index.ts deleted file mode 100644 index 7fd86e0..0000000 --- a/@overflow/probe/store/trash/probe-host-list/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './list.action'; -export * from './list.effect'; -export * from './list.reducer'; -export * from './list.state'; diff --git a/@overflow/probe/store/trash/probe-host-list/list.action.ts b/@overflow/probe/store/trash/probe-host-list/list.action.ts deleted file mode 100644 index 7c6924f..0000000 --- a/@overflow/probe/store/trash/probe-host-list/list.action.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Action } from '@ngrx/store'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Domain } from '@overflow/commons-typescript/model/domain'; -import { ProbeHost } from '@overflow/commons-typescript/model/probe'; - - -export enum ActionType { - ReadAllByDomain = '[probeHost.list] ReadAllByDomain', - ReadAllByDomainSuccess = '[probeHost.list] ReadAllByDomainSuccess', - ReadAllByDomainFailure = '[probeHost.list] ReadAllByDomainFailure', -} - -export class ReadAllByDomain implements Action { - readonly type = ActionType.ReadAllByDomain; - - constructor(public payload: Domain) {} -} - -export class ReadAllByDomainSuccess implements Action { - readonly type = ActionType.ReadAllByDomainSuccess; - - constructor(public payload: ProbeHost[]) {} -} - -export class ReadAllByDomainFailure implements Action { - readonly type = ActionType.ReadAllByDomainFailure; - - constructor(public payload: RPCClientError) {} -} - - -export type Actions = - | ReadAllByDomain - | ReadAllByDomainSuccess - | ReadAllByDomainFailure -; diff --git a/@overflow/probe/store/trash/probe-host-list/list.effect.spec.ts b/@overflow/probe/store/trash/probe-host-list/list.effect.spec.ts deleted file mode 100644 index fbff64a..0000000 --- a/@overflow/probe/store/trash/probe-host-list/list.effect.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; - -import { Effects } from './list.effect'; - -describe('ProbeList.Effects', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [Effects] - }); - }); - - it('should be created', inject([Effects], (effects: Effects) => { - expect(effects).toBeTruthy(); - })); -}); diff --git a/@overflow/probe/store/trash/probe-host-list/list.effect.ts b/@overflow/probe/store/trash/probe-host-list/list.effect.ts deleted file mode 100644 index b5669a6..0000000 --- a/@overflow/probe/store/trash/probe-host-list/list.effect.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Router } from '@angular/router'; - -import { Effect, Actions, ofType } from '@ngrx/effects'; -import { Action } from '@ngrx/store'; - -import { Observable } from 'rxjs/Observable'; -import { of } from 'rxjs/observable/of'; - -import 'rxjs/add/operator/catch'; -import 'rxjs/add/operator/do'; -import 'rxjs/add/operator/exhaustMap'; -import 'rxjs/add/operator/switchMap'; -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/take'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Domain } from '@overflow/commons-typescript/model/domain'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; - -import { - ReadAllByDomain, - ReadAllByDomainFailure, - ReadAllByDomainSuccess, - ActionType -} from './list.action'; -import { ProbeHostService } from '../../service/probe-host.service'; - -@Injectable() -export class Effects { - - constructor( - private actions$: Actions, - private probeHostService: ProbeHostService, - private router: Router - ) { } - - @Effect() - readAllByDomain$: Observable = this.actions$ - .ofType(ActionType.ReadAllByDomain) - .map((action: ReadAllByDomain) => action.payload) - .switchMap(payload => this.probeHostService.readAllByDomain(payload)) - .map(probeHosts => { - return new ReadAllByDomainSuccess(probeHosts); - }) - .catch((error: RPCClientError) => { - return of(new ReadAllByDomainFailure(error)); - }); -} diff --git a/@overflow/probe/store/trash/probe-host-list/list.reducer.ts b/@overflow/probe/store/trash/probe-host-list/list.reducer.ts deleted file mode 100644 index 10940d1..0000000 --- a/@overflow/probe/store/trash/probe-host-list/list.reducer.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { - ReadAllByDomain, - ReadAllByDomainFailure, - ReadAllByDomainSuccess, - ActionType, - Actions, -} from './list.action'; - -import { - State, - initialState, -} from './list.state'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; - -export function reducer(state = initialState, action: Actions): State { - switch (action.type) { - case ActionType.ReadAllByDomain: { - return { - ...state, - error: null, - isPending: true, - }; - } - - case ActionType.ReadAllByDomainSuccess: { - return { - ...state, - error: null, - isPending: false, - probeHosts: action.payload, - }; - } - - case ActionType.ReadAllByDomainFailure: { - return { - ...state, - error: action.payload, - isPending: false, - probeHosts: null, - }; - } - - default: { - return state; - } - } -} diff --git a/@overflow/probe/store/trash/probe-host-list/list.state.ts b/@overflow/probe/store/trash/probe-host-list/list.state.ts deleted file mode 100644 index deb6440..0000000 --- a/@overflow/probe/store/trash/probe-host-list/list.state.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { RPCClientError } from '@loafer/ng-rpc'; - -import { ProbeHost } from '@overflow/commons-typescript/model/probe'; - -export interface State { - error: RPCClientError | null; - isPending: boolean; - probeHosts: ProbeHost[] | null; -} - -export const initialState: State = { - error: null, - isPending: false, - probeHosts: null, -}; diff --git a/@overflow/probe/store/trash/probe-host/index.ts b/@overflow/probe/store/trash/probe-host/index.ts deleted file mode 100644 index 9094a9e..0000000 --- a/@overflow/probe/store/trash/probe-host/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './probe-host.action'; -export * from './probe-host.effect'; -export * from './probe-host.reducer'; -export * from './probe-host.state'; diff --git a/@overflow/probe/store/trash/probe-host/probe-host.action.ts b/@overflow/probe/store/trash/probe-host/probe-host.action.ts deleted file mode 100644 index a322b79..0000000 --- a/@overflow/probe/store/trash/probe-host/probe-host.action.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Action } from '@ngrx/store'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe'; - - -export enum ActionType { - ReadByProbe = '[probeHost.detail] Read', - ReadByProbeSuccess = '[probeHost.detail] ReadSuccess', - ReadByProbeFailure = '[probeHost.detail] ReadFailure', -} - -export class ReadByProbe implements Action { - readonly type = ActionType.ReadByProbe; - - constructor(public payload: Probe) {} -} - -export class ReadByProbeSuccess implements Action { - readonly type = ActionType.ReadByProbeSuccess; - - constructor(public payload: ProbeHost) {} -} - -export class ReadByProbeFailure implements Action { - readonly type = ActionType.ReadByProbeFailure; - - constructor(public payload: RPCClientError) {} -} - - -export type Actions = - | ReadByProbe - | ReadByProbeSuccess - | ReadByProbeFailure -; diff --git a/@overflow/probe/store/trash/probe-host/probe-host.effect.spec.ts b/@overflow/probe/store/trash/probe-host/probe-host.effect.spec.ts deleted file mode 100644 index c1abc97..0000000 --- a/@overflow/probe/store/trash/probe-host/probe-host.effect.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; - -import { Effects } from './probe-host.effect'; - -describe('ProbeDetail.Effects', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [Effects] - }); - }); - - it('should be created', inject([Effects], (effects: Effects) => { - expect(effects).toBeTruthy(); - })); -}); diff --git a/@overflow/probe/store/trash/probe-host/probe-host.effect.ts b/@overflow/probe/store/trash/probe-host/probe-host.effect.ts deleted file mode 100644 index a1c4692..0000000 --- a/@overflow/probe/store/trash/probe-host/probe-host.effect.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Router } from '@angular/router'; - -import { Effect, Actions, ofType } from '@ngrx/effects'; -import { Action } from '@ngrx/store'; - -import { Observable } from 'rxjs/Observable'; -import { of } from 'rxjs/observable/of'; - -import 'rxjs/add/operator/catch'; -import 'rxjs/add/operator/do'; -import 'rxjs/add/operator/exhaustMap'; -import 'rxjs/add/operator/switchMap'; -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/take'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; -import { ProbeHostService } from '../../service/probe-host.service'; - -import { - ReadByProbe, - ReadByProbeSuccess, - ReadByProbeFailure, - ActionType -} from './probe-host.action'; - -@Injectable() -export class Effects { - - constructor( - private actions$: Actions, - private probeHostService: ProbeHostService, - private router: Router - ) { } - - @Effect() - read$: Observable = this.actions$ - .ofType(ActionType.ReadByProbe) - .map((action: ReadByProbe) => action.payload) - .switchMap(payload => this.probeHostService.readByProbe(payload)) - .map(probe => { - return new ReadByProbeSuccess(probe); - }) - .catch((error: RPCClientError) => { - return of(new ReadByProbeFailure(error)); - }); -} diff --git a/@overflow/probe/store/trash/probe-host/probe-host.reducer.ts b/@overflow/probe/store/trash/probe-host/probe-host.reducer.ts deleted file mode 100644 index 60d99e2..0000000 --- a/@overflow/probe/store/trash/probe-host/probe-host.reducer.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { - ReadByProbe, - ReadByProbeFailure, - ReadByProbeSuccess, - ActionType, - Actions, -} from './probe-host.action'; - -import { - State, - initialState, -} from './probe-host.state'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; - - -export function reducer(state = initialState, action: Actions): State { - switch (action.type) { - case ActionType.ReadByProbe: { - return { - ...state, - error: null, - isPending: true, - }; - } - - case ActionType.ReadByProbeSuccess: { - return { - ...state, - error: null, - isPending: false, - probeHost: action.payload, - }; - } - - case ActionType.ReadByProbeFailure: { - return { - ...state, - error: action.payload, - isPending: false, - probeHost: null, - }; - } - - default: { - return state; - } - } -} diff --git a/@overflow/probe/store/trash/probe-host/probe-host.state.ts b/@overflow/probe/store/trash/probe-host/probe-host.state.ts deleted file mode 100644 index c6adb3b..0000000 --- a/@overflow/probe/store/trash/probe-host/probe-host.state.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { RPCClientError } from '@loafer/ng-rpc'; -import { ProbeHost } from '@overflow/commons-typescript/model/probe'; - -export interface State { - error: RPCClientError | null; - isPending: boolean; - probeHost: ProbeHost | null; -} - -export const initialState: State = { - error: null, - isPending: false, - probeHost: null, -}; - diff --git a/@overflow/probe/store/trash/remove/index.ts b/@overflow/probe/store/trash/remove/index.ts deleted file mode 100644 index 68b5cb8..0000000 --- a/@overflow/probe/store/trash/remove/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './remove.action'; -export * from './remove.effect'; -export * from './remove.reducer'; -export * from './remove.state'; diff --git a/@overflow/probe/store/trash/remove/remove.action.ts b/@overflow/probe/store/trash/remove/remove.action.ts deleted file mode 100644 index d18241f..0000000 --- a/@overflow/probe/store/trash/remove/remove.action.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Action } from '@ngrx/store'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; - - -export enum ActionType { - Remove = '[probe.remove] Remove', - RemoveSuccess = '[probe.detail] RemoveSuccess', - RemoveFailure = '[probe.detail] RemoveFailure', -} - -export class Remove implements Action { - readonly type = ActionType.Remove; - - constructor(public payload: {id: string}) {} -} - -export class RemoveSuccess implements Action { - readonly type = ActionType.RemoveSuccess; - - constructor(public payload: boolean) {} -} - -export class RemoveFailure implements Action { - readonly type = ActionType.RemoveFailure; - - constructor(public payload: RPCClientError) {} -} - - -export type Actions = - | Remove - | RemoveSuccess - | RemoveFailure -; diff --git a/@overflow/probe/store/trash/remove/remove.effect.spec.ts b/@overflow/probe/store/trash/remove/remove.effect.spec.ts deleted file mode 100644 index b625d89..0000000 --- a/@overflow/probe/store/trash/remove/remove.effect.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; - -import { Effects } from './remove.effect'; - -describe('ProbeDetail.Effects', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [Effects] - }); - }); - - it('should be created', inject([Effects], (effects: Effects) => { - expect(effects).toBeTruthy(); - })); -}); diff --git a/@overflow/probe/store/trash/remove/remove.effect.ts b/@overflow/probe/store/trash/remove/remove.effect.ts deleted file mode 100644 index 216245b..0000000 --- a/@overflow/probe/store/trash/remove/remove.effect.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Router } from '@angular/router'; - -import { Effect, Actions, ofType } from '@ngrx/effects'; -import { Action } from '@ngrx/store'; - -import { Observable } from 'rxjs/Observable'; -import { of } from 'rxjs/observable/of'; - -import 'rxjs/add/operator/catch'; -import 'rxjs/add/operator/do'; -import 'rxjs/add/operator/exhaustMap'; -import 'rxjs/add/operator/switchMap'; -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/take'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; -import { ProbeService } from '../../service/probe.service'; - -import { - Remove, - RemoveSuccess, - RemoveFailure, - ActionType -} from './remove.action'; - -@Injectable() -export class Effects { - - constructor( - private actions$: Actions, - private probeService: ProbeService, - private router: Router - ) { } - - @Effect() - remove$: Observable = this.actions$ - .ofType(ActionType.Remove) - .map((action: Remove) => action.payload) - .switchMap(payload => this.probeService.remove(payload.id)) - .map(result => { - return new RemoveSuccess(result); - }) - .catch((error: RPCClientError) => { - return of(new RemoveFailure(error)); - }); -} diff --git a/@overflow/probe/store/trash/remove/remove.reducer.ts b/@overflow/probe/store/trash/remove/remove.reducer.ts deleted file mode 100644 index 11f28ea..0000000 --- a/@overflow/probe/store/trash/remove/remove.reducer.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { - Remove, - RemoveFailure, - RemoveSuccess, - ActionType, - Actions, -} from './remove.action'; - -import { - State, - initialState, -} from './remove.state'; - -import { Probe } from '@overflow/commons-typescript/model/probe'; - - -export function reducer(state = initialState, action: Actions): State { - switch (action.type) { - case ActionType.Remove: { - return { - ...state, - error: null, - isPending: true, - }; - } - - case ActionType.RemoveSuccess: { - return { - ...state, - error: null, - isPending: false, - succeed: action.payload, - }; - } - - case ActionType.RemoveFailure: { - return { - ...state, - error: action.payload, - isPending: false, - succeed: false, - }; - } - - default: { - return state; - } - } -} diff --git a/@overflow/probe/store/trash/remove/remove.state.ts b/@overflow/probe/store/trash/remove/remove.state.ts deleted file mode 100644 index e9af114..0000000 --- a/@overflow/probe/store/trash/remove/remove.state.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { RPCClientError } from '@loafer/ng-rpc'; -import { Probe } from '@overflow/commons-typescript/model/probe'; - -export interface State { - error: RPCClientError | null; - isPending: boolean; - succeed: boolean | null; -} - -export const initialState: State = { - error: null, - isPending: false, - succeed: null, -}; - diff --git a/src/app/commons/component/layout/breadcrumb/app.breadcrumb.component.ts b/src/app/commons/component/layout/breadcrumb/app.breadcrumb.component.ts index 60f68d8..6eeb2cb 100644 --- a/src/app/commons/component/layout/breadcrumb/app.breadcrumb.component.ts +++ b/src/app/commons/component/layout/breadcrumb/app.breadcrumb.component.ts @@ -1,6 +1,6 @@ import { Component, OnDestroy } from '@angular/core'; import { AppComponent } from '../../../../app.component'; -import { BreadcrumbService } from '../../../../commons/service/breadcrumb.service'; +import { BreadcrumbService } from '@app/commons/service/breadcrumb.service'; import { Subscription } from 'rxjs/Subscription'; import { MenuItem } from 'primeng/primeng'; diff --git a/src/app/pages/discovery/discovery-page-routing.module.ts b/src/app/pages/discovery/discovery-page-routing.module.ts index 8a25f46..0cdc9aa 100644 --- a/src/app/pages/discovery/discovery-page-routing.module.ts +++ b/src/app/pages/discovery/discovery-page-routing.module.ts @@ -8,6 +8,10 @@ const routes: Routes = [ { path: '', component: DiscoveryPageComponent, + }, + { + path: ':probeHostID', + component: DiscoveryPageComponent, } ]; diff --git a/src/app/pages/discovery/discovery-page.component.html b/src/app/pages/discovery/discovery-page.component.html index 28b4a80..07af687 100644 --- a/src/app/pages/discovery/discovery-page.component.html +++ b/src/app/pages/discovery/discovery-page.component.html @@ -2,7 +2,8 @@
- + +
diff --git a/src/app/pages/discovery/discovery-page.component.ts b/src/app/pages/discovery/discovery-page.component.ts index cfec397..c13da36 100644 --- a/src/app/pages/discovery/discovery-page.component.ts +++ b/src/app/pages/discovery/discovery-page.component.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'of-discovery-page', @@ -6,9 +7,16 @@ import { Component, OnInit } from '@angular/core'; }) export class DiscoveryPageComponent implements OnInit { + hostId: number; + constructor( + private route: ActivatedRoute ) { } ngOnInit() { + this.route.params.subscribe((params: any) => { + this.hostId = params['probeHostID']; + // console.log('probeHostID : ' + probeHostID); + }); } } diff --git a/src/app/pages/notification/notification-page-routing.module.ts b/src/app/pages/notification/notification-page-routing.module.ts index bd9560b..3d422c4 100644 --- a/src/app/pages/notification/notification-page-routing.module.ts +++ b/src/app/pages/notification/notification-page-routing.module.ts @@ -6,7 +6,7 @@ const routes: Routes = [ { path: '', component: NotificationPageComponent, - } + }, ]; @NgModule({ diff --git a/src/app/pages/notification/notification-page.component.html b/src/app/pages/notification/notification-page.component.html index 3025bd7..d6b08eb 100644 --- a/src/app/pages/notification/notification-page.component.html +++ b/src/app/pages/notification/notification-page.component.html @@ -2,7 +2,7 @@
- +
diff --git a/src/app/pages/notification/notification-page.component.ts b/src/app/pages/notification/notification-page.component.ts index 9dc21bc..817b4e0 100644 --- a/src/app/pages/notification/notification-page.component.ts +++ b/src/app/pages/notification/notification-page.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { BreadcrumbService } from '../../commons/service/breadcrumb.service'; +import { BreadcrumbService } from '@app/commons/service/breadcrumb.service'; +import { Router } from '@angular/router'; @Component({ @@ -9,7 +10,8 @@ import { BreadcrumbService } from '../../commons/service/breadcrumb.service'; export class NotificationPageComponent implements OnInit { constructor( - private breadcrumbService: BreadcrumbService + private breadcrumbService: BreadcrumbService, + private router: Router ) { breadcrumbService.setItems([ { label: 'Notifications', routerLink: ['/notification'] }, @@ -19,4 +21,8 @@ export class NotificationPageComponent implements OnInit { ngOnInit() { } + onPageChange(pageNo: number) { + this.router.navigate(['/notification'], { queryParams: { page: pageNo } }); + } + } diff --git a/src/app/pages/pages.component.ts b/src/app/pages/pages.component.ts index f3411e8..3c395f9 100644 --- a/src/app/pages/pages.component.ts +++ b/src/app/pages/pages.component.ts @@ -64,7 +64,6 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit { constructor(public renderer: Renderer, public zone: NgZone, private router: Router, private breadcrumbService: BreadcrumbService) { router.events.subscribe((val) => { - console.log(val); if (val instanceof NavigationStart) { breadcrumbService.setItems(null); } diff --git a/src/app/pages/probes/download/download-page.component.ts b/src/app/pages/probes/download/download-page.component.ts index e3c21fa..ac65dce 100644 --- a/src/app/pages/probes/download/download-page.component.ts +++ b/src/app/pages/probes/download/download-page.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; -import { BreadcrumbService } from '../../../commons/service/breadcrumb.service'; +import { BreadcrumbService } from '@app/commons/service/breadcrumb.service'; @Component({ selector: 'of-pages-download', diff --git a/src/app/pages/probes/noauth-probe/noauth-probe-page.component.ts b/src/app/pages/probes/noauth-probe/noauth-probe-page.component.ts index 44979c3..0ccf121 100644 --- a/src/app/pages/probes/noauth-probe/noauth-probe-page.component.ts +++ b/src/app/pages/probes/noauth-probe/noauth-probe-page.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { BreadcrumbService } from '../../../commons/service/breadcrumb.service'; +import { BreadcrumbService } from '@app/commons/service/breadcrumb.service'; @Component({ selector: 'of-pages-noauth-probe', diff --git a/src/app/pages/probes/probe/probe-page.component.html b/src/app/pages/probes/probe/probe-page.component.html index 2e426c2..435ef72 100644 --- a/src/app/pages/probes/probe/probe-page.component.html +++ b/src/app/pages/probes/probe/probe-page.component.html @@ -3,5 +3,8 @@
- + \ No newline at end of file diff --git a/src/app/pages/probes/probe/probe-page.component.ts b/src/app/pages/probes/probe/probe-page.component.ts index ac971ae..9cb132d 100644 --- a/src/app/pages/probes/probe/probe-page.component.ts +++ b/src/app/pages/probes/probe/probe-page.component.ts @@ -1,9 +1,9 @@ import { Component, OnDestroy } from '@angular/core'; import { Router, ActivatedRoute, NavigationEnd } from '@angular/router'; import { Subscription } from 'rxjs/Subscription'; -import { Probe } from '@overflow/commons-typescript/model/probe'; +import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe'; import { Target } from '@overflow/commons-typescript/model/target'; -import { BreadcrumbService } from '../../../commons/service/breadcrumb.service'; +import { BreadcrumbService } from '@app/commons/service/breadcrumb.service'; @Component({ selector: 'of-pages-probe', @@ -12,6 +12,7 @@ import { BreadcrumbService } from '../../../commons/service/breadcrumb.service'; export class ProbePageComponent { private isDetail: boolean; + private probeHostID: string; constructor( private router: Router, @@ -34,19 +35,24 @@ export class ProbePageComponent { this.isDetail = false; } - onDetailContainer(probeId: string) { + onDetailContainer(probeHostID: string) { + this.probeHostID = probeHostID; this.breadcrumbService.setItems([ { label: 'Probe', routerLink: ['/probe/list'] }, - { label: probeId } + { label: this.probeHostID } ]); this.isDetail = true; } - onProbeSelect(probe: Probe) { - this.router.navigate(['probe', probe.id, 'info']); + onProbeSelect(probeHost: ProbeHost) { + this.router.navigate(['probe', probeHost.id, 'info']); } onTargetSelect(target: Target) { console.log(target); } + + onDiscovery(probeHostID: number) { + this.router.navigate(['discovery', probeHostID]); + } }