Interactive interface for browsing global, full-resolution satellite imagery
hide layer related notifications in toolbar
Jason Kentdc734ab78264
diff --git a/web/js/components/layer/product-picker/browse/measurement-layer-row.js b/web/js/components/layer/product-picker/browse/measurement-layer-row.jsindex 660346227..3fee58d20 100644--- a/web/js/components/layer/product-picker/browse/measurement-layer-row.js+++ b/web/js/components/layer/product-picker/browse/measurement-layer-row.js@@ -19,7 +19,7 @@ import { getLayerNoticesForLayer } from '../../../../modules/notifications/util'* @class LayerList* @extends React.Component*/-export function MeasurementLayerRow (props) {+function MeasurementLayerRow (props) {const {isEnabled, removeLayer, addLayer, layer, measurementId, title, selectedDate, layerNotices,} = props;diff --git a/web/js/containers/notifications.js b/web/js/containers/notifications.jsindex 6e4fb695f..7ef1421c7 100644--- a/web/js/containers/notifications.js+++ b/web/js/containers/notifications.js@@ -7,7 +7,7 @@ import { getNumberOfTypeNotSeen } from '../modules/notifications/util';const Notifications = (props) => {const { object } = props;const {- messages, outages, alerts, layerNotices,+ messages, outages, alerts,} = object;return (<div className="wv-notify-modal">@@ -26,11 +26,6 @@ const Notifications = (props) => {type="message"numberNotSeen={getNumberOfTypeNotSeen('message', messages)}/>- <NotificationBlock- arr={layerNotices}- type="message"- numberNotSeen={getNumberOfTypeNotSeen('layerNotices', layerNotices)}- /></div>);};diff --git a/web/js/modules/notifications/actions.js b/web/js/modules/notifications/actions.jsindex bee8723ec..6c082ac0e 100644--- a/web/js/modules/notifications/actions.js+++ b/web/js/modules/notifications/actions.js@@ -4,19 +4,14 @@ import {SET_NOTIFICATIONS,NOTIFICATIONS_SEEN,} from './constants';-import { getActiveLayers } from '../layers/selectors';export function requestNotifications(location, type) {return (dispatch) => requestAction(dispatch, REQUEST_NOTIFICATIONS, location);}export function setNotifications(array) {- return (dispatch, getState) => {- const activeLayers = getActiveLayers(getState());- dispatch({- type: SET_NOTIFICATIONS,- array,- activeLayers,- });+ return {+ type: SET_NOTIFICATIONS,+ array,};}export function notificationsSeen() {diff --git a/web/js/modules/notifications/constants.js b/web/js/modules/notifications/constants.jsindex fd29d0e9a..4f2580832 100644--- a/web/js/modules/notifications/constants.js+++ b/web/js/modules/notifications/constants.js@@ -6,6 +6,7 @@ export const SET_NOTIFICATIONS = 'NOTIFICATIONS/SET_NOTIFICATION_RESPONSE';export const NOTIFICATIONS_SEEN = 'NOTIFICATIONS/NOTIFICATIONS_HAVE_BEEN_SEEN';export const STATUS_REQUEST_URL = 'https://status.earthdata.nasa.gov/api/v1/notifications?domain=https%3A%2F%2Fworldview.earthdata.nasa.gov';+export const MOCK_RESPONSE_BODY = [{id: 537,@@ -21,26 +22,15 @@ export const MOCK_RESPONSE_BODY = [path: '',},];+export const MOCK_RESPONSE = {success: true,notifications: MOCK_RESPONSE_BODY,};+export const MOCK_SORTED_NOTIFICATIONS = {messages: [],- outages: [- {- id: 537,- notification_type: 'outage',- message: 'This is a test Outage',- updated_at: '2018-05-20T16:26:43.013-04:00',- created_at: '2018-05-20T16:23:37.049-04:00',- starttime: null,- endtime: null,- applications: ['Worldview (OPS)'],- domains: ['https://worldview.earthdata.nasa.gov'],- dismissible: true,- path: '',- },- ],+ outages: MOCK_RESPONSE_BODY,alerts: [],+ layerNotices: [],};diff --git a/web/js/modules/notifications/reducers.js b/web/js/modules/notifications/reducers.jsindex 71756f4e6..dd89cc9f9 100644--- a/web/js/modules/notifications/reducers.js+++ b/web/js/modules/notifications/reducers.js@@ -29,7 +29,7 @@ export function notificationsReducer(state = notificationReducerState, action) {return {...state,- number: getCount(notificationsByType, action.activeLayers),+ number: getCount(notificationsByType),type: getPriority(notificationsByType),isActive: true,object: notificationsByType,diff --git a/web/js/modules/notifications/reducers.test.js b/web/js/modules/notifications/reducers.test.jsindex db28fa7d3..6ed33aa5f 100644--- a/web/js/modules/notifications/reducers.test.js+++ b/web/js/modules/notifications/reducers.test.js@@ -44,7 +44,7 @@ describe('notificationsReducer', () => {});test(`${constants.SET_NOTIFICATIONS- }action type should return object containing sorted mock object`,+ } action type should return object containing sorted mock object`,() => {expect(notificationsReducer([], {@@ -61,7 +61,7 @@ describe('notificationsReducer', () => {);test(`${constants.SET_NOTIFICATIONS- }action type should return object containing sorted mock object`,+ } action type should return object containing sorted mock object`,() => {expect(notificationsReducer(notificationReducerState, {diff --git a/web/js/modules/notifications/util.js b/web/js/modules/notifications/util.jsindex 9806f1aa9..b048a5bfd 100644--- a/web/js/modules/notifications/util.js+++ b/web/js/modules/notifications/util.js@@ -30,7 +30,7 @@ export function separateByType(notifications) {notifications.forEach((notification) => {const { notification_type: type, path } = notification;- if (path.contains(LAYER_NOTICE)) {+ if (path.includes(LAYER_NOTICE)) {layerNotices.push(notification);return;}@@ -88,26 +88,15 @@ export function getPriority(sortedNotifications) {* @private* @returns {Number}*/-export function getCount(notifications, activeLayers) {+export function getCount(notifications) {const {- messages, outages, alerts, layerNotices,+ messages, outages, alerts,} = notifications;- const activeLayerIds = Object.keys(activeLayers);const messageCount = getNumberOfTypeNotSeen(NOTIFICATION_MSG, messages);const alertCount = getNumberOfTypeNotSeen(NOTIFICATION_ALERT, alerts);const outageCount = getNumberOfTypeNotSeen(NOTIFICATION_OUTAGE, outages);-- // If any of the layers marked in layerNotices array are currently active,- // include in the count.- let layerNoticeCount = 0;- layerNotices.forEach((notice) => {- if (activeLayerIds.some((id) => notice.layers.includes(id))) {- layerNoticeCount += 1;- }- });-- return messageCount + outageCount + alertCount + layerNoticeCount;+ return messageCount + outageCount + alertCount;}export function addToLocalStorage({ messages, outages, alerts }) {