From 14a4acb784b73a579fc0b225a532456c7b246427 Mon Sep 17 00:00:00 2001 From: insanity Date: Mon, 28 May 2018 18:58:13 +0900 Subject: [PATCH] arrange --- .../discovery/discovery.component.html | 8 +-- .../discovery/discovery.component.ts | 11 ++-- .../probe-selector.component.html | 9 --- .../probe-selector.component.ts | 59 ----------------- @overflow/discovery/component/index.ts | 2 - .../discovery-container.component.html | 3 +- .../discovery-container.component.ts | 42 ++---------- @overflow/discovery/discovery.module.ts | 4 +- @overflow/member/container/index.ts | 2 +- @overflow/probe/component/index.ts | 2 + .../selector/selector.component.html | 1 + .../component/selector/selector.component.ts | 29 +++++++++ @overflow/probe/container/index.ts | 2 + .../probe-detail-container.component.ts | 12 ++-- .../probe-list-container.component.ts | 22 +++---- .../probe-selector-container.component.html | 1 + .../probe-selector-container.component.ts | 39 +++++++++++ @overflow/probe/probe.module.ts | 2 - .../probe-detail/probe-detail.reducer.ts | 11 +--- .../probe-detail/probe-detail.state.ts | 10 ++- .../probe-list/probe-list.reducer.ts | 11 +--- .../container/probe-list/probe-list.state.ts | 12 +++- @overflow/probe/store/entity/probe/index.ts | 2 - .../probe/store/entity/probe/probe.reducer.ts | 65 ------------------- .../probe/store/entity/probe/probe.state.ts | 14 ---- @overflow/probe/store/index.ts | 7 -- .../component/detail/detail.component.html | 5 +- .../sensor/component/list/list.component.html | 2 +- .../sensor/component/list/list.component.ts | 1 + .../sensor-list-container.component.html | 2 +- .../discovery/discovery-page.component.html | 2 +- .../discovery/discovery-page.component.ts | 5 +- .../noauth-probe-page-routing.module.ts | 1 - .../sensors/sensor/sensor-page.component.html | 12 ++-- .../sensors/sensor/sensor-page.component.ts | 16 ++++- 35 files changed, 159 insertions(+), 269 deletions(-) delete mode 100644 @overflow/discovery/component/discovery/probe-selector/probe-selector.component.html delete mode 100644 @overflow/discovery/component/discovery/probe-selector/probe-selector.component.ts create mode 100644 @overflow/probe/component/selector/selector.component.html create mode 100644 @overflow/probe/component/selector/selector.component.ts create mode 100644 @overflow/probe/container/probe-selector-container.component.html create mode 100644 @overflow/probe/container/probe-selector-container.component.ts delete mode 100644 @overflow/probe/store/entity/probe/probe.reducer.ts delete mode 100644 @overflow/probe/store/entity/probe/probe.state.ts diff --git a/@overflow/discovery/component/discovery/discovery.component.html b/@overflow/discovery/component/discovery/discovery.component.html index db6e5b7..732f9b1 100644 --- a/@overflow/discovery/component/discovery/discovery.component.html +++ b/@overflow/discovery/component/discovery/discovery.component.html @@ -2,14 +2,14 @@ +
- + probeHost.id === this.probeHostID); + // } } ngAfterContentInit() { @@ -43,7 +46,7 @@ export class DiscoveryComponent implements OnInit, AfterContentInit { onSelectedProbe(probe) { console.log(probe); - this.selectedProbe = probe; + // this.selectedProbe = probe; } onProbeSelect(probe) { diff --git a/@overflow/discovery/component/discovery/probe-selector/probe-selector.component.html b/@overflow/discovery/component/discovery/probe-selector/probe-selector.component.html deleted file mode 100644 index 3385880..0000000 --- a/@overflow/discovery/component/discovery/probe-selector/probe-selector.component.html +++ /dev/null @@ -1,9 +0,0 @@ -
- - -
diff --git a/@overflow/discovery/component/discovery/probe-selector/probe-selector.component.ts b/@overflow/discovery/component/discovery/probe-selector/probe-selector.component.ts deleted file mode 100644 index f8cafcd..0000000 --- a/@overflow/discovery/component/discovery/probe-selector/probe-selector.component.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { - Component, OnInit, Input, AfterContentInit, Output, - EventEmitter, OnDestroy, ViewChild -} from '@angular/core'; - -import { Subscription } from 'rxjs/Subscription'; -import {Probe, ProbeHost} from '@overflow/commons-typescript/model/probe'; - -@Component({ - selector: 'of-probe-selector', - templateUrl: './probe-selector.component.html', -}) -export class ProbeSelectorComponent implements OnInit, AfterContentInit, OnDestroy { - - @Input() preProbe: ProbeHost; - probes: Probe[]; - selected: Probe; - - @Output() probeSelected = new EventEmitter(); - - constructor( - ) { - } - - ngOnInit() { - - } - - ngAfterContentInit() { - this.getProbes(); - } - - ngOnDestroy() { - this.selected = null; - this.probes = null; - } - - getProbes() { - - } - - onProbeSelect(event) { - this.selected = event.value; - this.probeSelected.emit(this.selected); - } - - registerOnChange(fn: any): void { - } - - registerOnTouched(fn: any): void { - } - - setDisabledState(isDisabled: boolean): void { - } - - writeValue(obj: any): void { - } - -} diff --git a/@overflow/discovery/component/index.ts b/@overflow/discovery/component/index.ts index 0d18f7e..e5843c9 100644 --- a/@overflow/discovery/component/index.ts +++ b/@overflow/discovery/component/index.ts @@ -1,4 +1,3 @@ -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'; @@ -8,7 +7,6 @@ import { IpInputComponent } from './discovery/search-config/ip-input.component'; export const COMPONENTS = [ ServiceSelectorComponent, - ProbeSelectorComponent, DiscoveryComponent, SearchConfigComponent, SearchFilterComponent, diff --git a/@overflow/discovery/container/discovery/discovery-container.component.html b/@overflow/discovery/container/discovery/discovery-container.component.html index 363056a..664dac4 100644 --- a/@overflow/discovery/container/discovery/discovery-container.component.html +++ b/@overflow/discovery/container/discovery/discovery-container.component.html @@ -1 +1,2 @@ - + + diff --git a/@overflow/discovery/container/discovery/discovery-container.component.ts b/@overflow/discovery/container/discovery/discovery-container.component.ts index a513aad..a270bd9 100644 --- a/@overflow/discovery/container/discovery/discovery-container.component.ts +++ b/@overflow/discovery/container/discovery/discovery-container.component.ts @@ -1,53 +1,19 @@ import { - AfterContentInit, Component, Input, - OnInit + Component, + Input, } from '@angular/core'; -import { select, Store} from '@ngrx/store'; -import { ActivatedRoute } from '@angular/router'; -import { Probe, ProbeHost } from '@overflow/commons-typescript/model/probe'; - -import { AuthSelector } from '@overflow/member/store'; -import { Domain } from '@overflow/commons-typescript/model/domain'; -import * as ProbeEntityStore from '@overflow/probe/store/entity/probe'; -import {Observable} from 'rxjs'; -import { ProbeEntitySelector } from '@overflow/probe/store'; @Component({ selector: 'of-discovery-container', templateUrl: './discovery-container.component.html', }) -export class DiscoveryContainerComponent implements OnInit, AfterContentInit { +export class DiscoveryContainerComponent { - // probe select ? - // get probe list for server - // discovery start - // discovery stop - // get service list - @Input() hostID; - - probeHosts$: Observable; - selectProbes?: Probe[]; + @Input() probeHostID; constructor( - private activatedRoute: ActivatedRoute, - private store: Store ) { - this.probeHosts$ = store.pipe(select(ProbeEntitySelector.selectAll)); - } - ngOnInit() { - this.store.select(AuthSelector.select('domain')).subscribe( - (domain: Domain) => { - this.store.dispatch(new ProbeEntityStore.ReadAllByDomainID(domain.id)); - }, - (error) => { - console.log(error); - } - ); - } - - ngAfterContentInit() { - } } diff --git a/@overflow/discovery/discovery.module.ts b/@overflow/discovery/discovery.module.ts index 7bbff37..3063c2e 100644 --- a/@overflow/discovery/discovery.module.ts +++ b/@overflow/discovery/discovery.module.ts @@ -11,6 +11,7 @@ import { SERVICES } from './service'; import { PrimeNGModules } from '@overflow/commons/prime-ng/prime-ng.module'; import { KeyValueModule } from '@overflow/commons/component/key-value/key-value.module'; import { CONTAINER_COMPONENTS } from './container'; +import { ProbeModule } from '../probe/probe.module'; @NgModule({ imports: [ @@ -21,7 +22,8 @@ import { CONTAINER_COMPONENTS } from './container'; DiscoveryStoreModule, DiscoveryRPCModule, DiscoveryLoggerModule, - KeyValueModule + KeyValueModule, + ProbeModule ], declarations: [ COMPONENTS, diff --git a/@overflow/member/container/index.ts b/@overflow/member/container/index.ts index 87723ae..b932c14 100644 --- a/@overflow/member/container/index.ts +++ b/@overflow/member/container/index.ts @@ -3,5 +3,5 @@ import { MemberSignupContainerComponent } from './member-signup-container.compon export const CONTAINERS = [ MemberSigninContainerComponent, - MemberSignupContainerComponent, + // MemberSignupContainerComponent, ]; diff --git a/@overflow/probe/component/index.ts b/@overflow/probe/component/index.ts index ffd7e65..aa2b63a 100644 --- a/@overflow/probe/component/index.ts +++ b/@overflow/probe/component/index.ts @@ -1,9 +1,11 @@ import { ProbeDetailComponent } from './detail/detail.component'; import { ProbeListComponent } from './list/list.component'; import { ProbeDownloadComponent } from './download/download.component'; +import { ProbeSelectorComponent } from './selector/selector.component'; export const COMPONENTS = [ ProbeListComponent, ProbeDetailComponent, ProbeDownloadComponent, + ProbeSelectorComponent, ]; diff --git a/@overflow/probe/component/selector/selector.component.html b/@overflow/probe/component/selector/selector.component.html new file mode 100644 index 0000000..f0ad369 --- /dev/null +++ b/@overflow/probe/component/selector/selector.component.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/@overflow/probe/component/selector/selector.component.ts b/@overflow/probe/component/selector/selector.component.ts new file mode 100644 index 0000000..c20b64e --- /dev/null +++ b/@overflow/probe/component/selector/selector.component.ts @@ -0,0 +1,29 @@ +import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core'; +import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe'; + +@Component({ + selector: 'of-probe-selector', + templateUrl: './selector.component.html', +}) +export class ProbeSelectorComponent implements OnChanges { + + @Output() select = new EventEmitter(); + @Input() probeHosts: ProbeHost[]; + @Input() probeHostID: number; + + options: Probe[]; + + constructor() { + } + + ngOnChanges(changes: SimpleChanges): void { + this.options = []; + for (const ph of this.probeHosts) { + this.options.push(ph.probe); + } + } + + onProbeSelect(event) { + this.select.emit(event.data); + } +} diff --git a/@overflow/probe/container/index.ts b/@overflow/probe/container/index.ts index dfe25b1..bbe719c 100644 --- a/@overflow/probe/container/index.ts +++ b/@overflow/probe/container/index.ts @@ -1,7 +1,9 @@ import { ProbeListContainerComponent } from '../container/probe-list-container.component'; import { ProbeDetailContainerComponent } from '../container/probe-detail-container.component'; +import { ProbeSelectorContainerComponent } from './probe-selector-container.component'; export const CONTAINER_COMPONENTS = [ ProbeListContainerComponent, ProbeDetailContainerComponent, + ProbeSelectorContainerComponent ]; diff --git a/@overflow/probe/container/probe-detail-container.component.ts b/@overflow/probe/container/probe-detail-container.component.ts index b9f32db..843fa58 100644 --- a/@overflow/probe/container/probe-detail-container.component.ts +++ b/@overflow/probe/container/probe-detail-container.component.ts @@ -1,9 +1,9 @@ import { Component, OnInit, Input, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core'; import { Observable } from 'rxjs'; -import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe'; +import { ProbeHost } from '@overflow/commons-typescript/model/probe'; import { Store, select } from '@ngrx/store'; import * as ProbeStore from '../store/entity/probe'; -import { ProbeEntitySelector, ProbeDetailContainerSelector } from '../store'; +import { ProbeDetailContainerSelector } from '../store'; import { ActivatedRoute } from '@angular/router'; @Component({ @@ -19,15 +19,15 @@ export class ProbeDetailContainerComponent implements OnInit, OnChanges { error$: Observable; constructor( - private store: Store, + private store: Store, private route: ActivatedRoute, ) { - this.pending$ = this.store.pipe(select(ProbeDetailContainerSelector.selectPending)); - this.error$ = this.store.pipe(select(ProbeEntitySelector.selectError)); } ngOnInit() { - this.probeHost$ = this.store.pipe(select(ProbeEntitySelector.selectOne(this.probeHostID))); + this.pending$ = this.store.pipe(select(ProbeDetailContainerSelector.selectPending)); + this.error$ = this.store.pipe(select(ProbeDetailContainerSelector.selectError)); + this.probeHost$ = this.store.pipe(select(ProbeDetailContainerSelector.selectOne(this.probeHostID))); } ngOnChanges(changes: SimpleChanges): void { diff --git a/@overflow/probe/container/probe-list-container.component.ts b/@overflow/probe/container/probe-list-container.component.ts index f090460..f06c72c 100644 --- a/@overflow/probe/container/probe-list-container.component.ts +++ b/@overflow/probe/container/probe-list-container.component.ts @@ -3,9 +3,9 @@ import { ProbeHost } from '@overflow/commons-typescript/model/probe'; import { Observable } from 'rxjs'; import { Store, select } from '@ngrx/store'; import * as ProbeEntityStore from '../store/entity/probe'; -import { ProbeEntitySelector, ProbeListContainerSelector } from '../store'; -import { AuthSelector } from '@overflow/member/store'; -import { Domain } from '@overflow/commons-typescript/model/domain'; +import { ProbeListContainerSelector } from '../store'; +import { AuthContainerSelector } from '../../shared/auth/store'; +import { DomainMember } from '@overflow/commons-typescript/model/domain'; @Component({ selector: 'of-probe-list-container', @@ -15,22 +15,20 @@ export class ProbeListContainerComponent implements OnInit { probeHosts$: Observable; pending$: Observable; + error$: Observable; @Output() select = new EventEmitter(); constructor( - private store: Store, + private store: Store, ) { - this.probeHosts$ = store.pipe(select(ProbeEntitySelector.selectAll)); - this.pending$ = store.pipe(select(ProbeListContainerSelector.selectPending)); } ngOnInit() { - this.store.select(AuthSelector.select('domain')).subscribe( - (domain: Domain) => { - this.store.dispatch(new ProbeEntityStore.ReadAllByDomainID(domain.id)); - }, - (error) => { - console.log(error); + this.probeHosts$ = this.store.pipe(select(ProbeListContainerSelector.selectAll)); + this.pending$ = this.store.pipe(select(ProbeListContainerSelector.selectPending)); + this.store.select(AuthContainerSelector.selectDomainMember).subscribe( + (domainMember: DomainMember) => { + this.store.dispatch(new ProbeEntityStore.ReadAllByDomainID(domainMember.domain.id)); } ); } diff --git a/@overflow/probe/container/probe-selector-container.component.html b/@overflow/probe/container/probe-selector-container.component.html new file mode 100644 index 0000000..8f51e22 --- /dev/null +++ b/@overflow/probe/container/probe-selector-container.component.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/@overflow/probe/container/probe-selector-container.component.ts b/@overflow/probe/container/probe-selector-container.component.ts new file mode 100644 index 0000000..7403a1e --- /dev/null +++ b/@overflow/probe/container/probe-selector-container.component.ts @@ -0,0 +1,39 @@ +import { Component, EventEmitter, Output, OnInit, Input } from '@angular/core'; +import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe'; +import { Observable } from 'rxjs'; +import { Store, select } from '@ngrx/store'; +import * as ProbeEntityStore from '@overflow/probe/store/entity/probe'; +import { ProbeListContainerSelector } from '@overflow/probe/store'; +import { AuthContainerSelector } from '@overflow/shared/auth/store'; +import { DomainMember } from '@overflow/commons-typescript/model/domain'; + +@Component({ + selector: 'of-probe-selector-container', + templateUrl: './probe-selector-container.component.html', +}) +export class ProbeSelectorContainerComponent implements OnInit { + + probeHosts$: Observable; + @Output() select = new EventEmitter(); + @Input() probeHostID: number; + + constructor( + private store: Store, + ) { + } + + ngOnInit() { + this.probeHosts$ = this.store.pipe(select(ProbeListContainerSelector.selectAll)); + this.store.select(AuthContainerSelector.selectDomainMember).subscribe( + (domainMember: DomainMember) => { + this.store.dispatch(new ProbeEntityStore.ReadAllByDomainID(domainMember.domain.id)); + } + ); + } + + onSelect(probeHost: ProbeHost) { + alert(probeHost.probe.displayName); + // this.select.emit(probeHost); + } + +} diff --git a/@overflow/probe/probe.module.ts b/@overflow/probe/probe.module.ts index e554b08..333e0c2 100644 --- a/@overflow/probe/probe.module.ts +++ b/@overflow/probe/probe.module.ts @@ -7,7 +7,6 @@ import { ProbeStoreModule } from './probe-store.module'; import { SERVICES } from './service'; import { PrimeNGModules } from '../commons/prime-ng/prime-ng.module'; import { FormsModule } from '@angular/forms'; -import { DiscoveryModule } from '@overflow/discovery/discovery.module'; import { MetaCrawlerModule } from '@overflow/meta/crawler/crawler.module'; import { KeyValueModule } from '@overflow/commons/component/key-value/key-value.module'; @@ -17,7 +16,6 @@ import { KeyValueModule } from '@overflow/commons/component/key-value/key-value. PrimeNGModules, ProbeStoreModule, FormsModule, - DiscoveryModule, KeyValueModule, MetaCrawlerModule ], diff --git a/@overflow/probe/store/container/probe-detail/probe-detail.reducer.ts b/@overflow/probe/store/container/probe-detail/probe-detail.reducer.ts index 43c19c4..18e4519 100644 --- a/@overflow/probe/store/container/probe-detail/probe-detail.reducer.ts +++ b/@overflow/probe/store/container/probe-detail/probe-detail.reducer.ts @@ -2,6 +2,7 @@ import { ActionType, Actions } from '../../entity/probe'; import { State, initialState, + probeListContainerAdapter } from './probe-detail.state'; import { Probe } from '@overflow/commons-typescript/model/probe'; @@ -16,17 +17,11 @@ export function reducer(state = initialState, action: Actions): State { } case ActionType.ReadSuccess: { - return { - ...state, - pending: false, - }; + return probeListContainerAdapter.setOne(action.payload, {...state, pending: false}); } case ActionType.ReadFailure: { - return { - ...state, - pending: true, - }; + return probeListContainerAdapter.setError(action.payload, {...state, pending: false}); } default: { diff --git a/@overflow/probe/store/container/probe-detail/probe-detail.state.ts b/@overflow/probe/store/container/probe-detail/probe-detail.state.ts index 236ecca..5f8896a 100644 --- a/@overflow/probe/store/container/probe-detail/probe-detail.state.ts +++ b/@overflow/probe/store/container/probe-detail/probe-detail.state.ts @@ -1,15 +1,19 @@ +import { RPCClientError } from '@loafer/ng-rpc'; +import { ProbeHost } from '@overflow/commons-typescript/model/probe'; import { Selector, createSelector } from '@ngrx/store'; import { createEntityAdapter, EntityState } from '@loafer/ng-entity'; -export interface State { +export const probeListContainerAdapter = createEntityAdapter(); +export interface State extends EntityState { pending: boolean; } -export const initialState: State = { +export const initialState: State = probeListContainerAdapter.getInitialState({ pending: false, -}; +}); export function getSelectors(selector: Selector) { return { + ...probeListContainerAdapter.getSelectors(selector), selectPending: createSelector(selector, (state: State) => state.pending), }; } diff --git a/@overflow/probe/store/container/probe-list/probe-list.reducer.ts b/@overflow/probe/store/container/probe-list/probe-list.reducer.ts index fb86962..ced893e 100644 --- a/@overflow/probe/store/container/probe-list/probe-list.reducer.ts +++ b/@overflow/probe/store/container/probe-list/probe-list.reducer.ts @@ -2,6 +2,7 @@ import { ActionType, Actions } from '../../entity/probe'; import { State, initialState, + probeListContainerAdapter } from './probe-list.state'; import { Probe } from '@overflow/commons-typescript/model/probe'; @@ -16,17 +17,11 @@ export function reducer(state = initialState, action: Actions): State { } case ActionType.ReadAllByDomainIDSuccess: { - return { - ...state, - pending: false, - }; + return probeListContainerAdapter.setAll(action.payload, {...state, pending: false}); } case ActionType.ReadAllByDomainIDFailure: { - return { - ...state, - pending: true, - }; + return probeListContainerAdapter.setError(action.payload, {...state, pending: false}); } default: { diff --git a/@overflow/probe/store/container/probe-list/probe-list.state.ts b/@overflow/probe/store/container/probe-list/probe-list.state.ts index 236ecca..d3de23c 100644 --- a/@overflow/probe/store/container/probe-list/probe-list.state.ts +++ b/@overflow/probe/store/container/probe-list/probe-list.state.ts @@ -1,15 +1,21 @@ +import { RPCClientError } from '@loafer/ng-rpc'; +import { ProbeHost } from '@overflow/commons-typescript/model/probe'; import { Selector, createSelector } from '@ngrx/store'; import { createEntityAdapter, EntityState } from '@loafer/ng-entity'; -export interface State { +export const probeListContainerAdapter = createEntityAdapter(); +export interface State extends EntityState { pending: boolean; } -export const initialState: State = { +export const initialState: State = probeListContainerAdapter.getInitialState({ pending: false, -}; +}); export function getSelectors(selector: Selector) { return { + ...probeListContainerAdapter.getSelectors(selector), selectPending: createSelector(selector, (state: State) => state.pending), }; } + + diff --git a/@overflow/probe/store/entity/probe/index.ts b/@overflow/probe/store/entity/probe/index.ts index d8f12e5..6d98072 100644 --- a/@overflow/probe/store/entity/probe/index.ts +++ b/@overflow/probe/store/entity/probe/index.ts @@ -1,4 +1,2 @@ export * from './probe.action'; export * from './probe.effect'; -export * from './probe.reducer'; -export * from './probe.state'; diff --git a/@overflow/probe/store/entity/probe/probe.reducer.ts b/@overflow/probe/store/entity/probe/probe.reducer.ts deleted file mode 100644 index 4ebe85a..0000000 --- a/@overflow/probe/store/entity/probe/probe.reducer.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { - ActionType, - Actions, -} from './probe.action'; - -import { - State, - initialState, - probeAdapter, -} from './probe.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, - error: null, - }; - } - - case ActionType.ReadAllByDomainIDSuccess: { - return probeAdapter.setAll(action.payload, state); - } - - case ActionType.ReadAllByDomainIDFailure: { - return probeAdapter.setError(action.payload, state); - } - - case ActionType.Read: { - return { - ...state, - error: null, - }; - } - - case ActionType.ReadSuccess: { - return probeAdapter.setOne(action.payload, state); - } - - case ActionType.ReadFailure: { - return probeAdapter.setError(action.payload, state); - } - - case ActionType.Modify: { - return { - ...state, - error: null, - }; - } - - case ActionType.ModifySuccess: { - return probeAdapter.upsertOne(action.payload, state); - } - - case ActionType.ModifyFailure: { - return probeAdapter.setError(action.payload, state); - } - - default: { - return state; - } - } -} diff --git a/@overflow/probe/store/entity/probe/probe.state.ts b/@overflow/probe/store/entity/probe/probe.state.ts deleted file mode 100644 index 1a65bb5..0000000 --- a/@overflow/probe/store/entity/probe/probe.state.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { RPCClientError } from '@loafer/ng-rpc'; -import { ProbeHost } from '@overflow/commons-typescript/model/probe'; -import { Selector, createSelector } from '@ngrx/store'; -import { createEntityAdapter, EntityState } from '@loafer/ng-entity'; - -export const probeAdapter = createEntityAdapter(); -export interface State extends EntityState { -} -export const initialState: State = probeAdapter.getInitialState(); - -export function getSelectors(selector: Selector) { - return probeAdapter.getSelectors(selector); -} - diff --git a/@overflow/probe/store/index.ts b/@overflow/probe/store/index.ts index 3f4480e..6a8f41d 100644 --- a/@overflow/probe/store/index.ts +++ b/@overflow/probe/store/index.ts @@ -13,13 +13,11 @@ import * as ProbeListContainerStore from './container/probe-list'; import * as ProbeDetailContainerStore from './container/probe-detail'; export interface State { - probe: ProbeEntityStore.State; probe_list_container: ProbeListContainerStore.State; probe_detail_container: ProbeDetailContainerStore.State; } export const REDUCERS = { - probe: ProbeEntityStore.reducer, probe_list_container: ProbeListContainerStore.reducer, probe_detail_container: ProbeDetailContainerStore.reducer }; @@ -30,11 +28,6 @@ export const EFFECTS = [ export const selectState = createFeatureSelector(MODULE.name); -export const ProbeEntitySelector = ProbeEntityStore.getSelectors(createSelector( - selectState, - (state: State) => state.probe -)); - export const ProbeListContainerSelector = ProbeListContainerStore.getSelectors(createSelector( selectState, (state: State) => state.probe_list_container diff --git a/@overflow/sensor/component/detail/detail.component.html b/@overflow/sensor/component/detail/detail.component.html index 6dbe420..ee7197b 100644 --- a/@overflow/sensor/component/detail/detail.component.html +++ b/@overflow/sensor/component/detail/detail.component.html @@ -1,4 +1,5 @@ -
+SENSOR_DETAIL_COMPONENT + diff --git a/@overflow/sensor/component/list/list.component.html b/@overflow/sensor/component/list/list.component.html index 18f6f16..b7d1009 100644 --- a/@overflow/sensor/component/list/list.component.html +++ b/@overflow/sensor/component/list/list.component.html @@ -77,7 +77,7 @@
diff --git a/@overflow/sensor/component/list/list.component.ts b/@overflow/sensor/component/list/list.component.ts index 6509d91..b0ae8ad 100644 --- a/@overflow/sensor/component/list/list.component.ts +++ b/@overflow/sensor/component/list/list.component.ts @@ -11,6 +11,7 @@ export class SensorListComponent implements OnChanges { @Input() page: Page; @Output() addSensor = new EventEmitter(); + @Output() select = new EventEmitter(); totalLength: number; targetSensors: Object; diff --git a/@overflow/sensor/container/sensor-list-container.component.html b/@overflow/sensor/container/sensor-list-container.component.html index 1f9f7ad..58b4952 100644 --- a/@overflow/sensor/container/sensor-list-container.component.html +++ b/@overflow/sensor/container/sensor-list-container.component.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/app/pages/discovery/discovery-page.component.html b/src/app/pages/discovery/discovery-page.component.html index 07af687..f7fa9b0 100644 --- a/src/app/pages/discovery/discovery-page.component.html +++ b/src/app/pages/discovery/discovery-page.component.html @@ -3,7 +3,7 @@
- +
diff --git a/src/app/pages/discovery/discovery-page.component.ts b/src/app/pages/discovery/discovery-page.component.ts index c13da36..338306e 100644 --- a/src/app/pages/discovery/discovery-page.component.ts +++ b/src/app/pages/discovery/discovery-page.component.ts @@ -7,7 +7,7 @@ import { ActivatedRoute } from '@angular/router'; }) export class DiscoveryPageComponent implements OnInit { - hostId: number; + probeHostID: number; constructor( private route: ActivatedRoute @@ -15,8 +15,7 @@ export class DiscoveryPageComponent implements OnInit { ngOnInit() { this.route.params.subscribe((params: any) => { - this.hostId = params['probeHostID']; - // console.log('probeHostID : ' + probeHostID); + this.probeHostID = params['probeHostID']; }); } } diff --git a/src/app/pages/probes/noauth-probe/noauth-probe-page-routing.module.ts b/src/app/pages/probes/noauth-probe/noauth-probe-page-routing.module.ts index c8225f6..5babd78 100644 --- a/src/app/pages/probes/noauth-probe/noauth-probe-page-routing.module.ts +++ b/src/app/pages/probes/noauth-probe/noauth-probe-page-routing.module.ts @@ -2,7 +2,6 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { NoAuthProbePageComponent } from './noauth-probe-page.component'; import { ProbeListComponent } from '@overflow/probe/component/list/list.component'; -import { NoAuthProbeListComponent } from '@overflow/noauth-probe/component/list/list.component'; import { ProbeDownloadComponent } from '@overflow/probe/component/download/download.component'; const routes: Routes = [ diff --git a/src/app/pages/sensors/sensor/sensor-page.component.html b/src/app/pages/sensors/sensor/sensor-page.component.html index e84003f..9dbaeb4 100644 --- a/src/app/pages/sensors/sensor/sensor-page.component.html +++ b/src/app/pages/sensors/sensor/sensor-page.component.html @@ -1,8 +1,4 @@ -
- - -
- - - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/src/app/pages/sensors/sensor/sensor-page.component.ts b/src/app/pages/sensors/sensor/sensor-page.component.ts index 75a6f73..4cd4deb 100644 --- a/src/app/pages/sensors/sensor/sensor-page.component.ts +++ b/src/app/pages/sensors/sensor/sensor-page.component.ts @@ -4,13 +4,19 @@ import { Sensor } from '@overflow/commons-typescript/model/sensor'; import { BreadcrumbService } from '@app/commons/service/breadcrumb.service'; import { Target } from '@overflow/commons-typescript/model/target'; +enum CONTAINER_TYPES { + List = 1, + Detail, + Setting, +} + @Component({ selector: 'of-pages-sensor', templateUrl: './sensor-page.component.html', }) export class SensorPageComponent { - isDetail: boolean; + containerType: CONTAINER_TYPES; sensorID: string; constructor( @@ -31,7 +37,11 @@ export class SensorPageComponent { this.breadcrumbService.setItems([ { label: 'Sensor', routerLink: ['/sensor/list'], } ]); - this.isDetail = false; + if (this.router.url === '/sensor/list') { + this.containerType = CONTAINER_TYPES.List; + } else { + this.containerType = CONTAINER_TYPES.Setting; + } } onDetailContainer(sensorID: string) { @@ -40,7 +50,7 @@ export class SensorPageComponent { { label: 'Sensor', routerLink: ['/sensor/list'] }, { label: this.sensorID } ]); - this.isDetail = true; + this.containerType = CONTAINER_TYPES.Detail; } onSensorSelect(sensor: Sensor) {