Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

redux code cleanup

Benjamin King1ef953d9c984
diff --git a/web/js/app.js b/web/js/app.js
index f315809e2..55c2f8939 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -103,7 +103,9 @@ class App extends React.Component {
<div id="timewheels" style={{ display: 'none' }} />
<Test />
- <Timeline />
+ <ErrorBoundary>
+ <Timeline />
+ </ErrorBoundary>
<OlCoordinates mouseEvents={this.props.mapMouseEvents} />
<div id="wv-animation-widet-case">
{/* {config.features.animation ? <AnimationWidget /> : ''} */}
diff --git a/web/js/combine-ui.js b/web/js/combine-ui.js
index cd4b4d1c4..183d05542 100644
--- a/web/js/combine-ui.js
+++ b/web/js/combine-ui.js
@@ -40,40 +40,21 @@ export function combineUi(models, config, MapMouseEvents, store) {
} catch (e) {
util.warn(e);
}
- function timelineInit() {
- // ui.timeline = timeline(models, config, ui);
- // ui.timeline.data = timelineData(models, config, ui);
- // ui.timeline.zoom = timelineZoom(models, config, ui);
- // ui.timeline.ticks = timelineTicks(models, config, ui);
- // ui.timeline.pick = timelinePick(models, config, ui);
- // ui.timeline.pan = timelinePan(models, config, ui);
- // ui.timeline.input = timelineInput(models, config, ui);
- // ui.timeline.config = timelineConfig(models, config, ui);
- if (config.features.animation) {
- // ui.anim = {};
- // ui.anim.rangeselect = animationRangeSelect(models, config, ui); // SETS STATE: NEEDS TO LOAD BEFORE ANIMATION WIDGET
- // ui.anim.widget = animationWidget(models, config, ui);
- // ui.anim.gif = animationGif(models, config, ui);
- // ui.anim.ui = animationUi(models, ui);
- }
- if (config.features.compare) {
- // ui.timeline.compare = timelineCompare(models, config, ui);
- }
- ui.dateLabel = dateLabel(models);
- }
+ // ui.dateLabel = dateLabel(models);
+
if (config.startDate) {
if (!util.browser.small) {
// If mobile device, do not build timeline
// timelineInit();
}
- ui.dateWheels = dateWheels(models, config);
+ // ui.dateWheels = dateWheels(models, config);
}
if (config.features.dataDownload) {
- ui.data = dataUi(models, store, ui, config);
+ ui.data = dataUi(store, ui, config);
}
if (config.features.naturalEvents) {
- ui.naturalEvents = naturalEventsUI(models, ui, config, store);
+ ui.naturalEvents = naturalEventsUI(ui, config, store);
}
registerMapMouseHandlers(ui.map.proj, MapMouseEvents);
// Sink all focus on inputs if click unhandled
diff --git a/web/js/containers/error-boundary.js b/web/js/containers/error-boundary.js
index e46a30a37..e4dcf8daf 100644
--- a/web/js/containers/error-boundary.js
+++ b/web/js/containers/error-boundary.js
@@ -52,6 +52,6 @@ export default connect(
mapDispatchToProps
)(ErrorBoundary);
ErrorBoundary.propTypes = {
- children: PropTypes.array,
+ children: PropTypes.object,
errorAlert: PropTypes.func
};
diff --git a/web/js/containers/sidebar/events.js b/web/js/containers/sidebar/events.js
index bc4da3f08..3b1a11731 100644
--- a/web/js/containers/sidebar/events.js
+++ b/web/js/containers/sidebar/events.js
@@ -64,17 +64,26 @@ class Events extends React.Component {
visibleEvents,
sources,
height,
- deselectEvent
+ deselectEvent,
+ hasRequestError
} = this.props;
-
+ const errorOrLoadingText = isLoading
+ ? 'Loading...'
+ : hasRequestError
+ ? 'There has been an ERROR retrieving events from the EONET events API'
+ : '';
return (
<Scrollbars style={{ maxHeight: height + 'px' }}>
<div id="wv-events">
<span
className="events-loading-text"
- style={isLoading ? { display: 'block' } : { display: 'none' }}
+ style={
+ isLoading || hasRequestError
+ ? { display: 'block' }
+ : { display: 'none' }
+ }
>
- Loading...
+ {errorOrLoadingText}
</span>
<div
className="wv-eventslist sidebar-panel"
@@ -137,7 +146,10 @@ function mapStateToProps(state) {
requestedEvents.isLoading ||
requestedEventSources.isLoading ||
requestedEventCategories.isLoading;
-
+ const hasRequestError =
+ requestedEvents.error ||
+ requestedEventSources.error ||
+ requestedEventCategories.error;
let visibleEvents = {};
const events = lodashGet(requestedEvents, 'response');
const sources = lodashGet(requestedEventSources, 'response');
@@ -154,6 +166,7 @@ function mapStateToProps(state) {
events,
showAll,
isLoading,
+ hasRequestError,
sources,
selected,
visibleEvents,
@@ -173,5 +186,13 @@ Events.propTypes = {
visibleEvents: PropTypes.object,
height: PropTypes.number,
deselectEvent: PropTypes.func,
- tabTypes: PropTypes.object
+ tabTypes: PropTypes.object,
+ requestSources: PropTypes.object,
+ requestCategories: PropTypes.object,
+ requestEvents: PropTypes.object,
+ apiURL: PropTypes.string,
+ config: PropTypes.object,
+ showAll: PropTypes.bool,
+ isLoading: PropTypes.bool,
+ selectEvent: PropTypes.func
};