map
This commit is contained in:
parent
b9663e59f9
commit
c84eb1e6f4
|
@ -36,7 +36,6 @@ interface HostData {
|
||||||
templateUrl: './map.component.html'
|
templateUrl: './map.component.html'
|
||||||
})
|
})
|
||||||
export class MapComponent implements OnInit, AfterContentInit {
|
export class MapComponent implements OnInit, AfterContentInit {
|
||||||
// infraTree: TreeNode[] = testInfraList;
|
|
||||||
infraTree: TreeNode[] = [];
|
infraTree: TreeNode[] = [];
|
||||||
|
|
||||||
infras$ = this.listStore.pipe(select(ListSelector.select('page')));
|
infras$ = this.listStore.pipe(select(ListSelector.select('page')));
|
||||||
|
@ -61,7 +60,6 @@ export class MapComponent implements OnInit, AfterContentInit {
|
||||||
@ViewChild('cmService') cmService: ContextMenu;
|
@ViewChild('cmService') cmService: ContextMenu;
|
||||||
@ViewChild('cmSensor') cmSensor: ContextMenu;
|
@ViewChild('cmSensor') cmSensor: ContextMenu;
|
||||||
|
|
||||||
visibleSidebar = false;
|
|
||||||
selectedNode: TreeNode = null;
|
selectedNode: TreeNode = null;
|
||||||
|
|
||||||
sensorSettingDisplay = false;
|
sensorSettingDisplay = false;
|
||||||
|
|
|
@ -35,4 +35,8 @@ export class ProbeService {
|
||||||
return this.rpcService.call<boolean>('ProbeService.remove', id);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,10 @@ import { Probe } from '../../model';
|
||||||
|
|
||||||
|
|
||||||
export enum ActionType {
|
export enum ActionType {
|
||||||
Modify = '[probe.detail] Modify',
|
Modify = '[probe.modify] Modify',
|
||||||
ModifySuccess = '[probe.detail] ModifySuccess',
|
ModifyDisplayName = '[probe.modify] ModifyDisplayName',
|
||||||
ModifyFailure = '[probe.detail] ModifyFailure',
|
ModifySuccess = '[probe.modify] ModifySuccess',
|
||||||
|
ModifyFailure = '[probe.modify] ModifyFailure',
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Modify implements Action {
|
export class Modify implements Action {
|
||||||
|
@ -29,9 +30,16 @@ export class ModifyFailure implements Action {
|
||||||
constructor(public payload: RPCClientError) {}
|
constructor(public payload: RPCClientError) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class ModifyDisplayName implements Action {
|
||||||
|
readonly type = ActionType.ModifyDisplayName;
|
||||||
|
|
||||||
|
constructor(public payload: {id: string, displayName: string}) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export type Actions =
|
export type Actions =
|
||||||
| Modify
|
| Modify
|
||||||
| ModifySuccess
|
| ModifySuccess
|
||||||
| ModifyFailure
|
| ModifyFailure
|
||||||
|
| ModifyDisplayName
|
||||||
;
|
;
|
||||||
|
|
|
@ -21,6 +21,7 @@ import { ProbeService } from '../../service/probe.service';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Modify,
|
Modify,
|
||||||
|
ModifyDisplayName,
|
||||||
ModifySuccess,
|
ModifySuccess,
|
||||||
ModifyFailure,
|
ModifyFailure,
|
||||||
ActionType
|
ActionType
|
||||||
|
@ -46,4 +47,16 @@ export class Effects {
|
||||||
.catch((error: RPCClientError) => {
|
.catch((error: RPCClientError) => {
|
||||||
return of(new ModifyFailure(error));
|
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));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,14 @@ export function reducer(state = initialState, action: Actions): State {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ActionType.ModifyDisplayName: {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
error: null,
|
||||||
|
isPending: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user