diff options
Diffstat (limited to 'sdnr/wt/odlux/apps/networkMapApp/src/handlers')
3 files changed, 15 insertions, 12 deletions
diff --git a/sdnr/wt/odlux/apps/networkMapApp/src/handlers/detailsReducer.ts b/sdnr/wt/odlux/apps/networkMapApp/src/handlers/detailsReducer.ts index f573009bd..67e10e629 100644 --- a/sdnr/wt/odlux/apps/networkMapApp/src/handlers/detailsReducer.ts +++ b/sdnr/wt/odlux/apps/networkMapApp/src/handlers/detailsReducer.ts @@ -18,15 +18,15 @@ import { IActionHandler } from '../../../../framework/src/flux/action'; import { link } from "../model/link"; -import { site, Device } from "../model/site"; +import { Site, Device } from "../model/site"; import { HistoryEntry } from "../model/historyEntry"; -import { SelectSiteAction, SelectLinkAction, AddToHistoryAction, ClearHistoryAction, IsBusyCheckingDeviceListAction, FinishedLoadingDeviceListAction, ClearLoadedDevicesAction, ClearDetailsAction } from '../actions/detailsAction'; +import { SelectSiteAction, SelectLinkAction, AddToHistoryAction, ClearHistoryAction, IsBusyCheckingDeviceListAction, FinishedLoadingDeviceListAction, ClearLoadedDevicesAction, ClearDetailsAction, InitializeLoadedDevicesAction } from '../actions/detailsAction'; export type DetailsStoreState={ - data: site | link | null, + data: Site | link | null, history: HistoryEntry[], isBusyCheckingDeviceList: boolean, - checkedDevices: Device[] | null + checkedDevices: Device[] } @@ -34,7 +34,7 @@ const initialState: DetailsStoreState = { data: null, history:[], isBusyCheckingDeviceList: false, - checkedDevices: null + checkedDevices: [] } export const DetailsReducer:IActionHandler<DetailsStoreState>=(state = initialState, action)=>{ @@ -59,8 +59,10 @@ export const DetailsReducer:IActionHandler<DetailsStoreState>=(state = initialSt state = Object.assign({}, state, {checkedDevices: action.devices}); }else if(action instanceof ClearLoadedDevicesAction){ - state = Object.assign({}, state, {checkedDevices: null}); + state = Object.assign({}, state, {checkedDevices: []}); + }else if(action instanceof InitializeLoadedDevicesAction){ + state = Object.assign({}, state, {checkedDevices: action.devices}); } diff --git a/sdnr/wt/odlux/apps/networkMapApp/src/handlers/mapReducer.ts b/sdnr/wt/odlux/apps/networkMapApp/src/handlers/mapReducer.ts index 5c1c6d285..b820746b5 100644 --- a/sdnr/wt/odlux/apps/networkMapApp/src/handlers/mapReducer.ts +++ b/sdnr/wt/odlux/apps/networkMapApp/src/handlers/mapReducer.ts @@ -56,12 +56,12 @@ export const MapReducer: IActionHandler<mapState> = (state=initialState, action: } else if(action instanceof HighlightSiteAction){ - state = Object.assign({}, state, {selectedLink: null, selectedSite:{type: "Feature", properties: {id: action.site.name, type:action.site.type}, geometry:{type:"Point", coordinates:[action.site.geoLocation.lon,action.site.geoLocation.lat ]}}}) + state = Object.assign({}, state, {selectedLink: null, selectedSite:{type: "Feature", properties: {id: action.site.name, type:action.site.type}, geometry:{type:"Point", coordinates:[action.site.location.lon,action.site.location.lat ]}}}) }else if (action instanceof ZoomToSearchResultAction){ state = Object.assign({}, state, {zoomToElement:{lat: action.lat, lon: action.lon}}); }else if (action instanceof AddAlarmAction){ - state = Object.assign({}, state, {alarmlement:action.element}); + state = Object.assign({}, state, {alarmlement:{type: "Feature", properties: {id: action.site.name, type:action.site.type}, geometry:{type:"Point", coordinates:[action.site.location.lon,action.site.location.lat ]}}}); }else if(action instanceof SetCoordinatesAction){ state = Object.assign({}, state, {lat:action.lat, lon: action.lon, zoom:action.zoom}); diff --git a/sdnr/wt/odlux/apps/networkMapApp/src/handlers/popupReducer.ts b/sdnr/wt/odlux/apps/networkMapApp/src/handlers/popupReducer.ts index dcac9c9c2..deb366e09 100644 --- a/sdnr/wt/odlux/apps/networkMapApp/src/handlers/popupReducer.ts +++ b/sdnr/wt/odlux/apps/networkMapApp/src/handlers/popupReducer.ts @@ -16,17 +16,18 @@ * ============LICENSE_END========================================================================== */ +import { PopupElement } from 'model/popupElements'; import { IActionHandler } from '../../../../framework/src/flux/action'; import { SelectMultipleLinksAction, SelectMultipleSitesAction, SetPopupPositionAction } from "../actions/popupActions"; export type popupStoreState = { - selectionPendingForIds: string[], + selectionPendingForElements: PopupElement[], pendingDataType: "link"|"site"| "", position: { top: number, left: number } }; const initialState: popupStoreState = { - selectionPendingForIds: [], + selectionPendingForElements: [], pendingDataType: "", position: { top: 0, left: 0 } }; @@ -34,10 +35,10 @@ const initialState: popupStoreState = { export const PopupsReducer: IActionHandler<popupStoreState> = (state = initialState, action) => { if(action instanceof SelectMultipleLinksAction){ - state = Object.assign({}, state, { selectionPendingForIds: action.ids, pendingDataType: "link", isSelectionNeeded: true }); + state = Object.assign({}, state, { selectionPendingForElements: action.elements, pendingDataType: "link", isSelectionNeeded: true }); }else if(action instanceof SelectMultipleSitesAction){ - state = Object.assign({}, state, { selectionPendingForIds: action.ids, pendingDataType: "site", isSelectionNeeded: true }); + state = Object.assign({}, state, { selectionPendingForElements: action.elements, pendingDataType: "site", isSelectionNeeded: true }); }else if(action instanceof SetPopupPositionAction){ state= Object.assign({}, state, {position:{top:action.top, left: action.left}}) |