Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Migrate Image download to react/redux #1553

Benjamin King38a5c7bdf256
diff --git a/web/css/modal.css b/web/css/modal.css
index eda5ff745..c7bbfa96f 100644
--- a/web/css/modal.css
+++ b/web/css/modal.css
@@ -13,10 +13,14 @@
.toolbar-list-modal .modal-content {
width: 150px;
}
-.toolbar-list-modal.modal-dialog {
+.toolbar-medium-modal,
+.toolbar-medium-modal .modal-content {
+ width: 230px;
+}
+.toolbar-modal.modal-dialog {
position: absolute;
top: 33px;
}
-.toolbar-list-modal .modal-body {
+.toolbar-modal .modal-body {
padding: 0;
};
\ No newline at end of file
diff --git a/web/js/animation/gif.js b/web/js/animation/gif.js
index d5480a7e3..d17382046 100644
--- a/web/js/animation/gif.js
+++ b/web/js/animation/gif.js
@@ -18,7 +18,7 @@ import {
imageUtilGetCoordsFromPixelValues,
imageUtilGetConversionFactor,
bboxWMS13
-} from '../image/util';
+} from '../modules/image-download/util';
import util from '../util/util';
import wvui from '../ui/ui';
import uiIndicator from '../ui/indicator';
diff --git a/web/js/app.js b/web/js/app.js
index e7671ba73..2005dbebc 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -101,7 +101,7 @@ import Brand from './brand';
import tour from './tour';
// Crutch between state systems
-import { sendModelsToStore } from './modules/migration/actions';
+import { sendConfigToStore } from './modules/migration/actions';
// Dependency CSS
import '../../node_modules/bootstrap/dist/css/bootstrap.css';
@@ -428,7 +428,7 @@ class App extends React.Component {
// HACK: Map needs permalink state loaded before starting. But
// data download now needs it too.
models.link.load(state); // needs to be loaded twice
- self.props.updateModels(models); // crutch between old state system and redux
+ self.props.updateConfig(models, config); // crutch between old state system and redux
elapsed('ui');
// Create widgets
ui.tour = tour(models, ui, config);
@@ -594,8 +594,8 @@ function registerMapMouseHandlers(maps, events) {
}
const mapDispatchToProps = dispatch => ({
- updateModels: modelsObject => {
- dispatch(sendModelsToStore(modelsObject));
+ updateConfig: (models, configObject) => {
+ dispatch(sendConfigToStore(models, configObject));
}
});
diff --git a/web/js/components/image-download/panel.js b/web/js/components/image-download/panel.js
index 95d61c161..0b79e971d 100644
--- a/web/js/components/image-download/panel.js
+++ b/web/js/components/image-download/panel.js
@@ -1,8 +1,15 @@
import React from 'react';
+import {
+ imageSizeValid,
+ getDimensions
+} from '../../modules/image-download/util';
+
import SelectionList from '../util/selector';
import ResTable from './grid';
import PropTypes from 'prop-types';
+const MAX_DIMENSION_SIZE = 8200;
+
/*
* A react component, Builds a rather specific
* interactive widget
@@ -13,14 +20,9 @@ import PropTypes from 'prop-types';
export default class ImageResSelection extends React.Component {
constructor(props) {
super(props);
+
this.state = {
- imageSize: props.imageSize,
- imgHeight: props.imgHeight,
- imgWidth: props.imgWidth,
- resolutions: props.resolutions,
- onSelectionChange: props.onSelectionChange,
fileType: props.fileType,
- fileTypes: props.fileTypes,
fileSize: props.fileSize,
proj: this.props.proj,
worldfile: props.worldfile,
@@ -28,24 +30,21 @@ export default class ImageResSelection extends React.Component {
valid: props.valid
};
}
+ onDownloadClick() {}
handleChange(type, value) {
- var fileType = this.state.fileType;
- var resolution = this.state.resolution;
- var worldfile = this.state.worldfile;
-
if (type === 'resolution') {
- resolution = value;
+ this.setState({
+ resolution: value
+ });
} else if (type === 'worldfile') {
- worldfile = value;
+ this.setState({
+ worldfile: value
+ });
} else {
- fileType = value;
+ this.setState({
+ fileType: value
+ });
}
- this.state = {
- resolution: resolution,
- fileType: fileType,
- worldfile: worldfile
- };
- this.props.onSelectionChange(resolution, worldfile, fileType);
}
_renderFileTypeSelect() {
if (this.props.fileTypeOptions) {
@@ -55,7 +54,7 @@ export default class ImageResSelection extends React.Component {
id="wv-image-format"
optionName="filetype"
value={this.state.fileType}
- optionArray={this.state.fileTypes}
+ optionArray={this.props.fileTypes}
onChange={this.handleChange.bind(this)}
/>
{this.props.secondLabel}
@@ -69,7 +68,7 @@ export default class ImageResSelection extends React.Component {
<div className="wv-image-header">
{this.state.fileType === 'image/kmz' ? (
<select disabled>
- <option value="false">No</option>
+ <option value={false}>No</option>
</select>
) : (
<select
@@ -77,8 +76,8 @@ export default class ImageResSelection extends React.Component {
value={this.state.worldfile}
onChange={e => this.handleChange('worldfile', e.target.value)}
>
- <option value="false">No</option>
- <option value="true">Yes</option>
+ <option value={false}>No</option>
+ <option value={true}>Yes</option>
</select>
)}
Worldfile (.zip)
@@ -87,16 +86,20 @@ export default class ImageResSelection extends React.Component {
}
}
render() {
- var filetypeSelect = this._renderFileTypeSelect();
- var worldfileSelect = this._renderWorldfileSelect();
-
+ const { projection, boundaries, resolutions, maxImageSize } = this.props;
+ const { resolution } = this.state;
+ const dimensions = getDimensions(projection, boundaries, resolution);
+ const height = dimensions.height;
+ const width = dimensions.width;
+ const filetypeSelect = this._renderFileTypeSelect();
+ const worldfileSelect = this._renderWorldfileSelect();
return (
<div className="wv-re-pick-wrapper">
<div className="wv-image-header">
<SelectionList
id="wv-image-resolution"
- optionArray={this.state.resolutions}
- value={this.state.resolution}
+ optionArray={resolutions}
+ value={resolution}
optionName="resolution"
onChange={this.handleChange.bind(this)}
/>
@@ -105,12 +108,12 @@ export default class ImageResSelection extends React.Component {
{filetypeSelect}
{worldfileSelect}
<ResTable
- width={this.state.imgWidth}
- height={this.state.imgHeight}
- fileSize={this.state.fileSize}
- maxImageSize={this.props.maxImageSize}
- valid={this.state.valid}
- onClick={this.props.onDownloadClick}
+ width={width}
+ height={height}
+ fileSize={((width * height * 24) / 8388608).toFixed(2)}
+ maxImageSize={maxImageSize}
+ valid={imageSizeValid(height, width, MAX_DIMENSION_SIZE)}
+ onClick={this.onDownloadClick.bind(this)}
/>
</div>
);
@@ -126,22 +129,17 @@ ImageResSelection.defaultProps = {
maxImageSize: '250 MB',
worldfile: false,
resolution: '1',
- imgHeight: null,
- imgWidth: null,
worldFileOptions: true,
- fileTypeOptions: true
+ fileTypeOptions: true,
+ fileType: 'image/jpeg'
};
ImageResSelection.propTypes = {
- imageSize: PropTypes.string,
- imgHeight: PropTypes.number,
- imgWidth: PropTypes.number,
resolutions: PropTypes.object,
- onSelectionChange: PropTypes.func,
fileType: PropTypes.string,
fileTypes: PropTypes.object,
fileSize: PropTypes.string,
proj: PropTypes.string,
- worldfile: PropTypes.string,
+ worldfile: PropTypes.bool,
resolution: PropTypes.string,
valid: PropTypes.bool,
onDownloadClick: PropTypes.func,
diff --git a/web/js/components/util/detect-outer-click.js b/web/js/components/util/detect-outer-click.js
index fce4f9af4..132eebe84 100644
--- a/web/js/components/util/detect-outer-click.js
+++ b/web/js/components/util/detect-outer-click.js
@@ -1,4 +1,4 @@
-// Take from https://stackoverflow.com/a/42234988
+// Taken from https://stackoverflow.com/a/42234988
import React, { Component } from 'react';
import PropTypes from 'prop-types';
diff --git a/web/js/components/util/list.js b/web/js/components/util/list.js
index 4bf9d53b8..0d0cbba88 100644
--- a/web/js/components/util/list.js
+++ b/web/js/components/util/list.js
@@ -23,6 +23,7 @@ export default class List extends React.Component {
const tagType = item.href ? 'a' : 'button';
return (
<ListGroupItem
+ key={item.key || item.id || ''}
tag={tagType}
active={isActive}
className={className + ' ' + size + '-item'}
diff --git a/web/js/containers/image-download.js b/web/js/containers/image-download.js
index 560c1255e..2480e2487 100644
--- a/web/js/containers/image-download.js
+++ b/web/js/containers/image-download.js
@@ -2,7 +2,9 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import Panel from '../components/image-download/panel';
-import CropSelection from '../components/util/image-crop';
+import Crop from '../components/util/image-crop';
+import { imageUtilCalculateResolution } from '../modules/image-download/util';
+import util from '../util/util';
import {
resolutionsGeo,
@@ -10,16 +12,64 @@ import {
fileTypesGeo,
fileTypesPolar
} from '../modules/image-download/constants';
-// import BoundarySelection from '../components/image-download/select-boundary';
+
+const DEFAULT_URL = 'http://localhost:3002/api/v1/snapshot';
class ImageDownloadContainer extends Component {
- onSelectionChange() {}
+ constructor(props) {
+ super(props);
+ const windowWidth = window.innerWidth;
+ const windowHeight = window.innerHeight;
+ const bounds = [
+ [windowWidth / 2 - 100, windowHeight / 2 - 100],
+ [windowWidth / 2 + 100, windowHeight / 2 + 100]
+ ];
+ this.state = {
+ boundaries: bounds
+ };
+ }
+ // onDownload() {
+ // let time = new Date(models.date[models.date.activeDate].getTime());
+ // time.setUTCHours(0, 0, 0, 0);
+
+ // let layerList = models.layers.get({
+ // reverse: true,
+ // renderable: true
+ // });
+ // let layers = imageUtilGetLayers(layerList, models.proj.selected.id);
+ // let opacities = imageUtilGetLayerOpacities(layerList);
+ // let crs = models.proj.selected.crs;
+
+ // let params = [
+ // 'REQUEST=GetSnapshot',
+ // `TIME=${util.toISOStringDate(time)}`,
+ // `BBOX=${bboxWMS13(lonlats, crs)}`,
+ // `CRS=${crs}`,
+ // `LAYERS=${layers.join(',')}`,
+ // `FORMAT=${imgFormat}`,
+ // `WIDTH=${imgWidth}`,
+ // `HEIGHT=${imgHeight}`
+ // ];
+ // if (opacities.length > 0) {
+ // params.push(`OPACITIES=${opacities.join(',')}`);
+ // }
+ // if (imgWorldfile === 'true') {
+ // params.push('WORLDFILE=true');
+ // }
+ // let dlURL = url + '?' + params.join('&') + `&ts=${Date.now()}`;
+ // }
render() {
- const { projection, boundaries, el } = this.props;
- const fileTypes =
- projection === 'geographic' ? fileTypesGeo : fileTypesPolar;
- const resolutions =
- projection === 'geographic' ? resolutionsGeo : resolutionsPolar;
+ const { projection, models } = this.props;
+ const { boundaries } = this.state;
+ const isGeoProjection = projection === 'geographic';
+ const fileTypes = isGeoProjection ? fileTypesGeo : fileTypesPolar;
+ const resolutions = isGeoProjection ? resolutionsGeo : resolutionsPolar;
+ console.log(projection, isGeoProjection, models.proj.selected.resolutions);
+ const resolution = imageUtilCalculateResolution(
+ models.map.zoom,
+ isGeoProjection,
+ models.proj.selected.resolutions
+ );
return (
<React.Fragment>
<Panel
@@ -27,20 +77,30 @@ class ImageDownloadContainer extends Component {
fileTypes={fileTypes}
resolutions={resolutions}
boundaries={boundaries}
+ resolution={resolution}
/>
- <CropSelection onChange={this.onSelectionChange.bind(this)} el={el} />
+ <Crop />
</React.Fragment>
);
}
}
function mapStateToProps(state) {
- const { projection } = state.projection;
- // const { boundaries } = state.imageDownload;
+ const { id } = state.projection;
+ const { config, models } = state.models;
+ let url = DEFAULT_URL;
+ if (config.features.imageDownload && config.features.imageDownload.url) {
+ url = config.features.imageDownload.url;
+ }
+ if ('imageDownload' in config.parameters) {
+ url = config.parameters.imageDownload;
+ util.warn('Redirecting image download to: ' + url);
+ }
return {
- projection,
- boundaries: 0
+ projection: id,
+ url,
+ models
};
}
diff --git a/web/js/containers/modal.js b/web/js/containers/modal.js
index 818151272..db22903cd 100644
--- a/web/js/containers/modal.js
+++ b/web/js/containers/modal.js
@@ -51,40 +51,39 @@ class ModalContainer extends Component {
? customProps[id].bodyComponent
: '';
const style = this.getStyle(newProps);
-
return (
- <React.Fragment>
- <Modal
- isOpen={isOpen}
- toggle={onToggle}
- backdrop={backdrop}
- id={id}
- className={modalClassName || 'default-modal'}
- autoFocus={autoFocus || false}
- style={style}
+ <Modal
+ isOpen={isOpen}
+ toggle={onToggle}
+ backdrop={backdrop && type !== 'selection'}
+ id={id}
+ className={modalClassName || 'default-modal'}
+ autoFocus={autoFocus || false}
+ style={style}
+ >
+ <DetectOuterClick
+ onClick={onToggle}
+ disabled={!isOpen || type === 'selection'}
>
- <DetectOuterClick onClick={onToggle} disabled={!isOpen}>
- {headerComponent || headerText ? (
- <ModalHeader toggle={onToggle}>
- {headerComponent ? <headerComponent /> : headerText || ''}
- </ModalHeader>
+ {headerComponent || headerText ? (
+ <ModalHeader toggle={onToggle}>
+ {headerComponent ? <headerComponent /> : headerText || ''}
+ </ModalHeader>
+ ) : (
+ ''
+ )}
+ <ModalBody>
+ {bodyHeader ? <h3>{bodyHeader}</h3> : ''}
+ {BodyComponent ? (
+ <BodyComponent />
+ ) : isTemplateModal ? (
+ this.getTemplateBody()
) : (
- ''
+ bodyText || ''
)}
- <ModalBody>
- {bodyHeader ? <h3>{bodyHeader}</h3> : ''}
- {BodyComponent ? (
- <BodyComponent />
- ) : isTemplateModal ? (
- this.getTemplateBody()
- ) : (
- bodyText || ''
- )}
- </ModalBody>
- </DetectOuterClick>
- </Modal>
- {isOpen && type === 'selection' ? <Crop /> : ''}
- </React.Fragment>
+ </ModalBody>
+ </DetectOuterClick>
+ </Modal>
);
}
}
diff --git a/web/js/map/model.js b/web/js/map/model.js
index c2f05ecc2..67e3185c1 100644
--- a/web/js/map/model.js
+++ b/web/js/map/model.js
@@ -6,6 +6,7 @@ export function mapModel(models, config) {
var self = {};
self.extent = null;
+ self.zoom = null;
self.events = util.events();
self.rotation = 0;
/*
@@ -18,11 +19,14 @@ export function mapModel(models, config) {
*
* @returns {void}
*/
- self.update = function (extent) {
+ self.update = function(extent) {
self.extent = extent;
self.events.trigger('update', extent);
};
-
+ // Give other components access to zoom Level
+ self.updateZoom = function(zoom) {
+ self.zoom = Math.round(zoom);
+ };
/*
* Sets map view from parsed URL
*
@@ -35,7 +39,7 @@ export function mapModel(models, config) {
*
* @returns {void}
*/
- self.load = function (state, errors) {
+ self.load = function(state, errors) {
if (state.v) {
var proj = models.proj.selected;
var extent = state.v;
@@ -55,7 +59,9 @@ export function mapModel(models, config) {
}
// get rotation if it exists
if (state.p === 'arctic' || state.p === 'antarctic') {
- if (!isNaN(state.r)) { self.rotation = state.r * (Math.PI / 180.0); } // convert to radians
+ if (!isNaN(state.r)) {
+ self.rotation = state.r * (Math.PI / 180.0);
+ } // convert to radians
}
};
@@ -71,11 +77,14 @@ export function mapModel(models, config) {
*
* @returns {void}
*/
- self.save = function (state) {
+ self.save = function(state) {
state.v = lodashClone(self.extent);
- if (self.rotation !== 0.0 && self.rotation !== 0 && models.proj.selected.id !== 'geographic') {
- state.r = (self.rotation * (180.0 / Math.PI))
- .toPrecision(6);
+ if (
+ self.rotation !== 0.0 &&
+ self.rotation !== 0 &&
+ models.proj.selected.id !== 'geographic'
+ ) {
+ state.r = (self.rotation * (180.0 / Math.PI)).toPrecision(6);
} // convert from radians to degrees
};
@@ -94,9 +103,8 @@ export function mapModel(models, config) {
*
* @returns {object} Extent Array
*/
- self.getLeadingExtent = function () {
- var curHour = util.now()
- .getUTCHours();
+ self.getLeadingExtent = function() {
+ var curHour = util.now().getUTCHours();
// For earlier hours when data is still being filled in, force a far eastern perspective
if (curHour < 3) {
@@ -116,4 +124,4 @@ export function mapModel(models, config) {
};
return self;
-};
+}
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index e752c1fb2..39394c92c 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -697,8 +697,10 @@ export function mapui(models, config) {
* @returns {void}
*/
var updateExtent = function() {
- var map = self.selected;
- models.map.update(map.getView().calculateExtent(map.getSize()));
+ const map = self.selected;
+ const view = map.getView();
+ const extent = view.calculateExtent(map.getSize());
+ models.map.update(extent);
triggerExtent();
};
/*
@@ -904,6 +906,7 @@ export function mapui(models, config) {
var onZoomChange = function() {
var maxZoom = proj.resolutions.length;
var zoom = map.getView().getZoom();
+ models.map.updateZoom(zoom);
if (zoom === 0) {
$zoomIn.button('enable');
$zoomOut.button('disable');
diff --git a/web/js/image/util.js b/web/js/modules/image-download/util.js
similarity index 68%
rename from web/js/image/util.js
rename to web/js/modules/image-download/util.js
index fdb8dd64c..afbce2d77 100644
--- a/web/js/image/util.js
+++ b/web/js/modules/image-download/util.js
@@ -8,20 +8,28 @@ const POLAR_ESTIMATION_CONSTANT = 0.002197265625;
* This is only run if user has not already selected
* a resolution
*/
-export function imageUtilCalculateResolution(zoom, isGeoProjection, resolutions) {
+export function imageUtilCalculateResolution(
+ zoom,
+ isGeoProjection,
+ resolutions
+) {
var resolution;
var resolutionEstimate;
var nZoomLevels = resolutions.length;
var currentZoom = zoom < 0 ? 0 : zoom;
- var curResolution = (currentZoom >= nZoomLevels)
- ? resolutions[nZoomLevels - 1]
- : resolutions[currentZoom];
+ var curResolution =
+ currentZoom >= nZoomLevels
+ ? resolutions[nZoomLevels - 1]
+ : resolutions[currentZoom];
// Estimate the option value used by "wv-image-resolution"
- resolutionEstimate = imageUtilEstimateResolution(curResolution, isGeoProjection);
+ resolutionEstimate = imageUtilEstimateResolution(
+ curResolution,
+ isGeoProjection
+ );
// Find the closest match of resolution within the available values
- var possibleResolutions = (isGeoProjection)
+ var possibleResolutions = isGeoProjection
? [0.125, 0.25, 0.5, 1, 2, 4, 20, 40]
: [1, 2, 4, 20, 40];
var bestDiff = Infinity;
@@ -57,7 +65,7 @@ export function imageUtilCalculateResolution(zoom, isGeoProjection, resolutions)
}
}
return resolution.toString();
-};
+}
/*
* Retieves avtive layers by day
@@ -70,7 +78,7 @@ export function imageUtilCalculateResolution(zoom, isGeoProjection, resolutions)
* @returns {array} array of layer ids
*
*/
-export function imageUtilGetLayers (products, proj) {
+export function imageUtilGetLayers(products, proj) {
var layers = [];
lodashEach(products, function(layer) {
if (layer.projections[proj].layer) {
@@ -80,7 +88,7 @@ export function imageUtilGetLayers (products, proj) {
}
});
return layers;
-};
+}
/*
* Retieves opacities from palettes
*
@@ -92,10 +100,10 @@ export function imageUtilGetLayers (products, proj) {
* @returns {array} array of opacities
*
*/
-export function imageUtilGetLayerOpacities (layers) {
+export function imageUtilGetLayerOpacities(layers) {
let opacities = [];
let found = false;
- layers.forEach((layer) => {
+ layers.forEach(layer => {
let opacity = '';
if ('opacity' in layer && layer.opacity !== 1) {
opacity = layer.opacity;
@@ -109,15 +117,17 @@ export function imageUtilGetLayerOpacities (layers) {
return [];
}
return opacities;
-};
+}
export function imageUtilEstimateResolution(resolution, isGeoProjection) {
- return (isGeoProjection) ? resolution / POLAR_ESTIMATION_CONSTANT : resolution / GEO_ESTIMATION_CONSTANT;
+ return isGeoProjection
+ ? resolution / POLAR_ESTIMATION_CONSTANT
+ : resolution / GEO_ESTIMATION_CONSTANT;
}
-export function imageUtilGetConversionFactor (proj) {
+export function imageUtilGetConversionFactor(proj) {
if (proj === 'geographic') return 0.002197;
return 256;
-};
+}
/*
* Retieves coordinates from pixel
@@ -128,12 +138,12 @@ export function imageUtilGetConversionFactor (proj) {
* @returns {array} array of coords
*
*/
-export function imageUtilGetCoordsFromPixelValues (pixels, map) {
+export function imageUtilGetCoordsFromPixelValues(pixels, map) {
return [
map.getCoordinateFromPixel([Math.floor(pixels.x), Math.floor(pixels.y2)]),
map.getCoordinateFromPixel([Math.floor(pixels.x2), Math.floor(pixels.y)])
];
-};
+}
/**
* Given a bounding box as an array of a lower left coordinate pair
@@ -143,8 +153,36 @@ export function imageUtilGetCoordsFromPixelValues (pixels, map) {
*/
export function bboxWMS13(lonlats, crs) {
if (crs === 'EPSG:4326') {
- return `${lonlats[0][1]},${lonlats[0][0]},${lonlats[1][1]},${lonlats[1][0]}`;
+ return `${lonlats[0][1]},${lonlats[0][0]},${lonlats[1][1]},${
+ lonlats[1][0]
+ }`;
} else {
- return `${lonlats[0][0]},${lonlats[0][1]},${lonlats[1][0]},${lonlats[1][1]}`;
+ return `${lonlats[0][0]},${lonlats[0][1]},${lonlats[1][0]},${
+ lonlats[1][1]
+ }`;
}
}
+
+export function imageSizeValid(imgHeight, imgWidth, maxSize) {
+ if (imgHeight === 0 && imgWidth === 0) {
+ return false;
+ }
+ if (imgHeight > maxSize || imgWidth > maxSize) {
+ return false;
+ }
+ return true;
+}
+export function getDimensions(projection, bounds, resolution) {
+ const conversionFactor = imageUtilGetConversionFactor(projection);
+ const imgWidth = Math.round(
+ Math.abs(bounds[1][0] - bounds[0][0]) /
+ conversionFactor /
+ Number(resolution)
+ );
+ const imgHeight = Math.round(
+ Math.abs(bounds[1][1] - bounds[0][1]) /
+ conversionFactor /
+ Number(resolution)
+ );
+ return { width: imgWidth, height: imgHeight };
+}
diff --git a/web/js/image/util.test.js b/web/js/modules/image-download/util.test.js
similarity index 100%
rename from web/js/image/util.test.js
rename to web/js/modules/image-download/util.test.js
diff --git a/web/js/modules/migration/actions.js b/web/js/modules/migration/actions.js
index f3474e184..b87aa073d 100644
--- a/web/js/modules/migration/actions.js
+++ b/web/js/modules/migration/actions.js
@@ -1,8 +1,9 @@
-import { MODELS_HAVE_BEEN_LOADED } from './constants';
+import { CONFIG_HAS_BEEN_LOADED } from './constants';
-export function sendModelsToStore(models) {
+export function sendConfigToStore(models, config) {
return {
- type: MODELS_HAVE_BEEN_LOADED,
- models: models
+ type: CONFIG_HAS_BEEN_LOADED,
+ models: models,
+ config: config
};
}
diff --git a/web/js/modules/migration/constants.js b/web/js/modules/migration/constants.js
index f3d267cd8..8bd5e43a3 100644
--- a/web/js/modules/migration/constants.js
+++ b/web/js/modules/migration/constants.js
@@ -1 +1 @@
-export const MODELS_HAVE_BEEN_LOADED = 'MODELS_HAVE_BEEN_LOADED';
+export const CONFIG_HAS_BEEN_LOADED = 'CONFIG_HAVE_BEEN_LOADED';
diff --git a/web/js/modules/migration/reducers.js b/web/js/modules/migration/reducers.js
index 1b5ecae51..1d8342852 100644
--- a/web/js/modules/migration/reducers.js
+++ b/web/js/modules/migration/reducers.js
@@ -1,18 +1,19 @@
-import { MODELS_HAVE_BEEN_LOADED } from './constants';
+import { CONFIG_HAS_BEEN_LOADED } from './constants';
import { assign as lodashAssign } from 'lodash';
const modelsState = {
loaded: false,
- models: {}
+ models: {},
+ config: {}
};
export default function modelsReducer(state = modelsState, action) {
console.log(action);
switch (action.type) {
- case MODELS_HAVE_BEEN_LOADED:
- console.log(action);
+ case CONFIG_HAS_BEEN_LOADED:
return lodashAssign({}, state, {
models: action.models,
+ config: action.config,
loaded: true
});
default:
diff --git a/web/js/modules/modal/customs.js b/web/js/modules/modal/customs.js
index f6486ef4c..787bb69ed 100644
--- a/web/js/modules/modal/customs.js
+++ b/web/js/modules/modal/customs.js
@@ -16,7 +16,8 @@ export const customProps = {
headerText: 'Copy link to share:',
type: 'toolbar',
backdrop: false,
- modalClassName: 'toolbar-share-modal toolbar-modal',
+ offsetRight: '198px',
+ modalClassName: 'toolbar-share-modal toolbar-modal toolbar-medium-modal',
bodyComponent: ShareLinks
},
TOOLBAR_INFO: {
@@ -31,7 +32,8 @@ export const customProps = {
headerText: 'Take a Snapshot',
backdrop: false,
type: 'selection',
- modalClassName: 'toolbar-snapshot-modal toolbar-modal',
+ offsetRight: '70px',
+ modalClassName: 'toolbar-snapshot-modal toolbar-modal toolbar-medium-modal',
bodyComponent: ImageDownload
}
};