feature/IO-3026-Enhanced-Notifications - Initial commit
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -67,6 +67,17 @@ export const setUpdateAvailable = (isUpdateAvailable) => ({
|
||||
type: ApplicationActionTypes.SET_UPDATE_AVAILABLE,
|
||||
payload: isUpdateAvailable
|
||||
});
|
||||
|
||||
export const setAlerts = (alerts) => ({
|
||||
type: ApplicationActionTypes.SET_ALERTS,
|
||||
payload: alerts
|
||||
});
|
||||
|
||||
export const addAlerts = (alerts) => ({
|
||||
type: ApplicationActionTypes.ADD_ALERTS,
|
||||
payload: alerts
|
||||
});
|
||||
|
||||
export const setWssStatus = (status) => ({
|
||||
type: ApplicationActionTypes.SET_WSS_STATUS,
|
||||
payload: status
|
||||
|
||||
@@ -15,7 +15,8 @@ const INITIAL_STATE = {
|
||||
error: null
|
||||
},
|
||||
jobReadOnly: false,
|
||||
partnerVersion: null
|
||||
partnerVersion: null,
|
||||
alerts: {}
|
||||
};
|
||||
|
||||
const applicationReducer = (state = INITIAL_STATE, action) => {
|
||||
@@ -91,6 +92,26 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
|
||||
case ApplicationActionTypes.SET_WSS_STATUS: {
|
||||
return { ...state, wssStatus: action.payload };
|
||||
}
|
||||
case ApplicationActionTypes.SET_ALERTS: {
|
||||
const alertsMap = {};
|
||||
action.payload.forEach((alert) => {
|
||||
alertsMap[alert.id] = alert;
|
||||
});
|
||||
return {
|
||||
...state,
|
||||
alerts: alertsMap
|
||||
};
|
||||
}
|
||||
case ApplicationActionTypes.ADD_ALERTS: {
|
||||
const newAlertsMap = { ...state.alerts };
|
||||
action.payload.forEach((alert) => {
|
||||
newAlertsMap[alert.id] = alert;
|
||||
});
|
||||
return {
|
||||
...state,
|
||||
alerts: newAlertsMap
|
||||
};
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -23,3 +23,4 @@ export const selectOnline = createSelector([selectApplication], (application) =>
|
||||
export const selectProblemJobs = createSelector([selectApplication], (application) => application.problemJobs);
|
||||
export const selectUpdateAvailable = createSelector([selectApplication], (application) => application.updateAvailable);
|
||||
export const selectWssStatus = createSelector([selectApplication], (application) => application.wssStatus);
|
||||
export const selectAlerts = createSelector([selectApplication], (application) => application.alerts);
|
||||
|
||||
@@ -13,6 +13,8 @@ const ApplicationActionTypes = {
|
||||
INSERT_AUDIT_TRAIL: "INSERT_AUDIT_TRAIL",
|
||||
SET_PROBLEM_JOBS: "SET_PROBLEM_JOBS",
|
||||
SET_UPDATE_AVAILABLE: "SET_UPDATE_AVAILABLE",
|
||||
SET_WSS_STATUS: "SET_WSS_STATUS"
|
||||
SET_WSS_STATUS: "SET_WSS_STATUS",
|
||||
SET_ALERTS: "SET_ALERTS",
|
||||
ADD_ALERTS: "ADD_ALERTS"
|
||||
};
|
||||
export default ApplicationActionTypes;
|
||||
|
||||
Reference in New Issue
Block a user