This commit is contained in:
insanity 2018-05-02 12:59:45 +09:00
parent b9663e59f9
commit c84eb1e6f4
5 changed files with 36 additions and 5 deletions

View File

@ -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;

View File

@ -35,4 +35,8 @@ export class ProbeService {
return this.rpcService.call<boolean>('ProbeService.remove', id);
}
public modifyDisplayName(id: string, displayName: string): Observable<Probe> {
return this.rpcService.call<Probe>('ProbeService.modifyDisplayName', id, displayName);
}
}

View File

@ -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
;

View File

@ -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<Action> = 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));
});
}

View File

@ -39,6 +39,14 @@ export function reducer(state = initialState, action: Actions): State {
};
}
case ActionType.ModifyDisplayName: {
return {
...state,
error: null,
isPending: true,
};
}
default: {
return state;
}