diff --git a/src/packages/infra/component/map/map.component.ts b/src/packages/infra/component/map/map.component.ts index 30e4e62..6fefe08 100644 --- a/src/packages/infra/component/map/map.component.ts +++ b/src/packages/infra/component/map/map.component.ts @@ -36,7 +36,6 @@ interface HostData { templateUrl: './map.component.html' }) export class MapComponent implements OnInit, AfterContentInit { - // infraTree: TreeNode[] = testInfraList; infraTree: TreeNode[] = []; infras$ = this.listStore.pipe(select(ListSelector.select('page'))); @@ -61,7 +60,6 @@ export class MapComponent implements OnInit, AfterContentInit { @ViewChild('cmService') cmService: ContextMenu; @ViewChild('cmSensor') cmSensor: ContextMenu; - visibleSidebar = false; selectedNode: TreeNode = null; sensorSettingDisplay = false; diff --git a/src/packages/probe/service/probe.service.ts b/src/packages/probe/service/probe.service.ts index 8936302..2026ebd 100644 --- a/src/packages/probe/service/probe.service.ts +++ b/src/packages/probe/service/probe.service.ts @@ -35,4 +35,8 @@ export class ProbeService { return this.rpcService.call('ProbeService.remove', id); } + public modifyDisplayName(id: string, displayName: string): Observable { + return this.rpcService.call('ProbeService.modifyDisplayName', id, displayName); + } + } diff --git a/src/packages/probe/store/modify/modify.action.ts b/src/packages/probe/store/modify/modify.action.ts index 8f21838..8921e3e 100644 --- a/src/packages/probe/store/modify/modify.action.ts +++ b/src/packages/probe/store/modify/modify.action.ts @@ -6,9 +6,10 @@ import { Probe } from '../../model'; export enum ActionType { - Modify = '[probe.detail] Modify', - ModifySuccess = '[probe.detail] ModifySuccess', - ModifyFailure = '[probe.detail] ModifyFailure', + Modify = '[probe.modify] Modify', + ModifyDisplayName = '[probe.modify] ModifyDisplayName', + ModifySuccess = '[probe.modify] ModifySuccess', + ModifyFailure = '[probe.modify] ModifyFailure', } export class Modify implements Action { @@ -29,9 +30,16 @@ export class ModifyFailure implements Action { 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/src/packages/probe/store/modify/modify.effect.ts b/src/packages/probe/store/modify/modify.effect.ts index 2b34101..cadfee3 100644 --- a/src/packages/probe/store/modify/modify.effect.ts +++ b/src/packages/probe/store/modify/modify.effect.ts @@ -21,6 +21,7 @@ import { ProbeService } from '../../service/probe.service'; import { Modify, + ModifyDisplayName, ModifySuccess, ModifyFailure, ActionType @@ -46,4 +47,16 @@ export class Effects { .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/src/packages/probe/store/modify/modify.reducer.ts b/src/packages/probe/store/modify/modify.reducer.ts index ec40bc0..24b85b5 100644 --- a/src/packages/probe/store/modify/modify.reducer.ts +++ b/src/packages/probe/store/modify/modify.reducer.ts @@ -39,6 +39,14 @@ export function reducer(state = initialState, action: Actions): State { }; } + case ActionType.ModifyDisplayName: { + return { + ...state, + error: null, + isPending: true, + }; + } + default: { return state; }