From 2c1f3727a703634cf62c63cfc4a3d4bb30fe2d9c Mon Sep 17 00:00:00 2001 From: Aijana Schumann Date: Fri, 7 May 2021 13:56:52 +0200 Subject: Add customization of networkmap Add customization capabilities to the networkmap Issue-ID: CCSDK-2938 Signed-off-by: Aijana Schumann Change-Id: Ibd3fe258d02939ea69b21de25569f20d9087f693 --- .../src/handlers/connectivityReducer.ts | 9 ++-- .../apps/networkMapApp/src/handlers/rootReducer.ts | 7 ++- .../networkMapApp/src/handlers/settingsReducer.ts | 61 ++++++++++++++++++++++ 3 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 sdnr/wt/odlux/apps/networkMapApp/src/handlers/settingsReducer.ts (limited to 'sdnr/wt/odlux/apps/networkMapApp/src/handlers') diff --git a/sdnr/wt/odlux/apps/networkMapApp/src/handlers/connectivityReducer.ts b/sdnr/wt/odlux/apps/networkMapApp/src/handlers/connectivityReducer.ts index 7214705e1..8ab82f2e9 100644 --- a/sdnr/wt/odlux/apps/networkMapApp/src/handlers/connectivityReducer.ts +++ b/sdnr/wt/odlux/apps/networkMapApp/src/handlers/connectivityReducer.ts @@ -17,12 +17,12 @@ */ import { IActionHandler } from "../../../../framework/src/flux/action"; -import { IsTopologyServerReachableAction, IsTileServerReachableAction } from "../actions/connectivityAction"; +import { IsTopologyServerReachableAction, IsTileServerReachableAction, IsBusycheckingConnectivityAction } from "../actions/connectivityAction"; -export type connectivityState = {isToplogyServerAvailable: boolean, isTileServerAvailable: boolean }; +export type connectivityState = {isToplogyServerAvailable: boolean, isTileServerAvailable: boolean, isBusy: boolean }; -const initialState: connectivityState = {isToplogyServerAvailable: true, isTileServerAvailable: true}; +const initialState: connectivityState = {isToplogyServerAvailable: true, isTileServerAvailable: true, isBusy: true}; export const ConnectivityReducer: IActionHandler =(state=initialState, action)=> { @@ -32,6 +32,9 @@ export const ConnectivityReducer: IActionHandler =(state=init else if (action instanceof IsTileServerReachableAction){ state = Object.assign({}, state, { isTileServerAvailable: action.reachable }); + }else if(action instanceof IsBusycheckingConnectivityAction){ + state = {...state, isBusy: action.isBusy} + } return state; diff --git a/sdnr/wt/odlux/apps/networkMapApp/src/handlers/rootReducer.ts b/sdnr/wt/odlux/apps/networkMapApp/src/handlers/rootReducer.ts index c9c475411..697dbd7a0 100644 --- a/sdnr/wt/odlux/apps/networkMapApp/src/handlers/rootReducer.ts +++ b/sdnr/wt/odlux/apps/networkMapApp/src/handlers/rootReducer.ts @@ -23,13 +23,15 @@ import { PopupsReducer, popupStoreState } from "./popupReducer"; import { MapReducer, mapState } from "./mapReducer"; import { SearchReducer, searchState } from "./searchReducer"; import { connectivityState, ConnectivityReducer } from './connectivityReducer'; +import { SettingsReducer, SettingsState } from './settingsReducer'; export interface INetworkAppStoreState{ details: DetailsStoreState, popup: popupStoreState, map: mapState, search: searchState, - connectivity: connectivityState + connectivity: connectivityState, + settings: SettingsState } declare module '../../../../framework/src/store/applicationStore' { @@ -43,7 +45,8 @@ const appHandler = { popup: PopupsReducer, map: MapReducer, search: SearchReducer, - connectivity: ConnectivityReducer}; + connectivity: ConnectivityReducer, + settings: SettingsReducer}; export const networkmapRootHandler = combineActionHandler(appHandler) diff --git a/sdnr/wt/odlux/apps/networkMapApp/src/handlers/settingsReducer.ts b/sdnr/wt/odlux/apps/networkMapApp/src/handlers/settingsReducer.ts new file mode 100644 index 000000000..977a379a0 --- /dev/null +++ b/sdnr/wt/odlux/apps/networkMapApp/src/handlers/settingsReducer.ts @@ -0,0 +1,61 @@ +/** + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt odlux + * ================================================================================================= + * Copyright (C) 2021 highstreet technologies GmbH Intellectual Property. All rights reserved. + * ================================================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * ============LICENSE_END========================================================================== + */ + +import { NetworkMapSettings, NetworkMapThemes } from "../model/settings"; +import { IActionHandler } from "../../../../framework/src/flux/action"; +import { SetBusyLoadingAction, SetMapSettingsAction, SetSettingsAction, SetThemeSettingsAction } from "../actions/settingsAction"; + +export type SettingsState = { + mapSettings: NetworkMapSettings|null, + themes: NetworkMapThemes, + isLoadingData: boolean +}; + + +const defaultThemes:NetworkMapThemes = {networkMapThemes:{themes: [ + + {key: "light", site: "#11b4da", selectedSite: "#116bda", fiberLink: "#1154d9", microwaveLink: "#039903"}, + {key: "dark", site: "#000000", selectedSite: "#6e6e6e", fiberLink: "#0a2a6b", microwaveLink: "#005200"}, +]}} + +const initialState: SettingsState = { + mapSettings: null, + themes: defaultThemes, + isLoadingData: true + +}; + +export const SettingsReducer: IActionHandler = (state = initialState, action) => { + + if(action instanceof SetSettingsAction){ + state = { + isLoadingData: false, + mapSettings: {networkMap: action.settings.networkMap}, + themes:{networkMapThemes: {themes: action.settings.networkMapThemes.themes}} + }; + }else if(action instanceof SetMapSettingsAction){ + state={...state, mapSettings: action.settings}; + }else if(action instanceof SetThemeSettingsAction){ + state={...state, themes:{networkMapThemes: {themes: action.settings.networkMapThemes.themes}}}; + }else if(action instanceof SetBusyLoadingAction){ + state={...state, isLoadingData: action.busy}; + } + + return state; + +} \ No newline at end of file -- cgit 1.2.3-korg