@@ -1,8 +1,11 @@ |
// @flow |
-import { setTabbedPanelWindowState } from 'catena/er2_map_userlayers/js/actions/tabbed_panel' |
+import { setTabbedPanelWindowState } from '@owsi/catena/er2_map_userlayers/js/actions/tabbed_panel' |
import * as types from '../constants/action_types' |
|
-const setFetchingDrHuc8s = isFetching => ({ type: types.SET_FETCHING_DR_HUC8S, isFetching }) |
+const setFetchingDrHuc8s = (isFetching) => ({ |
+ type: types.SET_FETCHING_DR_HUC8S, |
+ isFetching, |
+}) |
export const onGetDrHuc8s = () => (dispatch: Function, getState: Function) => { |
const token = getState().token.value |
const map = getState().map |
@@ -15,14 +18,17 @@ |
extent: map.mapView.extent, |
}), |
}) |
- .then(response => response.json()) |
+ .then((response) => response.json()) |
.then((json) => { |
dispatch({ type: types.SET_DR_HUC8S, drHuc8Data: json }) |
dispatch(setFetchingDrHuc8s(false)) |
}) |
} |
|
-const setFetchingDrHuc10s = isFetching => ({ type: types.SET_FETCHING_DR_HUC10S, isFetching }) |
+const setFetchingDrHuc10s = (isFetching) => ({ |
+ type: types.SET_FETCHING_DR_HUC10S, |
+ isFetching, |
+}) |
export const onGetDrHuc10s = () => (dispatch: Function, getState: Function) => { |
const token = getState().token.value |
const map = getState().map |
@@ -35,14 +41,17 @@ |
extent: map.mapView.extent, |
}), |
}) |
- .then(response => response.json()) |
+ .then((response) => response.json()) |
.then((json) => { |
dispatch({ type: types.SET_DR_HUC10S, drHuc10Data: json }) |
dispatch(setFetchingDrHuc10s(false)) |
}) |
} |
|
-const setFetchingDrHuc12s = isFetching => ({ type: types.SET_FETCHING_DR_HUC12S, isFetching }) |
+const setFetchingDrHuc12s = (isFetching) => ({ |
+ type: types.SET_FETCHING_DR_HUC12S, |
+ isFetching, |
+}) |
export const onGetDrHuc12s = () => (dispatch: Function, getState: Function) => { |
const token = getState().token.value |
const map = getState().map |
@@ -55,19 +64,28 @@ |
extent: map.mapView.extent, |
}), |
}) |
- .then(response => response.json()) |
+ .then((response) => response.json()) |
.then((json) => { |
dispatch({ type: types.SET_DR_HUC12S, drHuc12Data: json }) |
dispatch(setFetchingDrHuc12s(false)) |
}) |
} |
|
-const setFetchingDrCounties = isFetching => ({ type: types.SET_FETCHING_DR_COUNTIES, isFetching }) |
-export const onGetDrCounties = () => (dispatch: Function, getState: Function) => { |
+const setFetchingDrCounties = (isFetching) => ({ |
+ type: types.SET_FETCHING_DR_COUNTIES, |
+ isFetching, |
+}) |
+export const onGetDrCounties = () => ( |
+ dispatch: Function, |
+ getState: Function, |
+) => { |
const token = getState().token.value |
const map = getState().map |
|
- dispatch({ type: types.SET_DR_COUNTIES, drCountyData: { watersheds: null } }) |
+ dispatch({ |
+ type: types.SET_DR_COUNTIES, |
+ drCountyData: { watersheds: null }, |
+ }) |
dispatch(setFetchingDrCounties(true)) |
fetch(`/${getState().meta.name}/api/v1/dl/drCountyLayer/?token=${token}`, { |
method: 'POST', |
@@ -75,19 +93,28 @@ |
extent: map.mapView.extent, |
}), |
}) |
- .then(response => response.json()) |
+ .then((response) => response.json()) |
.then((json) => { |
dispatch({ type: types.SET_DR_COUNTIES, drCountyData: json }) |
dispatch(setFetchingDrCounties(false)) |
}) |
} |
|
-const setFetchingMunDrHuc8s = isFetching => ({ type: types.SET_FETCHING_MUN_DR_HUC8S, isFetching }) |
-export const onGetMunDrHuc8s = () => (dispatch: Function, getState: Function) => { |
+const setFetchingMunDrHuc8s = (isFetching) => ({ |
+ type: types.SET_FETCHING_MUN_DR_HUC8S, |
+ isFetching, |
+}) |
+export const onGetMunDrHuc8s = () => ( |
+ dispatch: Function, |
+ getState: Function, |
+) => { |
const token = getState().token.value |
const map = getState().map |
|
- dispatch({ type: types.SET_MUN_DR_HUC8S, munDrHuc8Data: { watersheds: null } }) |
+ dispatch({ |
+ type: types.SET_MUN_DR_HUC8S, |
+ munDrHuc8Data: { watersheds: null }, |
+ }) |
dispatch(setFetchingMunDrHuc8s(true)) |
fetch(`/${getState().meta.name}/api/v1/dl/munDrHuc8Layer/?token=${token}`, { |
method: 'POST', |
@@ -95,154 +122,248 @@ |
extent: map.mapView.extent, |
}), |
}) |
- .then(response => response.json()) |
+ .then((response) => response.json()) |
.then((json) => { |
dispatch({ type: types.SET_MUN_DR_HUC8S, munDrHuc8Data: json }) |
dispatch(setFetchingMunDrHuc8s(false)) |
}) |
} |
|
-const setFetchingMunDrHuc10s = isFetching => ({ type: types.SET_FETCHING_MUN_DR_HUC10S, isFetching }) |
-export const onGetMunDrHuc10s = () => (dispatch: Function, getState: Function) => { |
+const setFetchingMunDrHuc10s = (isFetching) => ({ |
+ type: types.SET_FETCHING_MUN_DR_HUC10S, |
+ isFetching, |
+}) |
+export const onGetMunDrHuc10s = () => ( |
+ dispatch: Function, |
+ getState: Function, |
+) => { |
const token = getState().token.value |
const map = getState().map |
|
- dispatch({ type: types.SET_MUN_DR_HUC10S, munDrHuc10Data: { watersheds: null } }) |
+ dispatch({ |
+ type: types.SET_MUN_DR_HUC10S, |
+ munDrHuc10Data: { watersheds: null }, |
+ }) |
dispatch(setFetchingMunDrHuc10s(true)) |
- fetch(`/${getState().meta.name}/api/v1/dl/munDrHuc10Layer/?token=${token}`, { |
- method: 'POST', |
- body: JSON.stringify({ |
- extent: map.mapView.extent, |
- }), |
- }) |
- .then(response => response.json()) |
+ fetch( |
+ `/${getState().meta.name}/api/v1/dl/munDrHuc10Layer/?token=${token}`, |
+ { |
+ method: 'POST', |
+ body: JSON.stringify({ |
+ extent: map.mapView.extent, |
+ }), |
+ }, |
+ ) |
+ .then((response) => response.json()) |
.then((json) => { |
dispatch({ type: types.SET_MUN_DR_HUC10S, munDrHuc10Data: json }) |
dispatch(setFetchingMunDrHuc10s(false)) |
}) |
} |
|
-const setFetchingMunDrHuc12s = isFetching => ({ type: types.SET_FETCHING_MUN_DR_HUC12S, isFetching }) |
-export const onGetMunDrHuc12s = () => (dispatch: Function, getState: Function) => { |
+const setFetchingMunDrHuc12s = (isFetching) => ({ |
+ type: types.SET_FETCHING_MUN_DR_HUC12S, |
+ isFetching, |
+}) |
+export const onGetMunDrHuc12s = () => ( |
+ dispatch: Function, |
+ getState: Function, |
+) => { |
const token = getState().token.value |
const map = getState().map |
|
- dispatch({ type: types.SET_MUN_DR_HUC12S, munDrHuc12Data: { watersheds: null } }) |
+ dispatch({ |
+ type: types.SET_MUN_DR_HUC12S, |
+ munDrHuc12Data: { watersheds: null }, |
+ }) |
dispatch(setFetchingMunDrHuc12s(true)) |
- fetch(`/${getState().meta.name}/api/v1/dl/munDrHuc12Layer/?token=${token}`, { |
- method: 'POST', |
- body: JSON.stringify({ |
- extent: map.mapView.extent, |
- }), |
- }) |
- .then(response => response.json()) |
+ fetch( |
+ `/${getState().meta.name}/api/v1/dl/munDrHuc12Layer/?token=${token}`, |
+ { |
+ method: 'POST', |
+ body: JSON.stringify({ |
+ extent: map.mapView.extent, |
+ }), |
+ }, |
+ ) |
+ .then((response) => response.json()) |
.then((json) => { |
dispatch({ type: types.SET_MUN_DR_HUC12S, munDrHuc12Data: json }) |
dispatch(setFetchingMunDrHuc12s(false)) |
}) |
} |
|
-const setFetchingMunDrCounties = isFetching => ({ type: types.SET_FETCHING_MUN_DR_COUNTIES, isFetching }) |
-export const onGetMunDrCounties = () => (dispatch: Function, getState: Function) => { |
+const setFetchingMunDrCounties = (isFetching) => ({ |
+ type: types.SET_FETCHING_MUN_DR_COUNTIES, |
+ isFetching, |
+}) |
+export const onGetMunDrCounties = () => ( |
+ dispatch: Function, |
+ getState: Function, |
+) => { |
const token = getState().token.value |
const map = getState().map |
|
- dispatch({ type: types.SET_MUN_DR_COUNTIES, munDrCountyData: { watersheds: null } }) |
+ dispatch({ |
+ type: types.SET_MUN_DR_COUNTIES, |
+ munDrCountyData: { watersheds: null }, |
+ }) |
dispatch(setFetchingMunDrCounties(true)) |
- fetch(`/${getState().meta.name}/api/v1/dl/munDrCountyLayer/?token=${token}`, { |
- method: 'POST', |
- body: JSON.stringify({ |
- extent: map.mapView.extent, |
- }), |
- }) |
- .then(response => response.json()) |
+ fetch( |
+ `/${getState().meta.name}/api/v1/dl/munDrCountyLayer/?token=${token}`, |
+ { |
+ method: 'POST', |
+ body: JSON.stringify({ |
+ extent: map.mapView.extent, |
+ }), |
+ }, |
+ ) |
+ .then((response) => response.json()) |
.then((json) => { |
dispatch({ type: types.SET_MUN_DR_COUNTIES, munDrCountyData: json }) |
dispatch(setFetchingMunDrCounties(false)) |
}) |
} |
|
-const setFetchingCoEcoregions = isFetching => ({ type: types.SET_FETCHING_CO_ECOREGIONS, isFetching }) |
-export const onGetCoEcoregions = () => (dispatch: Function, getState: Function) => { |
+const setFetchingCoEcoregions = (isFetching) => ({ |
+ type: types.SET_FETCHING_CO_ECOREGIONS, |
+ isFetching, |
+}) |
+export const onGetCoEcoregions = () => ( |
+ dispatch: Function, |
+ getState: Function, |
+) => { |
const token = getState().token.value |
const map = getState().map |
|
- dispatch({ type: types.SET_CO_ECOREGIONS, coEcoregionsData: { areas: null } }) |
+ dispatch({ |
+ type: types.SET_CO_ECOREGIONS, |
+ coEcoregionsData: { areas: null }, |
+ }) |
dispatch(setFetchingCoEcoregions(true)) |
- fetch(`/${getState().meta.name}/api/v1/dl/coEcoRegionsLayer/?token=${token}`, { |
- method: 'POST', |
- body: JSON.stringify({ |
- extent: map.mapView.extent, |
- }), |
- }) |
- .then(response => response.json()) |
+ fetch( |
+ `/${getState().meta.name}/api/v1/dl/coEcoRegionsLayer/?token=${token}`, |
+ { |
+ method: 'POST', |
+ body: JSON.stringify({ |
+ extent: map.mapView.extent, |
+ }), |
+ }, |
+ ) |
+ .then((response) => response.json()) |
.then((json) => { |
dispatch({ type: types.SET_CO_ECOREGIONS, coEcoregionsData: json }) |
dispatch(setFetchingCoEcoregions(false)) |
}) |
} |
|
-const setFetchingCoLandOwnership = isFetching => ({ type: types.SET_FETCHING_CO_LAND_OWNERSHIP, isFetching }) |
-export const onGetCoLandOwnership = () => (dispatch: Function, getState: Function) => { |
+const setFetchingCoLandOwnership = (isFetching) => ({ |
+ type: types.SET_FETCHING_CO_LAND_OWNERSHIP, |
+ isFetching, |
+}) |
+export const onGetCoLandOwnership = () => ( |
+ dispatch: Function, |
+ getState: Function, |
+) => { |
const token = getState().token.value |
const map = getState().map |
|
- dispatch({ type: types.SET_CO_LAND_OWNERSHIP, colandOwnerData: { areas: null } }) |
+ dispatch({ |
+ type: types.SET_CO_LAND_OWNERSHIP, |
+ colandOwnerData: { areas: null }, |
+ }) |
dispatch(setFetchingCoLandOwnership(true)) |
- fetch(`/${getState().meta.name}/api/v1/dl/coLandOwnershipLayer/?token=${token}`, { |
- method: 'POST', |
- body: JSON.stringify({ |
- extent: map.mapView.extent, |
- }), |
- }) |
- .then(response => response.json()) |
+ fetch( |
+ `/${ |
+ getState().meta.name |
+ }/api/v1/dl/coLandOwnershipLayer/?token=${token}`, |
+ { |
+ method: 'POST', |
+ body: JSON.stringify({ |
+ extent: map.mapView.extent, |
+ }), |
+ }, |
+ ) |
+ .then((response) => response.json()) |
.then((json) => { |
- dispatch({ type: types.SET_CO_LAND_OWNERSHIP, colandOwnerData: json }) |
+ dispatch({ |
+ type: types.SET_CO_LAND_OWNERSHIP, |
+ colandOwnerData: json, |
+ }) |
dispatch(setFetchingCoLandOwnership(false)) |
}) |
} |
|
-const setFetchingCoWatershedPlans = isFetching => ({ type: types.SET_FETCHING_CO_WATERSHED_PLANS, isFetching }) |
-export const onGetCoWatershedPlans = () => (dispatch: Function, getState: Function) => { |
+const setFetchingCoWatershedPlans = (isFetching) => ({ |
+ type: types.SET_FETCHING_CO_WATERSHED_PLANS, |
+ isFetching, |
+}) |
+export const onGetCoWatershedPlans = () => ( |
+ dispatch: Function, |
+ getState: Function, |
+) => { |
const token = getState().token.value |
const map = getState().map |
|
- dispatch({ type: types.SET_CO_WATERSHED_PLANS, coWatershedPlanData: { areas: null } }) |
+ dispatch({ |
+ type: types.SET_CO_WATERSHED_PLANS, |
+ coWatershedPlanData: { areas: null }, |
+ }) |
dispatch(setFetchingCoWatershedPlans(true)) |
- fetch(`/${getState().meta.name}/api/v1/dl/coWatershedPlansLayer/?token=${token}`, { |
- method: 'POST', |
- body: JSON.stringify({ |
- extent: map.mapView.extent, |
- }), |
- }) |
- .then(response => response.json()) |
+ fetch( |
+ `/${ |
+ getState().meta.name |
+ }/api/v1/dl/coWatershedPlansLayer/?token=${token}`, |
+ { |
+ method: 'POST', |
+ body: JSON.stringify({ |
+ extent: map.mapView.extent, |
+ }), |
+ }, |
+ ) |
+ .then((response) => response.json()) |
.then((json) => { |
- dispatch({ type: types.SET_CO_WATERSHED_PLANS, coWatershedPlanData: json }) |
+ dispatch({ |
+ type: types.SET_CO_WATERSHED_PLANS, |
+ coWatershedPlanData: json, |
+ }) |
dispatch(setFetchingCoWatershedPlans(false)) |
}) |
} |
|
-const setFetchingUrbanAreas = isFetching => ({ type: types.SET_FETCHING_URBAN_AREAS, isFetching }) |
-export const onGetMs4UrbanAreas = () => (dispatch: Function, getState: Function) => { |
+const setFetchingUrbanAreas = (isFetching) => ({ |
+ type: types.SET_FETCHING_URBAN_AREAS, |
+ isFetching, |
+}) |
+export const onGetMs4UrbanAreas = () => ( |
+ dispatch: Function, |
+ getState: Function, |
+) => { |
const token = getState().token.value |
const map = getState().map |
|
dispatch({ type: types.SET_URBAN_AREAS, urbanAreaData: { areas: null } }) |
dispatch(setFetchingUrbanAreas(true)) |
- fetch(`/${getState().meta.name}/api/v1/dl/urbanAreaDataLayer/?token=${token}`, { |
- method: 'POST', |
- body: JSON.stringify({ |
- extent: map.mapView.extent, |
- }), |
- }) |
- .then(response => response.json()) |
+ fetch( |
+ `/${getState().meta.name}/api/v1/dl/urbanAreaDataLayer/?token=${token}`, |
+ { |
+ method: 'POST', |
+ body: JSON.stringify({ |
+ extent: map.mapView.extent, |
+ }), |
+ }, |
+ ) |
+ .then((response) => response.json()) |
.then((json) => { |
dispatch({ type: types.SET_URBAN_AREAS, urbanAreaData: json }) |
dispatch(setFetchingUrbanAreas(false)) |
}) |
} |
|
-const setFetchingWwtfs = isFetching => ({ type: types.SET_FETCHING_WWTFS, isFetching }) |
+const setFetchingWwtfs = (isFetching) => ({ |
+ type: types.SET_FETCHING_WWTFS, |
+ isFetching, |
+}) |
export const onGetWwtfs = () => (dispatch: Function, getState: Function) => { |
const token = getState().token.value |
const map = getState().map |
@@ -255,15 +376,18 @@ |
extent: map.mapView.extent, |
}), |
}) |
- .then(response => response.json()) |
+ .then((response) => response.json()) |
.then((json) => { |
dispatch({ type: types.SET_WWTFS, wwtfsData: json }) |
dispatch(setFetchingWwtfs(false)) |
}) |
} |
|
-export const onDisplayWwtfDetails = (currentItem, wwtf) => (dispatch: Function, getState: Function) => { |
+export const onDisplayWwtfDetails = (currentItem, wwtf) => ( |
+ dispatch: Function, |
+ getState: Function, |
+) => { |
dispatch({ type: types.SET_WWTF_CURRENT, currentItem, wwtf }) |
dispatch(setTabbedPanelWindowState('maximized')) |
dispatch(onSetLayerType(7)) |
-} |
\ No newline at end of file |
+} |
@@ -1,43 +1,66 @@ |
// @flow |
-import { setMapExtent } from 'catena/er2_map_userlayers/js/actions/map' |
-import { onFetchMapState, setTabbedPanelWindowState } from 'catena/er2_map_userlayers/js/actions' |
+import { setMapExtent } from '@owsi/catena/er2_map_userlayers/js/actions/map' |
+import { |
+ onFetchMapState, |
+ setTabbedPanelWindowState, |
+} from '@owsi/catena/er2_map_userlayers/js/actions' |
import * as types from '../constants/action_types' |
|
-const setFetchingState = (isFetching: boolean) => |
- ({ type: types.SET_FETCHING_STATE, isFetching }) |
+const setFetchingState = (isFetching: boolean) => ({ |
+ type: types.SET_FETCHING_STATE, |
+ isFetching, |
+}) |
|
-const setFetchedState = (isFetched: boolean, state: { token: { value: string } }, meta: { version: string }) => |
- ({ type: types.SET_FETCHED_STATE, isFetched, state, meta }) |
+const setFetchedState = ( |
+ isFetched: boolean, |
+ state: { token: { value: string } }, |
+ meta: { version: string }, |
+) => ({ type: types.SET_FETCHED_STATE, isFetched, state, meta }) |
|
-export const setShowDisclaimer = show => ({ type: types.SHOW_DISCLAIMER, show }) |
+export const setShowDisclaimer = (show) => ({ |
+ type: types.SHOW_DISCLAIMER, |
+ show, |
+}) |
|
-const setPostFetchedState = state => |
- ({ type: types.SET_FETCHED_STATE_POST, state }) |
+const setPostFetchedState = (state) => ({ |
+ type: types.SET_FETCHED_STATE_POST, |
+ state, |
+}) |
|
// Fetches server state, e.g. to initialize the application. |
-export const fetchState = (location: { params: {} }) => (dispatch, getState) => { |
+export const fetchState = (location: { params: {} }) => ( |
+ dispatch, |
+ getState, |
+) => { |
let fetchError = false |
- const token = location.params.token ? location.params.token : getState().token.value |
+ const token = location.params.token |
+ ? location.params.token |
+ : getState().token.value |
const query = token ? `?token=${token}` : '' |
dispatch(setFetchingState(true)) |
- fetch(`/${getState().meta.name}/api/v1/state/${query}`).then((response) => { |
- fetchError = !response.ok |
- return response.json() |
- }).then((json) => { |
- dispatch(setFetchingState(false)) |
- if (fetchError) { |
- dispatch(setFetchedState(true, {})) |
- } else { |
- dispatch(setFetchedState(true, json.state, json.meta)) |
- dispatch(onFetchMapState()) |
- // Zoom to Colorado |
- dispatch(setMapExtent([-11992293, 4470150, -11507377, 4980749])) |
- // Open up south panel if there are results |
- if (json.state.appState.mcda.results && json.state.appState.mcda.results.length) { |
- dispatch(setTabbedPanelWindowState('opened')) |
+ fetch(`/${getState().meta.name}/api/v1/state/${query}`) |
+ .then((response) => { |
+ fetchError = !response.ok |
+ return response.json() |
+ }) |
+ .then((json) => { |
+ dispatch(setFetchingState(false)) |
+ if (fetchError) { |
+ dispatch(setFetchedState(true, {})) |
+ } else { |
+ dispatch(setFetchedState(true, json.state, json.meta)) |
+ dispatch(onFetchMapState()) |
+ // Zoom to Colorado |
+ dispatch(setMapExtent([-11992293, 4470150, -11507377, 4980749])) |
+ // Open up south panel if there are results |
+ if ( |
+ json.state.appState.mcda.results && |
+ json.state.appState.mcda.results.length |
+ ) { |
+ dispatch(setTabbedPanelWindowState('opened')) |
+ } |
} |
- } |
- }) |
+ }) |
} |
|
export const updateAppState = (which, fnSaved) => (dispatch, getState) => { |
@@ -45,25 +68,29 @@ |
appState: {}, |
} |
if (Array.isArray(which)) { |
- which.forEach(w => { |
+ which.forEach((w) => { |
newState.appState[w] = getState()[w] |
}) |
} else { |
newState.appState[which] = getState()[which] |
} |
const body = JSON.stringify(newState) |
- fetch(`/${getState().meta.name}/api/v1/state/?token=${getState().token.value}`, |
+ fetch( |
+ `/${getState().meta.name}/api/v1/state/?token=${ |
+ getState().token.value |
+ }`, |
{ |
body, |
method: 'PATCH', |
headers: { |
'Content-Type': 'application/json', |
}, |
- }) |
+ }, |
+ ) |
.then((ret) => { |
if (fnSaved) fnSaved() |
}) |
- .catch(ret => alert(ret)) |
+ .catch((ret) => alert(ret)) |
} |
|
export default fetchState |
@@ -1,4 +1,4 @@ |
- // @flow |
+// @flow |
import * as React from 'react' |
import OlGeoJSON from 'ol/format/GeoJSON' |
import OlVectorLayer from 'ol/layer/Vector' |
@@ -6,8 +6,8 @@ |
import OlStyleFill from 'ol/style/Fill' |
import OlStyleStroke from 'ol/style/Stroke' |
import Text from 'ol/style/Text' |
-import Map from 'catena/er2_map/src/map' |
-import { olUtils, styles } from 'catena/er2_ui' |
+import Map from '@owsi/catena/er2_map/src/map' |
+import { olUtils, styles } from '@owsi/catena/er2_ui' |
import SelectInteraction from 'ol/interaction/Select' |
import { click } from 'ol/events/condition' |
import * as d3 from 'd3-scale' |
@@ -54,8 +54,11 @@ |
const max = subRegionCount |
let range = range2 |
if (max < 3) range = range1 |
- const colorScale = d3.scaleLinear().domain([min, (max - |
- min) / 2, max]).range(range).nice() |
+ const colorScale = d3 |
+ .scaleLinear() |
+ .domain([min, (max - min) / 2, max]) |
+ .range(range) |
+ .nice() |
const color = colorScale(rank) |
return color |
} |
@@ -68,7 +71,13 @@ |
* Displays the Leaflet map canvas containing flow analysis areas |
*/ |
class AOIMap extends React.Component<Props> { |
+ constructor(props) { |
+ super(props) |
+ this.mapRef = React.createRef() |
+ } |
+ |
componentDidMount() { |
+ this.mapApp = this.mapRef.current |
this.addMapLayer(regionLayerName) |
this.addMapLayer(subRegionLayerName) |
this.updateAoi() |
@@ -79,11 +88,16 @@ |
if (this.props.aoi.regionGeometry !== prevProps.aoi.regionGeometry) { |
this.updateAoi() |
} |
- if ((this.props.aoi.subRegion !== prevProps.aoi.subRegion) |
- || (this.props.mcda.runStatus !== prevProps.mcda.runStatus)) { |
+ if ( |
+ this.props.aoi.subRegion !== prevProps.aoi.subRegion || |
+ this.props.mcda.runStatus !== prevProps.mcda.runStatus |
+ ) { |
this.updateSubRegion() |
} |
- if (this.props.watershedTool.selectedSubunit !== prevProps.watershedTool.selectedSubunit) { |
+ if ( |
+ this.props.watershedTool.selectedSubunit !== |
+ prevProps.watershedTool.selectedSubunit |
+ ) { |
this.updateSelection() |
} |
} |
@@ -96,19 +110,25 @@ |
const subLayer = this.getMapLayer(subRegionLayerName) |
if (subLayer) subLayer.getSource().clear() |
} |
- if (regionGeometry !== undefined && regionGeometry) { |
+ if (regionGeometry) { |
if (regionGeometry.type === 'Feature') { |
const feature = new OlGeoJSON().readFeature(regionGeometry, { |
featureProjection: 'EPSG:3857', |
dataProjection: 'EPSG:4326', |
}) |
layer.getSource().addFeature(feature) |
- } else if (regionGeometry.type === 'FeatureCollection' && regionGeometry.features) { |
+ } else if ( |
+ regionGeometry.type === 'FeatureCollection' && |
+ regionGeometry.features |
+ ) { |
for (let i = 0; i < regionGeometry.features.length; i += 1) { |
- const feature = new OlGeoJSON().readFeature(regionGeometry.features[i], { |
- featureProjection: 'EPSG:3857', |
- dataProjection: 'EPSG:4326', |
- }) |
+ const feature = new OlGeoJSON().readFeature( |
+ regionGeometry.features[i], |
+ { |
+ featureProjection: 'EPSG:3857', |
+ dataProjection: 'EPSG:4326', |
+ }, |
+ ) |
layer.getSource().addFeature(feature) |
} |
} |
@@ -119,7 +139,12 @@ |
const subRegionGeometry = this.props.aoi.subRegion |
const layer = this.getMapLayer(subRegionLayerName) |
if (layer) layer.getSource().clear() |
- if (subRegionGeometry !== undefined && subRegionGeometry && subRegionGeometry.features !== undefined && subRegionGeometry.features.length > 0) { |
+ if ( |
+ subRegionGeometry !== undefined && |
+ subRegionGeometry && |
+ subRegionGeometry.features !== undefined && |
+ subRegionGeometry.features.length > 0 |
+ ) { |
subRegionGeometry.features.forEach((feature) => { |
const subReionfeature = new OlGeoJSON().readFeature(feature, { |
featureProjection: 'EPSG:3857', |
@@ -133,35 +158,43 @@ |
updateSelection() { |
const layer = this.getMapLayer(subRegionLayerName) |
const source = layer.getSource() |
- const feat = source.getFeatures().find(f => f.get('name') === this.props.watershedTool.selectedSubunit) |
+ const feat = source |
+ .getFeatures() |
+ .find( |
+ (f) => |
+ f.get('name') === this.props.watershedTool.selectedSubunit, |
+ ) |
console.log('updating selection') |
+ const feats = this.select.getFeatures() |
if (feat) { |
- const feats = this.select.getFeatures() |
if (feats.getLength() > 0) { |
- if (feats.item(0).get('name') !== feat.get('name')) { |
- feats.clear() |
- feats.push(feat) |
- } |
+ feats.clear() |
+ feats.push(feat) |
} else { |
feats.push(feat) |
} |
} else if (this.props.watershedTool.selectedSubunit === null) { |
- const feats = this.select.getFeatures() |
feats.clear() |
} |
} |
|
getStyle = (feat, res) => { |
const mcda = this.props.mcda |
- if (this.props.aoi && this.props.aoi.subRegion && this.props.aoi.subRegion.features |
- && this.props.aoi.subRegion.features.length > 0) { |
+ if ( |
+ this.props.aoi && |
+ this.props.aoi.subRegion && |
+ this.props.aoi.subRegion.features && |
+ this.props.aoi.subRegion.features.length > 0 |
+ ) { |
const subRegionCount = this.props.aoi.subRegion.features.length |
const featureName = feat.get('name_huc') |
if (mcda.runStatus) { |
const rank = feat.get('rank') |
return olUtils.getOlStyles({ |
fill: new OlStyleFill({ |
- color: rank ? getRankColor(subRegionCount, rank) : 'rgba(0, 200, 0, 0.25)', |
+ color: rank |
+ ? getRankColor(subRegionCount, rank) |
+ : 'rgba(0, 200, 0, 0.25)', |
}), |
stroke: new OlStyleStroke({ |
color: 'black', |
@@ -170,7 +203,12 @@ |
backgroundFill: new OlStyleFill({ color: 'white' }), |
font: '14px "Roboto Condensed", sans-serif', |
placement: 'point', |
- text: `${parseInt(rank).toString()} ${feat.get('name_huc')}`, |
+ text: |
+ rank !== undefined |
+ ? `${parseInt(rank).toString()} ${feat.get( |
+ 'name_huc', |
+ )}` |
+ : '', |
textAlign: 'left', |
}), |
}) |
@@ -246,17 +284,27 @@ |
render() { |
const classes = [this.props.theme.mapCtr] |
classes.push(this.props.theme.headerPanelOpen) |
- classes.push(this.props.analysisPanelClosed ? this.props.theme.analysisPanelClosed : this.props.theme.analysisPanelOpen) |
- classes.push(this.props.contextBarClosed ? this.props.theme.contextBarClosed : this.props.theme.contextBarOpen) |
- classes.push(this.props.mapToolbarClosed ? this.props.theme.mapToolbarPanelClosed : this.props.theme.mapToolbarPanelOpen) |
+ classes.push( |
+ this.props.analysisPanelClosed |
+ ? this.props.theme.analysisPanelClosed |
+ : this.props.theme.analysisPanelOpen, |
+ ) |
+ classes.push( |
+ this.props.contextBarClosed |
+ ? this.props.theme.contextBarClosed |
+ : this.props.theme.contextBarOpen, |
+ ) |
+ classes.push( |
+ this.props.mapToolbarClosed |
+ ? this.props.theme.mapToolbarPanelClosed |
+ : this.props.theme.mapToolbarPanelOpen, |
+ ) |
return ( |
- <div className={classes.join(' ')} > |
+ <div className={classes.join(' ')}> |
<Map |
{...this.props} |
- onChangeView={ex => this.props.onUpdateMapView(ex)} |
- ref={(mapApp) => { |
- this.mapApp = mapApp |
- }} |
+ onChangeView={(ex) => this.props.onUpdateMapView(ex)} |
+ ref={this.mapRef} |
theme={this.props.theme} |
/> |
</div> |
@@ -2,7 +2,7 @@ |
import React from 'react' |
import Grid from '@material-ui/core/Grid' |
import List from '@material-ui/core/List' |
-import Map from 'catena/er2_map/src/map' |
+import Map from '@owsi/catena/er2_map/src/map' |
import type { DataLayerType } from '../reducers/data_layer' |
import { helpDescriptionStyle } from '../styles/wptCommon' |
import Help from './common/Help' |
@@ -20,7 +20,6 @@ |
import CoEcoregions from './datalayer/CoEcoregions' |
import CoWatershedPlans from './datalayer/CoWatershedPlans' |
|
- |
type PropsType = { |
dataLayer: DataLayerType, |
catenaMap: Map, |
@@ -69,8 +68,16 @@ |
|
render = () => { |
return ( |
- <div className={this.props.theme.controlBar} style={{ overflowY: 'scroll' }}> |
- <Help description={'Please zoom in on the map to activate the checkboxes.'} header={'Data layers'} /> |
+ <div |
+ className={this.props.theme.controlBar} |
+ style={{ overflowY: 'scroll' }} |
+ > |
+ <Help |
+ description={ |
+ 'Please zoom in on the map to activate the checkboxes.' |
+ } |
+ header={'Data layers'} |
+ /> |
<List dense> |
<DrinkingWaterHuc8 |
dataLayer={this.props.dataLayer} |
@@ -125,7 +132,9 @@ |
dataLayer={this.props.dataLayer} |
mapView={this.props.map.mapView} |
catenaMap={this.props.catenaMap} |
- onGetMunDrCounties={this.props.actions.onGetMunDrCounties} |
+ onGetMunDrCounties={ |
+ this.props.actions.onGetMunDrCounties |
+ } |
zoomedIn={this.state.zoomedIn} |
/> |
<CoEcoregions |
@@ -139,28 +148,36 @@ |
dataLayer={this.props.dataLayer} |
mapView={this.props.map.mapView} |
catenaMap={this.props.catenaMap} |
- onGetCoLandOwnership={this.props.actions.onGetCoLandOwnership} |
+ onGetCoLandOwnership={ |
+ this.props.actions.onGetCoLandOwnership |
+ } |
zoomedIn={this.state.zoomedIn} |
/> |
<UrbanAreas |
dataLayer={this.props.dataLayer} |
mapView={this.props.map.mapView} |
catenaMap={this.props.catenaMap} |
- onGetMs4UrbanAreas={this.props.actions.onGetMs4UrbanAreas} |
+ onGetMs4UrbanAreas={ |
+ this.props.actions.onGetMs4UrbanAreas |
+ } |
zoomedIn={this.state.zoomedIn} |
/> |
<CoWatershedPlans |
dataLayer={this.props.dataLayer} |
mapView={this.props.map.mapView} |
catenaMap={this.props.catenaMap} |
- onGetCoWatershedPlans={this.props.actions.onGetCoWatershedPlans} |
+ onGetCoWatershedPlans={ |
+ this.props.actions.onGetCoWatershedPlans |
+ } |
zoomedIn={this.state.zoomedIn} |
/> |
<Wwtfs |
dataLayer={this.props.dataLayer} |
mapView={this.props.map.mapView} |
catenaMap={this.props.catenaMap} |
- onDisplayWwtfDetails={this.props.actions.onDisplayWwtfDetails} |
+ onDisplayWwtfDetails={ |
+ this.props.actions.onDisplayWwtfDetails |
+ } |
onGetWwtfs={this.props.actions.onGetWwtfs} |
zoomedIn={this.state.zoomedIn} |
/> |
@@ -172,9 +189,24 @@ |
renderHelperText = () => { |
return ( |
<Grid container direction={'column'}> |
- <Grid item>{this.renderHelperText('Activate the checkboxes: ', 'Please zoom in on the map to activate the checkboxes.')}</Grid> |
- <Grid item>{this.renderHelperTextRow('Display a layer on map: ', 'Click on the checkbox present besides the layer name to display the layer on the map.')}</Grid> |
- <Grid item>{this.renderHelperTextRow('Hide a layer on map: ', 'Uncheck the checkbox by clicking on it to hide the layer on the map.')}</Grid> |
+ <Grid item> |
+ {this.renderHelperText( |
+ 'Activate the checkboxes: ', |
+ 'Please zoom in on the map to activate the checkboxes.', |
+ )} |
+ </Grid> |
+ <Grid item> |
+ {this.renderHelperTextRow( |
+ 'Display a layer on map: ', |
+ 'Click on the checkbox present besides the layer name to display the layer on the map.', |
+ )} |
+ </Grid> |
+ <Grid item> |
+ {this.renderHelperTextRow( |
+ 'Hide a layer on map: ', |
+ 'Uncheck the checkbox by clicking on it to hide the layer on the map.', |
+ )} |
+ </Grid> |
</Grid> |
) |
} |
@@ -183,7 +215,11 @@ |
return ( |
<Grid container direction={'row'}> |
<Grid item> |
- <span style={{ ...helpDescriptionStyle, textWeight: 'bold' }}>{action}</span> |
+ <span |
+ style={{ ...helpDescriptionStyle, textWeight: 'bold' }} |
+ > |
+ {action} |
+ </span> |
</Grid> |
<Grid item> |
<span style={helpDescriptionStyle}>{how}</span> |
@@ -11,7 +11,7 @@ |
import OlStyleStroke from 'ol/style/Stroke' |
import OlStyleText from 'ol/style/Text' |
import { click } from 'ol/events/condition' |
-import { olUtils, styles } from 'catena/er2_ui' |
+import { olUtils, styles } from '@owsi/catena/er2_ui' |
import OLVectorLayer from 'ol/layer/Vector' |
import OLVectorSource from 'ol/source/Vector' |
import Text from 'ol/style/Text' |
@@ -34,17 +34,17 @@ |
} |
export const CoLandOwnershipIconColor = '#006400' |
export const CoLandOwnershipFillColor = { |
- 'BLM': '#ffffbe', |
- 'Federal': '#c29ed7', |
- 'Local': '#bee8ff', |
+ BLM: '#ffffbe', |
+ Federal: '#c29ed7', |
+ Local: '#bee8ff', |
'NGO/Land Trust': '#730000', |
- 'NPS': '#704489', |
- 'Private': '#ffffff', |
+ NPS: '#704489', |
+ Private: '#ffffff', |
'Private Conservation': '#ffaa00', |
- 'State': '#6699cd', |
- 'Tribal': '#d7c29e', |
- 'USFS': '#b4d79e', |
- 'USFWS': '#00734c', |
+ State: '#6699cd', |
+ Tribal: '#d7c29e', |
+ USFS: '#b4d79e', |
+ USFWS: '#00734c', |
} |
export const CoWatershedPlansIconColor = '#000000' |
export const CoWatershedPlansFillColor = '#6495ED' |
@@ -64,12 +64,11 @@ |
|
function clearInteractions(olmap) { |
// Clear interactions |
- olmap.getInteractions() |
- .forEach((interaction) => { |
- if (interaction instanceof OLSelect) { |
- olmap.removeInteraction(interaction) |
- } |
- }) |
+ olmap.getInteractions().forEach((interaction) => { |
+ if (interaction instanceof OLSelect) { |
+ olmap.removeInteraction(interaction) |
+ } |
+ }) |
} |
|
export function updateInteractions(props) { |
@@ -134,46 +133,53 @@ |
}, |
} |
|
-const getMapTextFillColor = label => mapColors[label].textFillColor |
+const getMapTextFillColor = (label) => mapColors[label].textFillColor |
|
-const getMapTextStrokeColor = label => mapColors[label].textStrokeColor |
+const getMapTextStrokeColor = (label) => mapColors[label].textStrokeColor |
|
-const getMapIconFillColor = label => mapColors[label].iconFillColor |
+const getMapIconFillColor = (label) => mapColors[label].iconFillColor |
|
-const getMapIconStrokeColor = label => mapColors[label].iconStrokeColor |
+const getMapIconStrokeColor = (label) => mapColors[label].iconStrokeColor |
|
-export const getOLFeatureList = stations => ( |
+export const getOLFeatureList = (stations) => |
stations.map((f) => { |
- const geometry = |
- new OLPoint([parseFloat(f.longitude), parseFloat(f.latitude)]).transform('EPSG:4326', 'EPSG:3857') |
+ const geometry = new OLPoint([ |
+ parseFloat(f.longitude), |
+ parseFloat(f.latitude), |
+ ]).transform('EPSG:4326', 'EPSG:3857') |
return new OLFeature({ geometry, ...f }) |
}) |
-) |
|
export const getOLFeatureListfromGeoJSON = (data) => { |
const featureProjection = 'EPSG:3857' |
const dataProjection = 'EPSG:4326' |
- return ( |
- new OLGeoJSON().readFeatures(data, { |
- featureProjection, |
- dataProjection, |
- }) |
- ) |
+ return new OLGeoJSON().readFeatures(data, { |
+ featureProjection, |
+ dataProjection, |
+ }) |
} |
|
export const removeMapLayer = (olmap, layerName) => { |
- olmap.getLayers() |
- .forEach((layer) => { |
- if (layer !== undefined) { |
- if (layer.get('name') !== undefined && layer.get('name') === layerName) { |
- olmap.removeLayer(layer) |
- } |
+ olmap.getLayers().forEach((layer) => { |
+ if (layer !== undefined) { |
+ if ( |
+ layer.get('name') !== undefined && |
+ layer.get('name') === layerName |
+ ) { |
+ olmap.removeLayer(layer) |
} |
- }) |
+ } |
+ }) |
} |
|
-export const addMapLayer = (olmap, features, layerName, colorParamName, textParamName) => { |
- const getLabel = f => f.get(textParamName) |
+export const addMapLayer = ( |
+ olmap, |
+ features, |
+ layerName, |
+ colorParamName, |
+ textParamName, |
+) => { |
+ const getLabel = (f) => f.get(textParamName) |
function style(f, resolution) { |
let textStyle |
if (resolution < 40) { |
@@ -207,7 +213,6 @@ |
}) |
} |
|
- |
removeMapLayer(olmap, layerName) |
const layer = new OLVectorLayer({ |
source: new OLVectorSource({ features }), |
@@ -219,20 +224,26 @@ |
olmap.addLayer(layer) |
} |
|
-export const addEcoregionMapLayer = (olmap, features, layerName, colorParamName) => { |
- const vectorSource = new OLVectorSource({features}) |
+export const addEcoregionMapLayer = ( |
+ olmap, |
+ features, |
+ layerName, |
+ colorParamName, |
+) => { |
+ const vectorSource = new OLVectorSource({ features }) |
|
function style(f) { |
return olUtils.getOlStyles({ |
fill: new OlStyleFill({ |
- color: mapColors[colorParamName].iconFillColor[f.get('us_l3name')], |
+ color: |
+ mapColors[colorParamName].iconFillColor[f.get('us_l3name')], |
}), |
stroke: new OlStyleStroke({ |
color: getMapIconStrokeColor(colorParamName), |
width: 2, |
}), |
text: new Text({ |
- backgroundFill: new OlStyleFill({color: 'white'}), |
+ backgroundFill: new OlStyleFill({ color: 'white' }), |
font: '14px "Roboto Condensed", sans-serif', |
placement: 'point', |
// stroke: new Stroke(olUtils.styles.text.stroke), |
@@ -254,8 +265,13 @@ |
olmap.addLayer(layer) |
} |
|
-export const addOwnershipMapLayer = (olmap, features, layerName, colorParamName) => { |
- const vectorSource = new OLVectorSource({features}) |
+export const addOwnershipMapLayer = ( |
+ olmap, |
+ features, |
+ layerName, |
+ colorParamName, |
+) => { |
+ const vectorSource = new OLVectorSource({ features }) |
|
function style(f) { |
return olUtils.getOlStyles({ |
@@ -267,7 +283,7 @@ |
width: 2, |
}), |
text: new Text({ |
- backgroundFill: new OlStyleFill({color: 'white'}), |
+ backgroundFill: new OlStyleFill({ color: 'white' }), |
font: '14px "Roboto Condensed", sans-serif', |
placement: 'point', |
// stroke: new Stroke(olUtils.styles.text.stroke), |
@@ -289,8 +305,13 @@ |
olmap.addLayer(layer) |
} |
|
-export const addWatershedPlansLayer = (olmap, features, layerName, colorParamName) => { |
- const vectorSource = new OLVectorSource({features}) |
+export const addWatershedPlansLayer = ( |
+ olmap, |
+ features, |
+ layerName, |
+ colorParamName, |
+) => { |
+ const vectorSource = new OLVectorSource({ features }) |
|
function style(f) { |
return olUtils.getOlStyles({ |
@@ -302,7 +323,7 @@ |
width: 1, |
}), |
text: new Text({ |
- backgroundFill: new OlStyleFill({color: 'white'}), |
+ backgroundFill: new OlStyleFill({ color: 'white' }), |
font: '14px "Roboto Condensed", sans-serif', |
placement: 'point', |
// stroke: new Stroke(olUtils.styles.text.stroke), |
@@ -324,7 +345,12 @@ |
olmap.addLayer(layer) |
} |
|
-export const addRiverMapLayer = (olmap, features, layerName, colorParamName) => { |
+export const addRiverMapLayer = ( |
+ olmap, |
+ features, |
+ layerName, |
+ colorParamName, |
+) => { |
const vectorSource = new OLVectorSource({ features }) |
|
function style(f) { |
@@ -359,13 +385,30 @@ |
olmap.addLayer(layer) |
} |
|
-export const addDrinkingWaterMapLayer = (olmap, features, layerName, colorParamName, label1, label2) => { |
+export const addDrinkingWaterMapLayer = ( |
+ olmap, |
+ features, |
+ layerName, |
+ colorParamName, |
+ label1, |
+ label2, |
+) => { |
const vectorSource = new OLVectorSource({ features }) |
|
function style(f) { |
- let textLabel = f.get(label1) + ': ' + f.get('inf_srcwtr') + ' Drinking Water Intakes' |
+ let textLabel = |
+ f.get(label1) + |
+ ': ' + |
+ f.get('inf_srcwtr') + |
+ ' Drinking Water Intakes' |
if (label2) { |
- textLabel = f.get(label1) + ' (' + f.get(label2) + '): ' + f.get('inf_srcwtr') + ' Drinking Water Intakes' |
+ textLabel = |
+ f.get(label1) + |
+ ' (' + |
+ f.get(label2) + |
+ '): ' + |
+ f.get('inf_srcwtr') + |
+ ' Drinking Water Intakes' |
} |
return olUtils.getOlStyles({ |
fill: new OlStyleFill({ |
@@ -398,13 +441,30 @@ |
olmap.addLayer(layer) |
} |
|
-export const addMunicipalDrinkingWaterMapLayer = (olmap, features, layerName, colorParamName, label1, label2) => { |
+export const addMunicipalDrinkingWaterMapLayer = ( |
+ olmap, |
+ features, |
+ layerName, |
+ colorParamName, |
+ label1, |
+ label2, |
+) => { |
const vectorSource = new OLVectorSource({ features }) |
|
function style(f) { |
- let textLabel = f.get(label1) + ': ' + f.get('inf_srcwtr') + ' Municipal Drinking Water Intakes' |
+ let textLabel = |
+ f.get(label1) + |
+ ': ' + |
+ f.get('inf_srcwtr') + |
+ ' Municipal Drinking Water Intakes' |
if (label2) { |
- textLabel = f.get(label1) + ' (' + f.get(label2) + '): ' + f.get('inf_srcwtr') + ' Municipal Drinking Water Intakes' |
+ textLabel = |
+ f.get(label1) + |
+ ' (' + |
+ f.get(label2) + |
+ '): ' + |
+ f.get('inf_srcwtr') + |
+ ' Municipal Drinking Water Intakes' |
} |
return olUtils.getOlStyles({ |
fill: new OlStyleFill({ |
@@ -435,4 +495,4 @@ |
}) |
|
olmap.addLayer(layer) |
-} |
\ No newline at end of file |
+} |
@@ -2,7 +2,7 @@ |
import * as React from 'react' |
import { withRouter } from 'react-router-dom' |
import { withStyles } from '@material-ui/core/styles' |
-import { TokenNavLink } from 'catena/er2_ui' |
+import { TokenNavLink } from '@owsi/catena/er2_ui' |
import { parseLocation } from 'er2_web_utils' |
|
import * as ids from '../constants/ids' |
@@ -48,25 +48,56 @@ |
const { classes } = this.props |
const tokenClasses = `${this.props.theme.link}` |
return ( |
- <div className={this.props.theme.instructions} style={{ fontSize: 'larger' }}> |
+ <div |
+ className={this.props.theme.instructions} |
+ style={{ fontSize: 'larger' }} |
+ > |
<h2 className={classes.title}> |
- Watershed Prioritization Tool |
+ Non-Point Source Prioritization Tool |
</h2> |
<TokenNavLink |
className={tokenClasses} |
to={routes.INSTRUCTIONS_INTRODUCTION} |
token={this.props.token} |
> |
- <h3 id={ids.INSTRUCTIONS_INTRODUCTION} style={{ display: 'inline-block'}}>Introduction</h3> |
+ <h3 |
+ id={ids.INSTRUCTIONS_INTRODUCTION} |
+ style={{ display: 'inline-block' }} |
+ > |
+ Introduction |
+ </h3> |
</TokenNavLink> |
<p className={classes.p}> |
- This tool allows users to explore Colorado water systems and prioritize or rank particular watersheds or locations within them, based on a range of user-selected criteria to assist with decision making at the state-or-local level. |
- </p><p className={classes.p}> |
- The Watershed Prioritization Dashboard (WPD) was developed to assist the Colorado Department of Public Health and the Environment (CDPHE) prioritize watersheds for conservation, restoration, and preservation. |
- </p><p className={classes.p}> |
- The WPD uses a Multi-Criteria Decision Analysis (MCDA) approach to assist with tactical decision making by allowing users to build customized analysis scenarios and identify critical watersheds in the specified region. Using a geospatial interface, users are able to select from three pre-populated analyses with default values to reflect the indicators identified by the Environmental Protection Agency (EPA) Health Watersheds Assessment Program and the CDPHE. |
- </p><p className={classes.p}> |
- Users can customize the both level of importance and either maximize or minimize the significance of numerous assessment indicators ranging from landscape and biological condition to water quality and contamination, to land use and climate change. Multiple analyses can be conducted and compared within the dashboard. Results and raw data can be exported as a spreadsheet and the interactive graphing features help visualize the model outputs. |
+ This tool allows users to explore Colorado water systems and |
+ prioritize or rank particular watersheds or locations within |
+ them, based on a range of user-selected criteria to assist |
+ with decision making at the state-or-local level. |
+ </p> |
+ <p className={classes.p}> |
+ The Non-Point Source Prioritization Dashboard (NPSPD) was |
+ developed to assist the Colorado Department of Public Health |
+ and the Environment (CDPHE) prioritize watersheds for |
+ conservation, restoration, and preservation. |
+ </p> |
+ <p className={classes.p}> |
+ The NPSPD uses a Multi-Criteria Decision Analysis (MCDA) |
+ approach to assist with tactical decision making by allowing |
+ users to build customized analysis scenarios and identify |
+ critical watersheds in the specified region. Using a |
+ geospatial interface, users are able to select from three |
+ pre-populated analyses with default values to reflect the |
+ indicators identified by the Environmental Protection Agency |
+ (EPA) Health Watersheds Assessment Program and the CDPHE. |
+ </p> |
+ <p className={classes.p}> |
+ Users can customize the both level of importance and either |
+ maximize or minimize the significance of numerous assessment |
+ indicators ranging from landscape and biological condition |
+ to water quality and contamination, to land use and climate |
+ change. Multiple analyses can be conducted and compared |
+ within the dashboard. Results and raw data can be exported |
+ as a spreadsheet and the interactive graphing features help |
+ visualize the model outputs. |
</p> |
</div> |
) |
@@ -9,12 +9,12 @@ |
import StepConnector from '@material-ui/core/StepConnector' |
import Button from '@material-ui/core/Button' |
import { withStyles } from '@material-ui/core/styles' |
-import CatenaMap from 'catena/er2_map/src/map' |
-import AOISelect from 'catena/er2_map_userlayers/js/components/aoi_select' |
+import CatenaMap from '@owsi/catena/er2_map/src/map' |
+import AOISelect from '@owsi/catena/er2_map_userlayers/js/components/aoi_select' |
import OlStyleFill from 'ol/style/Fill' |
import OlStyleStroke from 'ol/style/Stroke' |
import { parse, stringify } from 'query-string' |
-import type { AOIstate } from 'catena/er2_map_userlayers/js/components/aoi_select' |
+import type { AOIstate } from '@owsi/catena/er2_map_userlayers/js/components/aoi_select' |
import { FetchSpinner } from '../common/commonComps' |
import RadioGroupComponent from '../common/RadioGroupComponent' |
import type { AOIType } from '../../reducers/aoi' |
@@ -72,18 +72,24 @@ |
} |
|
render = () => ( |
- <div className={this.props.theme.controlBar} style={{ overflowY: 'scroll' }}> |
- <Stepper activeStep={this.state.activeStep} orientation="vertical" connector={<StyledStepConnector />}> |
- {this.getSteps() |
- .map((label, index) => ( |
- <Step key={index.toString()}> |
- <StepLabel>{label}</StepLabel> |
- <StepContent> |
- {this.renderStep1()} |
- {this.renderStep2()} |
- </StepContent> |
- </Step> |
- ))} |
+ <div |
+ className={this.props.theme.controlBar} |
+ style={{ overflowY: 'scroll' }} |
+ > |
+ <Stepper |
+ activeStep={this.state.activeStep} |
+ orientation="vertical" |
+ connector={<StyledStepConnector />} |
+ > |
+ {this.getSteps().map((label, index) => ( |
+ <Step key={index.toString()}> |
+ <StepLabel>{label}</StepLabel> |
+ <StepContent> |
+ {this.renderStep1()} |
+ {this.renderStep2()} |
+ </StepContent> |
+ </Step> |
+ ))} |
</Stepper> |
</div> |
) |
@@ -122,10 +128,11 @@ |
toolLabel={''} |
initialState={this.props.aoi} |
/> |
- { |
- this.props.aoi.aoiSelectInitialState.aoiFeature && |
- <div style={{ textAlign: 'right', paddingTop: '7px' }}>{this.renderNextButton()}</div> |
- } |
+ {this.props.aoi.aoiSelectInitialState.aoiFeature && ( |
+ <div style={{ textAlign: 'right', paddingTop: '7px' }}> |
+ {this.renderNextButton()} |
+ </div> |
+ )} |
</div> |
) |
} |
@@ -141,16 +148,30 @@ |
<Grid container direction={'column'} spacing={3}> |
<Grid item> |
<RadioGroupComponent |
- menuItemList={['None', 'huc8', 'huc10', 'huc12', 'County']} |
+ menuItemList={[ |
+ 'None', |
+ 'huc8', |
+ 'huc10', |
+ 'huc12', |
+ 'County', |
+ ]} |
onSelect={this.handleSelectSubRegionType} |
selectIntValue={this.props.aoi.subRegion.type} |
/> |
</Grid> |
<Grid item>{this.renderSelectSubRegion()}</Grid> |
<Grid item> |
- <Grid container direction={'row'} justify="space-between" alignItems="center"> |
+ <Grid |
+ container |
+ direction={'row'} |
+ justify="space-between" |
+ alignItems="center" |
+ > |
<Grid item>{this.renderBackButton()}</Grid> |
- <Grid item>{this.props.aoi.subRegion.features !== undefined && this.renderNextButton()}</Grid> |
+ <Grid item> |
+ {this.props.aoi.subRegion.features !== |
+ undefined && this.renderNextButton()} |
+ </Grid> |
</Grid> |
</Grid> |
</Grid> |
@@ -159,17 +180,25 @@ |
} |
|
handleSelectSubRegionType = (subRegionType) => { |
- if (subRegionType !== 'None') this.props.actions.onGetSubRegions(this.props.aoi.aoiSelectInitialState.aoiFeature, subRegionType) |
+ if (subRegionType !== 'None') |
+ this.props.actions.onGetSubRegions( |
+ this.props.aoi.aoiSelectInitialState.aoiFeature, |
+ subRegionType, |
+ ) |
} |
|
renderSelectSubRegion = () => { |
- if (this.props.aoi.subRegion.isFetching) return <FetchSpinner message={'Fetching subregions'} /> |
+ if (this.props.aoi.subRegion.isFetching) |
+ return <FetchSpinner message={'Fetching subregions'} /> |
return null |
} |
|
renderBackButton = () => ( |
<Tooltip title={'Previous step'}> |
- <Button onClick={this.handleBack} style={{ color: 'rgb(43, 84, 162)' }}> |
+ <Button |
+ onClick={this.handleBack} |
+ style={{ color: 'rgb(43, 84, 162)' }} |
+ > |
<i className=" fas fa-arrow-left" style={{ padding: '3px' }} /> |
Back |
</Button> |
@@ -178,7 +207,10 @@ |
|
renderNextButton = () => ( |
<Tooltip title={'Next step'}> |
- <Button onClick={this.handleNext} style={{ color: 'rgb(43, 84, 162)' }}> |
+ <Button |
+ onClick={this.handleNext} |
+ style={{ color: 'rgb(43, 84, 162)' }} |
+ > |
Next |
<i className="fa fa-arrow-right" style={{ padding: '3px' }} /> |
</Button> |
@@ -34,26 +34,31 @@ |
import DialogTitle from '@material-ui/core/DialogTitle' |
import Typography from '@material-ui/core/Typography' |
import Snackbar from '@material-ui/core/Snackbar' |
-import { Breadcrumbs, ContextBar, Header, TokenNavLink } from 'catena/er2_ui' |
+import { |
+ Breadcrumbs, |
+ ContextBar, |
+ Header, |
+ TokenNavLink, |
+} from '@owsi/catena/er2_ui' |
import exportData from 'highcharts/modules/export-data' |
import { parseLocation } from 'er2_web_utils' |
-import AttributeTable from 'catena/er2_map_userlayers/js/components/attribute_table/attribute_table_stable' |
-import TabbedPanel from 'catena/er2_map_userlayers/js/components/tabbed_panel' |
-import UserLayersContainer from 'catena/er2_map_userlayers/js/containers/userlayers' |
+import AttributeTable from '@owsi/catena/er2_map_userlayers/js/components/attribute_table/attribute_table_stable' |
+import TabbedPanel from '@owsi/catena/er2_map_userlayers/js/components/tabbed_panel' |
+import UserLayersContainer from '@owsi/catena/er2_map_userlayers/js/containers/userlayers' |
import WindowState, { |
windowStates, |
-} from 'catena/er2_map_userlayers/js/components/window_state' |
-import muiTheme, { customMuiTheme } from 'catena/er2_styles/mui' |
-import Theme from 'catena/er2_styles' |
-import type { AttributeTablesType } from 'catena/er2_map_userlayers/js/reducers/attribute_tables' |
-import type { GeoBarType, MapToolbarType } from 'catena/er2_ui' |
-import type { IdentifyType } from 'catena/er2_map_userlayers/js/reducers/identify' |
-import type { LoggerType } from 'catena/er2_map_userlayers/js/reducers/logger' |
-import type { MapType } from 'catena/er2_map_userlayers/js/reducers/map' |
-import type { MapsourcesType } from 'catena/er2_map_userlayers/js/reducers/mapsources' |
-import type { MapBaseLayerType } from 'catena/er2_map_userlayers/js/reducers/mapbaselayer' |
-import type { ServicesType } from 'catena/er2_map_services/js/reducers/services' |
-import type { TabbedPanelType } from 'catena/er2_map_userlayers/js/reducers/tabbed_panel' |
+} from '@owsi/catena/er2_map_userlayers/js/components/window_state' |
+import muiTheme, { customMuiTheme } from '@owsi/catena/er2_styles/mui' |
+import Theme from '@owsi/catena/er2_styles' |
+import type { AttributeTablesType } from '@owsi/catena/er2_map_userlayers/js/reducers/attribute_tables' |
+import type { GeoBarType, MapToolbarType } from '@owsi/catena/er2_ui' |
+import type { IdentifyType } from '@owsi/catena/er2_map_userlayers/js/reducers/identify' |
+import type { LoggerType } from '@owsi/catena/er2_map_userlayers/js/reducers/logger' |
+import type { MapType } from '@owsi/catena/er2_map_userlayers/js/reducers/map' |
+import type { MapsourcesType } from '@owsi/catena/er2_map_userlayers/js/reducers/mapsources' |
+import type { MapBaseLayerType } from '@owsi/catena/er2_map_userlayers/js/reducers/mapbaselayer' |
+import type { ServicesType } from '@owsi/catena/er2_map_services/js/reducers/services' |
+import type { TabbedPanelType } from '@owsi/catena/er2_map_userlayers/js/reducers/tabbed_panel' |
import * as colors from '../styles/colors' |
import styles from '../styles' |
import * as Actions from '../actions' |
@@ -192,7 +197,7 @@ |
const parsedLoc = parseLocation(location) |
// Set to null rather than undefined so that tabbedPanel set gridColEnd correctly. |
const activeMapToolbarPanel = |
- theprops.mapToolbar.items.find(item => item.active) || null |
+ theprops.mapToolbar.items.find((item) => item.active) || null |
|
const showCatenaPanel = true |
const tocVisible = |
@@ -220,7 +225,7 @@ |
|
// Check if the route doesn't match anything |
const pathnames = Object.entries(routes).map( |
- entry => entry[1], |
+ (entry) => entry[1], |
) |
if (!pathnames.includes(theprops.location.pathname)) { |
theprops.history.push({ |
@@ -247,7 +252,7 @@ |
to={routes.HOME} |
> |
<span className={classes.logo}> |
- Watershed Prioritization Dashboard |
+ Non-Point Source Prioritization Dashboard |
</span> |
<span className={classes.logoVersion}> |
v. {version} |
@@ -261,7 +266,7 @@ |
to={routes.HOME} |
> |
<span className={classes.logo}> |
- Watershed Prioritization Dashboard |
+ Non-Point Source Prioritization Dashboard |
</span> |
<span className={classes.logoVersion}> |
v. {version} |
@@ -413,11 +418,11 @@ |
</DialogTitle> |
<DialogContent> |
<Typography gutterBottom> |
- The Watershed Prioritization Dashboard (WPD) is still |
- undergoing testing and development. As such, some |
+ The Non-Point Source Prioritization Dashboard (NPSPD) is |
+ still undergoing testing and development. As such, some |
features and methodologies may change or be removed at |
any time without prior notice. For any further questions |
- about WPD, please contact Estella Moore ( |
+ about NPSPD, please contact Estella Moore ( |
<a |
href={'mailto:estella.moore@state.co.us'} |
target={'_blank'} |
@@ -457,7 +462,7 @@ |
|
const getAnalysisPanelContents = () => { |
const attributeTables = theprops.attributeTables.attributeTables.map( |
- t => ( |
+ (t) => ( |
<AttributeTable |
attributeTable={t} |
buttons={[ |
@@ -557,7 +562,7 @@ |
} |
|
const renderCatenaMap = () => { |
- const sub = s => s.substr(1, s.length - 2) |
+ const sub = (s) => s.substr(1, s.length - 2) |
const mapPath = `/(${sub(routes.SPECIFY_INPUTS)}|${sub( |
routes.MCDA, |
)}|${sub(routes.DATALAYER)})` |
@@ -606,7 +611,7 @@ |
/> |
) |
|
- const renderTabbedPanel = analysisPanelContents => ( |
+ const renderTabbedPanel = (analysisPanelContents) => ( |
<React.Fragment> |
<WindowState |
windowState={theprops.tabbedPanel.windowState} |
@@ -774,7 +779,7 @@ |
tableOfContents: { items: [] }, |
} |
|
-const mapStateToProps = state => ({ |
+const mapStateToProps = (state) => ({ |
aoi: state.aoi, |
attributeTables: state.attributeTables, |
contextBar: state.contextBar, |
@@ -800,7 +805,7 @@ |
watershedTool: state.watershedTool, |
}) |
|
-const mapDispatchToProps = dispatch => ({ |
+const mapDispatchToProps = (dispatch) => ({ |
actions: bindActionCreators(Actions, dispatch), |
}) |
|
@@ -1,5 +1,5 @@ |
// @flow |
-import * as er2MapActionTypes from 'catena/er2_map_userlayers/js/constants/action_types' |
+import * as er2MapActionTypes from '@owsi/catena/er2_map_userlayers/js/constants/action_types' |
import * as actionTypes from '../constants/action_types' |
|
export type WaterTreatmentFacilityType = { |
@@ -97,118 +97,284 @@ |
whichLayer: 0, |
drHuc8Layer: { |
fetchingLayer: false, |
- watersheds: [] |
+ watersheds: [], |
}, |
drHuc10Layer: { |
fetchingLayer: false, |
- watersheds: [] |
+ watersheds: [], |
}, |
drHuc12Layer: { |
fetchingLayer: false, |
- watersheds: [] |
+ watersheds: [], |
}, |
drCountyLayer: { |
fetchingLayer: false, |
- watersheds: [] |
+ watersheds: [], |
}, |
munDrHuc8Layer: { |
fetchingLayer: false, |
- watersheds: [] |
+ watersheds: [], |
}, |
munDrHuc10Layer: { |
fetchingLayer: false, |
- watersheds: [] |
+ watersheds: [], |
}, |
munDrHuc12Layer: { |
fetchingLayer: false, |
- watersheds: [] |
+ watersheds: [], |
}, |
munDrCountyLayer: { |
fetchingLayer: false, |
- watersheds: [] |
+ watersheds: [], |
}, |
coEcoregionsLayer: { |
fetchingLayer: false, |
- areas: [] |
+ areas: [], |
}, |
coLandOwnershipLayer: { |
fetchingLayer: false, |
- areas: [] |
+ areas: [], |
}, |
coWatershedPlansLayer: { |
fetchingLayer: false, |
- areas: [] |
+ areas: [], |
}, |
urbanAreaLayer: { |
fetchingLayer: false, |
- areas: [] |
+ areas: [], |
}, |
wwtfsDataLayer: { |
fetchingLayer: false, |
- wwtfs: [] |
+ wwtfs: [], |
}, |
} |
|
-const getWwtfIndex = (state, database, stationid) => state.wwtfs[database].findIndex(s => s.stationid === stationid) |
+const getWwtfIndex = (state, database, stationid) => |
+ state.wwtfs[database].findIndex((s) => s.stationid === stationid) |
|
-export default function dataLayer(state: DataLayerType = initialState, action: any) { |
+export default function dataLayer( |
+ state: DataLayerType = initialState, |
+ action: any, |
+) { |
let ret = state |
if (action.type === actionTypes.SET_DATA_LAYER) { |
ret = { ...state, whichLayer: action.layerType } |
} else if (action.type === actionTypes.SET_CO_ECOREGIONS) { |
- ret = { ...state, coEcoregionsLayer: { ...state.coEcoregionsLayer, areas: action.coEcoregionsData.co_ecoregions_layer } } |
+ ret = { |
+ ...state, |
+ coEcoregionsLayer: { |
+ ...state.coEcoregionsLayer, |
+ areas: action.coEcoregionsData.co_ecoregions_layer, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_FETCHING_CO_ECOREGIONS) { |
- ret = {...state, coEcoregionsLayer: {...state.coEcoregionsLayer, fetchingLayer: action.isFetching}} |
+ ret = { |
+ ...state, |
+ coEcoregionsLayer: { |
+ ...state.coEcoregionsLayer, |
+ fetchingLayer: action.isFetching, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_CO_LAND_OWNERSHIP) { |
- ret = { ...state, coLandOwnershipLayer: { ...state.coLandOwnershipLayer, areas: action.colandOwnerData.co_land_own_layer } } |
+ ret = { |
+ ...state, |
+ coLandOwnershipLayer: { |
+ ...state.coLandOwnershipLayer, |
+ areas: action.colandOwnerData.co_land_own_layer, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_FETCHING_CO_LAND_OWNERSHIP) { |
- ret = {...state, coLandOwnershipLayer: {...state.coLandOwnershipLayer, fetchingLayer: action.isFetching}} |
+ ret = { |
+ ...state, |
+ coLandOwnershipLayer: { |
+ ...state.coLandOwnershipLayer, |
+ fetchingLayer: action.isFetching, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_CO_WATERSHED_PLANS) { |
- ret = { ...state, coWatershedPlansLayer: { ...state.coWatershedPlansLayer, areas: action.coWatershedPlanData.co_watershed_plan_layer } } |
+ ret = { |
+ ...state, |
+ coWatershedPlansLayer: { |
+ ...state.coWatershedPlansLayer, |
+ areas: action.coWatershedPlanData.co_watershed_plan_layer, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_FETCHING_CO_WATERSHED_PLANS) { |
- ret = {...state, coWatershedPlansLayer: {...state.coWatershedPlansLayer, fetchingLayer: action.isFetching}} |
+ ret = { |
+ ...state, |
+ coWatershedPlansLayer: { |
+ ...state.coWatershedPlansLayer, |
+ fetchingLayer: action.isFetching, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_DR_HUC8S) { |
- ret = { ...state, drHuc8Layer: { ...state.drHuc8Layer, watersheds: action.drHuc8Data.dr_layer } } |
+ ret = { |
+ ...state, |
+ drHuc8Layer: { |
+ ...state.drHuc8Layer, |
+ watersheds: action.drHuc8Data.dr_layer, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_FETCHING_DR_HUC8S) { |
- ret = { ...state, drHuc8Layer: { ...state.drHuc8Layer, fetchingLayer: action.isFetching } } |
+ ret = { |
+ ...state, |
+ drHuc8Layer: { |
+ ...state.drHuc8Layer, |
+ fetchingLayer: action.isFetching, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_DR_HUC10S) { |
- ret = { ...state, drHuc10Layer: { ...state.drHuc10Layer, watersheds: action.drHuc10Data.dr_layer } } |
+ ret = { |
+ ...state, |
+ drHuc10Layer: { |
+ ...state.drHuc10Layer, |
+ watersheds: action.drHuc10Data.dr_layer, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_FETCHING_DR_HUC10S) { |
- ret = { ...state, drHuc10Layer: { ...state.drHuc10Layer, fetchingLayer: action.isFetching } } |
+ ret = { |
+ ...state, |
+ drHuc10Layer: { |
+ ...state.drHuc10Layer, |
+ fetchingLayer: action.isFetching, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_DR_HUC12S) { |
- ret = { ...state, drHuc12Layer: { ...state.drHuc12Layer, watersheds: action.drHuc12Data.dr_layer } } |
+ ret = { |
+ ...state, |
+ drHuc12Layer: { |
+ ...state.drHuc12Layer, |
+ watersheds: action.drHuc12Data.dr_layer, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_FETCHING_DR_HUC12S) { |
- ret = { ...state, drHuc12Layer: { ...state.drHuc12Layer, fetchingLayer: action.isFetching } } |
+ ret = { |
+ ...state, |
+ drHuc12Layer: { |
+ ...state.drHuc12Layer, |
+ fetchingLayer: action.isFetching, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_DR_COUNTIES) { |
- ret = { ...state, drCountyLayer: { ...state.drCountyLayer, watersheds: action.drCountyData.dr_layer } } |
+ ret = { |
+ ...state, |
+ drCountyLayer: { |
+ ...state.drCountyLayer, |
+ watersheds: action.drCountyData.dr_layer, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_FETCHING_DR_COUNTIES) { |
- ret = { ...state, drCountyLayer: { ...state.drCountyLayer, fetchingLayer: action.isFetching } } |
+ ret = { |
+ ...state, |
+ drCountyLayer: { |
+ ...state.drCountyLayer, |
+ fetchingLayer: action.isFetching, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_MUN_DR_HUC8S) { |
- ret = { ...state, munDrHuc8Layer: { ...state.munDrHuc8Layer, watersheds: action.munDrHuc8Data.dr_layer } } |
+ ret = { |
+ ...state, |
+ munDrHuc8Layer: { |
+ ...state.munDrHuc8Layer, |
+ watersheds: action.munDrHuc8Data.dr_layer, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_FETCHING_MUN_DR_HUC8S) { |
- ret = { ...state, munDrHuc8Layer: { ...state.munDrHuc8Layer, fetchingLayer: action.isFetching } } |
+ ret = { |
+ ...state, |
+ munDrHuc8Layer: { |
+ ...state.munDrHuc8Layer, |
+ fetchingLayer: action.isFetching, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_MUN_DR_HUC10S) { |
- ret = { ...state, munDrHuc10Layer: { ...state.munDrHuc10Layer, watersheds: action.munDrHuc10Data.dr_layer } } |
+ ret = { |
+ ...state, |
+ munDrHuc10Layer: { |
+ ...state.munDrHuc10Layer, |
+ watersheds: action.munDrHuc10Data.dr_layer, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_FETCHING_MUN_DR_HUC10S) { |
- ret = { ...state, munDrHuc10Layer: { ...state.munDrHuc10Layer, fetchingLayer: action.isFetching } } |
+ ret = { |
+ ...state, |
+ munDrHuc10Layer: { |
+ ...state.munDrHuc10Layer, |
+ fetchingLayer: action.isFetching, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_MUN_DR_HUC12S) { |
- ret = { ...state, munDrHuc12Layer: { ...state.munDrHuc12Layer, watersheds: action.munDrHuc12Data.dr_layer } } |
+ ret = { |
+ ...state, |
+ munDrHuc12Layer: { |
+ ...state.munDrHuc12Layer, |
+ watersheds: action.munDrHuc12Data.dr_layer, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_FETCHING_MUN_DR_HUC12S) { |
- ret = { ...state, munDrHuc12Layer: { ...state.munDrHuc12Layer, fetchingLayer: action.isFetching } } |
+ ret = { |
+ ...state, |
+ munDrHuc12Layer: { |
+ ...state.munDrHuc12Layer, |
+ fetchingLayer: action.isFetching, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_MUN_DR_COUNTIES) { |
- ret = { ...state, munDrCountyLayer: { ...state.munDrCountyLayer, watersheds: action.munDrCountyData.dr_layer } } |
+ ret = { |
+ ...state, |
+ munDrCountyLayer: { |
+ ...state.munDrCountyLayer, |
+ watersheds: action.munDrCountyData.dr_layer, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_FETCHING_MUN_DR_COUNTIES) { |
- ret = { ...state, munDrCountyLayer: { ...state.munDrCountyLayer, fetchingLayer: action.isFetching } } |
+ ret = { |
+ ...state, |
+ munDrCountyLayer: { |
+ ...state.munDrCountyLayer, |
+ fetchingLayer: action.isFetching, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_URBAN_AREAS) { |
- ret = { ...state, urbanAreaLayer: { ...state.urbanAreaLayer, areas: action.urbanAreaData.urbanareas } } |
+ ret = { |
+ ...state, |
+ urbanAreaLayer: { |
+ ...state.urbanAreaLayer, |
+ areas: action.urbanAreaData.urbanareas, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_FETCHING_URBAN_AREAS) { |
- ret = { ...state, urbanAreaLayer: { ...state.urbanAreaLayer, fetchingLayer: action.isFetching } } |
+ ret = { |
+ ...state, |
+ urbanAreaLayer: { |
+ ...state.urbanAreaLayer, |
+ fetchingLayer: action.isFetching, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_WWTFS) { |
- ret = { ...state, wwtfsDataLayer: { ...state.wwtfsDataLayer, wwtfs: action.wwtfsData.wwtfs } } |
+ ret = { |
+ ...state, |
+ wwtfsDataLayer: { |
+ ...state.wwtfsDataLayer, |
+ wwtfs: action.wwtfsData.wwtfs, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_FETCHING_WWTFS) { |
- ret = { ...state, wwtfsDataLayer: { ...state.wwtfsDataLayer, fetchingLayer: action.isFetching } } |
+ ret = { |
+ ...state, |
+ wwtfsDataLayer: { |
+ ...state.wwtfsDataLayer, |
+ fetchingLayer: action.isFetching, |
+ }, |
+ } |
} else if (action.type === actionTypes.SET_WWTF_CURRENT) { |
- ret = { ...state, wwtfsDataLayer: { ...state.wwtfsDataLayer, current: { properties: action.currentItem.properties } } } |
+ ret = { |
+ ...state, |
+ wwtfsDataLayer: { |
+ ...state.wwtfsDataLayer, |
+ current: { properties: action.currentItem.properties }, |
+ }, |
+ } |
} |
return ret |
} |
@@ -5,7 +5,7 @@ |
const path = require('path') |
|
// Writes the CSS code processed by Webpack into its own CSS-file and not into the generated bundle JavaScript file. |
-const MiniCssExtractPlugin = require('mini-css-extract-plugin'); |
+const MiniCssExtractPlugin = require('mini-css-extract-plugin') |
|
module.exports = { |
context: __dirname + '/er2_watershedpriority', |
@@ -13,30 +13,56 @@ |
output: { |
path: __dirname + '/er2_watershedpriority/dist', |
filename: 'index.min.js', |
- sourceMapFilename: 'index.js.map', |
}, |
module: { |
rules: [ |
- { // Compile all Javascript using Babel (with React and Flow), targeting the 2 most recent browsers |
+ { |
+ test: /\.m?js$/, |
+ resolve: { |
+ fullySpecified: false, |
+ }, |
+ }, |
+ { |
+ // Compile all Javascript using Babel (with React and Flow), targeting the 2 most recent browsers |
test: /\.js$/, |
exclude: /node_modules/, |
- loader: "babel-loader" |
- }, { |
+ loader: 'babel-loader', |
+ }, |
+ { |
test: /\.css$/, |
use: [ |
- "style-loader", |
- MiniCssExtractPlugin.loader, |
- "css-loader", |
+ { |
+ loader: MiniCssExtractPlugin.loader, |
+ options: { |
+ publicPath: (resourcePath, context) => { |
+ // publicPath is the relative path of the resource to the context |
+ // e.g. for ./css/admin/main.css the publicPath will be ../../ |
+ // while for ./css/main.css the publicPath will be ../ |
+ return ( |
+ path.relative( |
+ path.dirname(resourcePath), |
+ context, |
+ ) + '/' |
+ ) |
+ }, |
+ }, |
+ }, |
+ 'css-loader', |
], |
- }, { |
+ }, |
+ { |
test: /\.(png|svg|jpg|gif)$/, |
- use: [ |
- 'file-loader' |
- ] |
+ use: ['file-loader'], |
}, |
- { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }, |
- { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }, |
- ] |
+ { |
+ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, |
+ loader: 'file-loader', |
+ }, |
+ { |
+ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, |
+ loader: 'file-loader', |
+ }, |
+ ], |
}, |
plugins: [ |
new MiniCssExtractPlugin({ |
@@ -45,7 +71,6 @@ |
filename: '[name].css', |
chunkFilename: '[id].css', |
}), |
- new webpack.optimize.OccurrenceOrderPlugin(), |
new webpack.DefinePlugin({ |
PRODUCTION: JSON.stringify(!debug), |
APP_VERSION: JSON.stringify(version), |
@@ -53,16 +78,7 @@ |
], |
resolve: { |
alias: { |
- catena: path.resolve(__dirname, '../../er2_map/static/er2_map/packages'), |
- ol: path.resolve(__dirname, './node_modules/ol'), |
- '@material-ui/core': path.resolve(__dirname, '../../er2_map/static/node_modules/@material-ui/core'), |
- '@material-ui/styles': path.resolve(__dirname, '../../er2_map/static/node_modules/@material-ui/styles'), |
- '@material-ui/icons': path.resolve(__dirname, '../../er2_map/static/node_modules/@material-ui/icons'), |
- // This fixes "TokenNavLink used outside of router' |
- 'react': path.resolve(__dirname, '../../er2_map/static/node_modules/react'), |
- 'react-dom': path.resolve(__dirname, '../../er2_map/static/node_modules/react-dom'), |
- 'react-router': path.resolve(__dirname, '../../er2_map/static/node_modules/react-router'), |
- 'react-router-dom': path.resolve(__dirname, '../../er2_map/static/node_modules/react-router-dom'), |
+ path: 'path-browserify', |
}, |
}, |
} |