Interactive interface for browsing global, full-resolution satellite imagery
Style vector dialog #2144
Benjamin King582018948ecc
diff --git a/web/css/modal.css b/web/css/modal.cssindex 26310eb4c..c3cf792b1 100644--- a/web/css/modal.css+++ b/web/css/modal.css@@ -11,6 +11,9 @@.clickable-behind-modal .modal {position: inherit;}+.modal-dialog .modal-header .close:hover {+ color: #fff;+}.draggable-modal .modal {position: fixed;}@@ -38,18 +41,28 @@list-style-type: disc;margin: 2px 0 2px 20px;}++.dynamic-modal.modal-dialog {+ position: absolute;+}+.notify .modal-footer {+ border: none;+}++/* light modal styling */.modal-dialog.light .modal-content {background-color: #dcdcdc;+ color: #000}-.modal-dialog .modal-header .close:hover {- color: #fff;+.modal-dialog.light .modal-header{+ color: #343a40;}-.modal-dialog.light .modal-header .close:hover {+.modal-dialog.light .modal-header .close {color: #000;}-.dynamic-modal.modal-dialog {- position: absolute;-}-.notify .modal-footer {- border: none;+.modal-dialog.light .modal-header .close:hover {+ color: #000;}+.modal-dialog.light .modal-content .modal-body{+background: #eee;+}\ No newline at end of filediff --git a/web/css/vectorMeta.css b/web/css/vectorMeta.cssindex 5f5fd6bb1..a437d5897 100644--- a/web/css/vectorMeta.css+++ b/web/css/vectorMeta.css@@ -3,7 +3,6 @@}.vector-modal .modal-title {- color: #fff;font-weight: 800;}@@ -29,14 +28,13 @@.vector-modal .vector-info-icon {position: absolute;font-size: 8px;- border: 1px solid #fff;+ border: 1px solid #495057;width: 13px;height: 13px;text-align: center;border-radius: 50%;padding-top: 1px;margin-top: 0;- top: 0;right: 0;}diff --git a/web/js/components/vector-metadata/table.js b/web/js/components/vector-metadata/table.jsindex 308e77088..454d54622 100644--- a/web/js/components/vector-metadata/table.js+++ b/web/js/components/vector-metadata/table.js@@ -2,6 +2,7 @@ import React from 'react';import PropTypes from 'prop-types';import { Table } from 'reactstrap';import VectorMetaTooltip from './tooltip';+import { find as lodashFind } from 'lodash';export default class VectorMetaTable extends React.Component {constructor(props) {@@ -17,51 +18,43 @@ export default class VectorMetaTable extends React.Component {render() {var header, data;const { metaFeatures, metaLegend } = this.state;- if (- metaFeatures &&- (typeof metaFeatures === 'object' && metaFeatures !== null)- ) {- header = Object.entries(metaFeatures).map(([featureId, i], x) => {- var tooltipDescription;- Object.values(metaLegend.mvt_properties).forEach(property => {- if (property && property.Description && (property.Identifier.toLowerCase() === featureId.toLowerCase())) {- tooltipDescription = property.Description;- }- });- return (- <th key={x} index={x} className={(tooltipDescription ? 'pr-4' : 'pr-0')}>- {featureId}- {tooltipDescription &&- <VectorMetaTooltip index={x} description={tooltipDescription} />- }- </th>- );- });-- data = Object.entries(metaFeatures).map(([featureId, i], x) => (- <th key={x} index={x}>- {i}- </th>- ));- }-+ console.log(metaFeatures)+ console.log(metaLegend)return (- <Table dark striped bordered size="sm">- <thead>- <tr>- {header}- </tr>- </thead>+ <Table size="sm"><tbody>- <tr>- {data}- </tr>+ {Object.entries(metaFeatures).map(([featureId, i], index) => {+ console.log(metaLegend.mvt_properties);+ const properties = lodashFind(metaLegend.mvt_properties, { Identifier: featureId });+ // Object.values(metaLegend.mvt_properties).forEach(property => {+ // if (property && property.Description && (property.Identifier.toLowerCase() === featureId.toLowerCase())) {+ // tooltipDescription = property.Description;+ // }+ // })+ console.log(properties && properties.Description ? properties.Description : properties);+ return (+ <tr>+ <td>+ {properties ? properties.Title || featureId : featureId}+ </td>+ <td>+ {i}+ </td>+ {properties && properties.Description ? (+ <td>+ <VectorMetaTooltip index={index} description={properties.Description} />+ </td>+ ) : ''+ }+ </tr>++ )+ })}</tbody>- </Table>- );+ </Table >+ )}}-VectorMetaTable.propTypes = {metaFeatures: PropTypes.object.isRequired,metaLegend: PropTypes.object.isRequireddiff --git a/web/js/components/vector-metadata/tooltip.js b/web/js/components/vector-metadata/tooltip.jsindex a3bb739a9..79c675335 100644--- a/web/js/components/vector-metadata/tooltip.js+++ b/web/js/components/vector-metadata/tooltip.js@@ -19,6 +19,7 @@ export default class VectorMetaTooltip extends React.Component {}render() {+ console.log(this.props)return (<Fragment key={this.props.index}><span href="#" id={'tooltip-' + this.props.index}><i className="fa fa-info vector-info-icon"></i></span>diff --git a/web/js/containers/modal.js b/web/js/containers/modal.jsindex 44bb6e07c..d224b558f 100644--- a/web/js/containers/modal.js+++ b/web/js/containers/modal.js@@ -48,11 +48,11 @@ class ModalContainer extends Component {return bodyTemplate.isLoading ? (<span> Loading </span>) : (- <div- id="template-content"- dangerouslySetInnerHTML={{ __html: bodyTemplate.response }}- />- );+ <div+ id="template-content"+ dangerouslySetInnerHTML={{ __html: bodyTemplate.response }}+ />+ );}render() {@@ -142,7 +142,7 @@ class ModalContainer extends Component {? (<BodyComponent {...bodyComponentProps}screenHeight={screenHeight}- closeModal={toggleWithClose}/>+ closeModal={toggleWithClose} />): isTemplateModal ? this.getTemplateBody() : bodyText || ''}</ModalBody>diff --git a/web/js/map/ui.js b/web/js/map/ui.jsindex 57bc30753..cf2a03039 100644--- a/web/js/map/ui.js+++ b/web/js/map/ui.js@@ -95,7 +95,7 @@ export function mapui(models, config, store, ui) {* Suscribe to redux store and listen for* specific action types*/- const subscribeToStore = function(action) {+ const subscribeToStore = function (action) {switch (action.type) {case layerConstants.ADD_LAYER: {const def = lodashFind(action.layers, { id: action.id });@@ -157,10 +157,10 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var init = function() {+ var init = function () {// NOTE: iOS sometimes bombs if this is _.each instead. In that case,// it is possible that config.projections somehow becomes array-like.- lodashForOwn(config.projections, function(proj) {+ lodashForOwn(config.projections, function (proj) {var map = createMap(proj);self.proj[proj.id] = map;});@@ -178,7 +178,7 @@ export function mapui(models, config, store, ui) {updateProjection(true);};- const flyToNewExtent = function(extent, rotation) {+ const flyToNewExtent = function (extent, rotation) {const coordinateX = extent[0] + (extent[2] - extent[0]) / 2;const coordinateY = extent[1] + (extent[3] - extent[1]) / 2;const coordinates = [coordinateX, coordinateY];@@ -199,7 +199,7 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var updateProjection = function(start) {+ var updateProjection = function (start) {const state = store.getState();const { proj } = state;if (self.selected) {@@ -262,7 +262,7 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var onResize = function() {+ var onResize = function () {var map = self.selected;if (map.small !== util.browser.small) {if (util.browser.small) {@@ -286,7 +286,7 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var hideMap = function(map) {+ var hideMap = function (map) {$('#' + map.getTarget()).hide();};/*@@ -299,7 +299,7 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var showMap = function(map) {+ var showMap = function (map) {$('#' + map.getTarget()).show();};/*@@ -312,12 +312,12 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var clearLayers = function(map) {+ var clearLayers = function (map) {var activeLayers = map.getLayers().getArray().slice(0);- lodashEach(activeLayers, function(mapLayer) {+ lodashEach(activeLayers, function (mapLayer) {map.removeLayer(mapLayer);});removeGraticule('active');@@ -335,7 +335,7 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var reloadLayers = self.reloadLayers = function(map) {+ var reloadLayers = self.reloadLayers = function (map) {map = map || self.selected;const state = store.getState();const { layers, proj } = state;@@ -354,7 +354,7 @@ export function mapui(models, config, store, ui) {},state);- lodashEach(defs, function(def) {+ lodashEach(defs, function (def) {if (isGraticule(def, proj.id)) {addGraticule(def.opacity, layerGroupStr);} else {@@ -382,7 +382,7 @@ export function mapui(models, config, store, ui) {* Create a Layergroup given the date and layerGroups* @param {Array} arr | Array of date/layer group strings*/- var getCompareLayerGroup = function(arr, layersState, projId, state) {+ var getCompareLayerGroup = function (arr, layersState, projId, state) {return new OlLayerGroup({layers: getLayers(layersState[arr[0]],@@ -415,15 +415,15 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var updateLayerVisibilities = function() {+ var updateLayerVisibilities = function () {const state = store.getState();var renderable;var layers = self.selected.getLayers();var layersState = state.layers;var activeGroupStr = state.compare.activeString;var activeDateStr = state.compare.isCompareA ? 'selected' : 'selectedB';- var updateGraticules = function(defs, groupName) {- lodashEach(defs, function(def) {+ var updateGraticules = function (defs, groupName) {+ lodashEach(defs, function (def) {if (isGraticule(def, state.proj.id)) {renderable = isRenderableLayer(def.id,@@ -439,7 +439,7 @@ export function mapui(models, config, store, ui) {}});};- layers.forEach(function(layer) {+ layers.forEach(function (layer) {var group = layer.get('group');// Not in A|Bif (layer.wv) {@@ -483,7 +483,7 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var updateOpacity = function(action) {+ var updateOpacity = function (action) {const state = store.getState();const { layers, compare, proj } = state;const activeStr = compare.isCompareA ? 'active' : 'activeB';@@ -512,7 +512,7 @@ export function mapui(models, config, store, ui) {* @returns {void}*/- var addLayer = function(def, date, activeLayers) {+ var addLayer = function (def, date, activeLayers) {const state = store.getState();const { compare, layers, proj } = state;const activeDateStr = compare.isCompareA ? 'selected' : 'selectedB';@@ -560,7 +560,7 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var removeLayer = function(action) {+ var removeLayer = function (action) {const state = store.getState();const { compare, proj } = state;const activeLayerStr = compare.isCompareA ? 'active' : 'activeB';@@ -589,7 +589,7 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var updateDate = self.updateDate = function() {+ var updateDate = self.updateDate = function () {const state = store.getState();const { compare } = state;const layerState = state.layers;@@ -613,7 +613,7 @@ export function mapui(models, config, store, ui) {: null;}}- lodashEach(activeLayers, function(def) {+ lodashEach(activeLayers, function (def) {const layerName = def.layer || def.id;if (!['subdaily', 'daily', 'monthly', 'yearly'].includes(def.period)) {@@ -666,7 +666,7 @@ export function mapui(models, config, store, ui) {** @todo Check if this function can be combined with updateLayerOrder*/- var updateLookup = function(layerId) {+ var updateLookup = function (layerId) {reloadLayers();};@@ -681,7 +681,7 @@ export function mapui(models, config, store, ui) {** @returns {object} Layer object*/- var findLayer = function(def, layerGroupStr) {+ var findLayer = function (def, layerGroupStr) {var layers = self.selected.getLayers().getArray();var layer = lodashFind(layers, {wv: {@@ -717,7 +717,7 @@ export function mapui(models, config, store, ui) {** @returns {number} Index of layer in OpenLayers layer array*/- var findLayerIndex = function(def, layerGroup) {+ var findLayerIndex = function (def, layerGroup) {layerGroup = layerGroup || self.selected;var layers = layerGroup.getLayers().getArray();@@ -742,7 +742,7 @@ export function mapui(models, config, store, ui) {** @returns {boolean}*/- var isGraticule = function(def, proj) {+ var isGraticule = function (def, proj) {return (def.projections[proj].type === 'graticule' || def.type === 'graticule');@@ -759,7 +759,7 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var addGraticule = function(opacity, groupStr) {+ var addGraticule = function (opacity, groupStr) {groupStr = groupStr || 'active';opacity = opacity || 0.5;var graticule = self.selected['graticule-' + groupStr];@@ -791,7 +791,7 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var removeGraticule = function(groupStr) {+ var removeGraticule = function (groupStr) {groupStr = groupStr || 'active';var graticule = self.selected['graticule-' + groupStr];if (graticule) {@@ -801,7 +801,7 @@ export function mapui(models, config, store, ui) {};var triggerExtent = lodashThrottle(- function() {+ function () {self.events.trigger('extent');},500,@@ -819,7 +819,7 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var updateExtent = function() {+ var updateExtent = function () {const map = self.selected;const view = map.getView();const extent = view.calculateExtent(map.getSize());@@ -866,7 +866,7 @@ export function mapui(models, config, store, ui) {** @returns {object} OpenLayers Map Object*/- var createMap = function(proj, dateSelected) {+ var createMap = function (proj, dateSelected) {const state = store.getState();const { date, compare } = state;const activeDate = compare.isCompareA ? 'selected' : 'selectedB';@@ -966,11 +966,11 @@ export function mapui(models, config, store, ui) {map.getView().on('change:center', lodashDebounce(updateExtent, 300));map.getView().on('change:resolution', lodashDebounce(updateExtent, 300));map.getView().on('change:rotation', lodashThrottle(onRotate, 300));- map.on('pointerdrag', function() {+ map.on('pointerdrag', function () {self.mapIsbeingDragged = true;self.events.trigger('drag');});- map.getView().on('propertychange', function(e) {+ map.getView().on('propertychange', function (e) {switch (e.key) {case 'resolution':self.mapIsbeingZoomed = true;@@ -978,9 +978,9 @@ export function mapui(models, config, store, ui) {break;}});- map.on('moveend', function(e) {+ map.on('moveend', function (e) {self.events.trigger('moveend');- setTimeout(function() {+ setTimeout(function () {self.mapIsbeingDragged = false;self.mapIsbeingZoomed = false;}, 200);@@ -992,12 +992,12 @@ export function mapui(models, config, store, ui) {if (store.getState().data.active) ui.data.onActivate();};map.on('rendercomplete', onRenderComplete);- map.on('click', function(e) {+ map.on('click', function (e) {var metaTitle;var def;var metaArray = [];- map.forEachFeatureAtPixel(e.pixel, function(feature, layer) {+ map.forEachFeatureAtPixel(e.pixel, function (feature, layer) {def = lodashGet(layer, 'wv.def');if (!def) return;metaTitle = def.title;@@ -1060,7 +1060,7 @@ export function mapui(models, config, store, ui) {** @returns {void}*/- var createZoomButtons = function(map, proj) {+ var createZoomButtons = function (map, proj) {var $map = $('#' + map.getTarget());var $zoomOut = $('<div></div>')@@ -1107,7 +1107,7 @@ export function mapui(models, config, store, ui) {* @returns {void}**/- var onZoomChange = function() {+ var onZoomChange = function () {var maxZoom = proj.resolutions.length;var zoom = map.getView().getZoom();if (zoom === 0) {@@ -1122,13 +1122,13 @@ export function mapui(models, config, store, ui) {}};- map.getView().on('change:resolution', function() {+ map.getView().on('change:resolution', function () {onZoomChange();self.events.trigger('movestart');});onZoomChange();};- var onRotate = function(val) {+ var onRotate = function (val) {rotation.updateRotation(val);updateExtent();};@@ -1148,7 +1148,7 @@ export function mapui(models, config, store, ui) {** @todo move this component to another Location*/- var createMousePosSel = function(map, proj) {+ var createMousePosSel = function (map, proj) {var hoverThrottle;function onMouseMove(e) {@@ -1194,7 +1194,7 @@ export function mapui(models, config, store, ui) {if (!self.mapIsbeingDragged && !self.mapIsbeingZoomed) dataRunner.newPoint(pixels, map);}$(map.getViewport())- .mouseout(function(e) {+ .mouseout(function (e) {if ($(e.relatedTarget).hasClass('map-coord') ||$(e.relatedTarget).hasClass('coord-btn')