diff --git a/@overflow/probe/component/detail/detail.component.html b/@overflow/probe/component/detail/detail.component.html index 1b399b8..cc107ab 100644 --- a/@overflow/probe/component/detail/detail.component.html +++ b/@overflow/probe/component/detail/detail.component.html @@ -2,6 +2,7 @@

Info

+
diff --git a/@overflow/probe/component/detail/detail.component.ts b/@overflow/probe/component/detail/detail.component.ts index d6969ae..9b2be79 100644 --- a/@overflow/probe/component/detail/detail.component.ts +++ b/@overflow/probe/component/detail/detail.component.ts @@ -1,11 +1,11 @@ -import { Component, Input, Output, EventEmitter } from '@angular/core'; +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'; @Component({ selector: 'of-probe-detail', templateUrl: './detail.component.html', - // providers: [ConfirmationService, MessageService] + providers: [MessageService] }) export class ProbeDetailComponent { @@ -15,10 +15,22 @@ export class ProbeDetailComponent { editMode = false; - constructor() { + constructor(private messageService: MessageService) { } onEditSave() { + const displayNameValidation = this.checkValidDisplayName(); + if (displayNameValidation) { + alert(displayNameValidation); + return; + } + + const descriptionValidation = this.checkValidDescription(); + if (descriptionValidation) { + alert(descriptionValidation); + return; + } + this.modify.emit(this.probeHost); this.editMode = false; } @@ -26,5 +38,29 @@ export class ProbeDetailComponent { onDiscoveryClick() { this.discovery.emit(this.probeHost.id); } + + 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.ts b/@overflow/probe/container/probe-detail-container.ts index 348ecc9..d6fb7b0 100644 --- a/@overflow/probe/container/probe-detail-container.ts +++ b/@overflow/probe/container/probe-detail-container.ts @@ -5,6 +5,7 @@ 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', @@ -15,6 +16,7 @@ export class ProbeDetailContainerComponent implements OnInit { @Input() probeHostID; @Output() discovery = new EventEmitter(); probeHosts$: Observable; + error$: Observable; constructor( private store: Store, 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/entity/probe/probe.reducer.ts b/@overflow/probe/store/entity/probe/probe.reducer.ts index a6aad56..6e84074 100644 --- a/@overflow/probe/store/entity/probe/probe.reducer.ts +++ b/@overflow/probe/store/entity/probe/probe.reducer.ts @@ -65,6 +65,21 @@ export function reducer(state = initialState, action: Actions): State { }; } + 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, 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, -}; -