diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/vue-components/secondary-parameter-controls.vue b/assets/src/scripts/monitoring-location/components/hydrograph/vue-components/secondary-parameter-controls.vue index 8d303ecb7f14913dfb4d4f0c9510dfc7c46d6556..1d580ca464ef59d3344aef74fd60a2868d986cfd 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/vue-components/secondary-parameter-controls.vue +++ b/assets/src/scripts/monitoring-location/components/hydrograph/vue-components/secondary-parameter-controls.vue @@ -23,7 +23,7 @@ import {ref, inject} from 'vue'; import {useActions} from 'redux-connect-vue'; -import {setSecondaryIVDataVisibility, setCompareDataVisibility, setMedianDataVisibility} from 'ml/store/hydrograph-state'; +import {setSecondaryIVDataVisibility, setCompareDataVisibility, setMedianDataVisibility, setSelectedSecondaryIVMethodID} from 'ml/store/hydrograph-state'; import {retrieveSecondParameterIVData} from 'ml/store/hydrograph-data'; import {getTimeRange} from 'ml/selectors/hydrograph-data-selector'; import {showDataIndicators} from '../data-indicator'; @@ -55,7 +55,8 @@ export default { setSecondaryIVDataVisibility, setCompareDataVisibility, setMedianDataVisibility, - retrieveSecondParameterIVData + retrieveSecondParameterIVData, + setSelectedSecondaryIVMethodID }); const showSecondParameterList = ref(false); @@ -96,6 +97,8 @@ export default { endTime: currentTimeRange.end } ).then(() => { + const sortedMethods = 'new method id'; + actions.setSelectedSecondaryIVMethodID(sortedMethods); showDataIndicators(false, reduxStore); }); }; diff --git a/assets/src/scripts/monitoring-location/store/hydrograph-state.js b/assets/src/scripts/monitoring-location/store/hydrograph-state.js index de21dcedf2096b9a2e1afc4bb2b280bf14f8b346..807cb3ae32526a738d2e8fb0e74e0ef734b32264 100644 --- a/assets/src/scripts/monitoring-location/store/hydrograph-state.js +++ b/assets/src/scripts/monitoring-location/store/hydrograph-state.js @@ -10,6 +10,7 @@ export const INITIAL_STATE = { selectedTimeSpan: 'P7D', selectedParameterCode: null, selectedIVMethodID: null, + selectedSecondaryIVMethodID: null, graphCursorOffset: null, graphBrushOffset: null }; @@ -75,6 +76,19 @@ export const setSelectedIVMethodID = function(methodID) { }; }; +/* + * Synchronous action to set the selected method ID secondary parameter (uniquely identifies the IV time series). + * Some parameter codes have more than one IV time series. The method ID distinguishes these + * @param {String} methodID + * @return {Object} - Redux action + */ +export const setSelectedSecondaryIVMethodID = function(methodID) { + return { + type: 'SET_SELECTED_SECONDARY_IV_METHOD_ID', + methodID + }; +}; + /* * Synchronous action sets the time span of the hydrograph. * @param {String or Object} timeSpan - Can either be a String representing an ISO8601 Duration or an @@ -178,6 +192,12 @@ export const hydrographStateReducer = function(hydrographState = INITIAL_STATE, selectedIVMethodID: action.methodID }; + case 'SET_SELECTED_SECONDARY_IV_METHOD_ID': + return { + ...hydrographState, + selectedSecondaryIVMethodID: action.methodID + }; + case 'SET_SELECTED_TIME_SPAN': if (typeof action.timeSpan === 'string') { return {