Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

move filters to dropdown, cleanup measurement metadata component

Jason Kentea7221af66ac
diff --git a/tasks/upload.js b/tasks/upload.js
index f24754582..02a914010 100755
--- a/tasks/upload.js
+++ b/tasks/upload.js
@@ -122,10 +122,11 @@ async function upload() {
cd ${root}/${name} &&
tar xf ${worldview} --warning=no-unknown-keyword --strip-components=1 --touch`;
result = await ssh.execCommand(cmd);
- // Set permissions for Grou and Other for Read and Execute for images, config metadata, and brand
- cmd = `chmod -R go+xr ${root}/${name}/config
+ // Set permissions for Group and Other to Read and Execute for images, config metadata, and brand dirs
+ cmd = `chmod -R go+xr ${root}/${name}/config
&& chmod -R go+xr ${root}/${name}/images
&& chmod -R go+xr ${root}/${name}/brand`;
+ result = await ssh.execCommand(cmd);
process.stdout.write(result.stdout);
process.stderr.write(result.stderr);
ssh.dispose();
diff --git a/web/css/layers.css b/web/css/layers.css
index fbede2927..d865aaaf6 100644
--- a/web/css/layers.css
+++ b/web/css/layers.css
@@ -40,6 +40,7 @@
overflow: auto;
position: relative;
padding: 5px 0;
+ min-height: 300px;
}
.stamp {
@@ -190,13 +191,14 @@
}
&.selected {
transition: background-color 300ms linear;
- background: #2a2a2a;
- border-left: 5px solid #d54f21;
+ background: #222;
+ border-left: 8px solid #d54f21;
&:hover {
box-shadow: none;
}
& .layers-all-header > h3 {
color: #fff;
+ font-weight: 500;
}
& .layers-all-header > h5 {
color: #aaa;
@@ -783,10 +785,11 @@
.custom-layer-dialog {
background-color: #dcdcdc;
+ margin: 5px auto;
&.category-width {
width: 978px;
- max-width: 978px;
+ max-width: 95%;
& .modal-body {
padding: 0 0 0 11px;
}
@@ -826,6 +829,18 @@
}
}
+.layer-search {
+ & .dropdown {
+ margin-right: 10px;
+ }
+ & .dropdown-menu {
+ padding: 2px;
+ }
+ & .filter-button {
+ background-color: #d54e21;
+ }
+}
+
.layer-bread-crumb .breadcrumb {
margin-bottom: 0;
background-color: #fff;
@@ -882,7 +897,7 @@
}
}
-.no-results {
+.no-selection {
margin-top: 50px;
& h3 {
font-size: 20px;
@@ -899,19 +914,20 @@
}
.results-text {
- text-align: right;
- font-size: 16px;
- margin: 10px 15px;
+ text-align: left;
+ font-size: 14px;
+ padding: 5px 10px;
+ background: #ddd;
+ margin-bottom: 5px;
+ margin-top: -10px;
}
.layer-filters-container {
- width: 20%;
- float: left;
& .filter-controls {
- min-height: 150px;
+ min-height: 110px;
+ min-width: 230px;
background-color: #333;
- margin: 0 5px;
color: #eee;
padding: 10px 8px 15px;
& h3 {
@@ -938,26 +954,34 @@
.layer-list-container {
float: left;
+ padding: 0 2px 0 5px;
+
&.search {
- width: 40%;
+ width: 50%;
&.mobile {
width: 100%;
}
}
&.browse {
width: 50%;
- padding-left: 5px;
&.mobile {
width: 100%;
}
}
}
-
-h3.no-results {
- font-weight: 500;
- font-size: 20px;
- margin: 20px auto;
+.no-results {
text-align: center;
+ margin-top: 40px;
+ & .fas {
+ color: #777;
+ }
+ & h3 {
+ font-weight: 500;
+ font-size: 20px;
+ margin: 40px auto 0;
+ text-align: center;
+ color: #777;
+ }
}
.layer-detail-container {
@@ -966,7 +990,13 @@ h3.no-results {
padding-right: 2px;
&.search {
- width: 40%;
+ width: 50%;
+ &.mobile {
+ width: 100%;
+ margin-top: 10px;
+ min-height: 200px;
+ padding-left: 2px;
+ }
}
&.browse {
width: 50%;
diff --git a/web/js/components/layer/product-picker/header.js b/web/js/components/layer/product-picker/header.js
index 38ae829d7..1209a1d95 100644
--- a/web/js/components/layer/product-picker/header.js
+++ b/web/js/components/layer/product-picker/header.js
@@ -5,8 +5,12 @@ import {
Input,
Button,
Breadcrumb,
- BreadcrumbItem
+ BreadcrumbItem,
+ UncontrolledDropdown,
+ DropdownToggle,
+ DropdownMenu
} from 'reactstrap';
+import LayerFilters from './layer-filters';
import util from '../../../util/util';
@@ -46,50 +50,66 @@ class ProductPickerHeader extends React.Component {
render() {
const isAutoFocus = !util.browser.touchDevice;
- const { selectedProjection, listType, category, width } = this.props;
+ const {
+ selectedProjection,
+ selectedDate,
+ listType,
+ category,
+ width,
+ toggleFilterByAvailable,
+ filterByAvailable
+ } = this.props;
const categoryId = category && category.id;
const isBreadCrumb = categoryId !== 'featured-all' &&
selectedProjection === 'geographic' &&
listType !== 'category' &&
width > 650;
const isSearching = listType === 'search';
- const BackButton = (
- <Button
- className="back-button"
- color="secondary"
- onClick={this.revertToInitialScreen.bind(this)}
- >
- <i className="fa fa-arrow-left" />{' '}
- </Button>
- );
+
return (
<InputGroup id="layer-search" className="layer-search">
- {isBreadCrumb ? (
- <React.Fragment>
- {BackButton}
- <Breadcrumb tag="nav" className="layer-bread-crumb">
- <BreadcrumbItem
- tag="a"
- title="Back to Layer Categories"
- href="#"
- onClick={this.revertToInitialScreen.bind(this)}
- >
- Categories
- </BreadcrumbItem>
- <BreadcrumbItem active tag="span">
- {listType === 'search'
- ? 'Search Results'
- : category
- ? category.title
- : ''}
- </BreadcrumbItem>
- </Breadcrumb>
- </React.Fragment>
- ) : isSearching ? (
- <React.Fragment>{BackButton}</React.Fragment>
- ) : (
- ''
- )}
+ <Button
+ className="back-button"
+ color="secondary"
+ onClick={this.revertToInitialScreen.bind(this)}
+ >
+ <i className="fa fa-arrow-left" />{' '}
+ </Button>
+
+ {isBreadCrumb &&
+ <Breadcrumb tag="nav" className="layer-bread-crumb">
+ <BreadcrumbItem
+ tag="a"
+ title="Back to Layer Categories"
+ href="#"
+ onClick={this.revertToInitialScreen.bind(this)}
+ >
+ Categories
+ </BreadcrumbItem>
+ <BreadcrumbItem active tag="span">
+ {listType === 'search'
+ ? 'Search Results'
+ : category
+ ? category.title
+ : ''}
+ </BreadcrumbItem>
+ </Breadcrumb>
+ }
+
+ {isSearching &&
+ <UncontrolledDropdown>
+ <DropdownToggle className="filter-button" caret>
+ <i className="fas fa-filter"></i>
+ </DropdownToggle>
+ <DropdownMenu>
+ <LayerFilters
+ selectedDate={selectedDate}
+ filterByAvailable={filterByAvailable}
+ toggleFilterByAvailable={toggleFilterByAvailable}
+ />
+ </DropdownMenu>
+ </UncontrolledDropdown>
+ }
<Input
onChange={this.handleChange.bind(this)}
diff --git a/web/js/components/layer/product-picker/layer-filters.js b/web/js/components/layer/product-picker/layer-filters.js
index 34bc84abc..70f518763 100644
--- a/web/js/components/layer/product-picker/layer-filters.js
+++ b/web/js/components/layer/product-picker/layer-filters.js
@@ -26,7 +26,6 @@ class ProductPickerHeader extends React.Component {
const { tooltipFilterAvailableOpen } = this.state;
const {
selectedDate,
- numResults,
filterByAvailable,
toggleFilterByAvailable
} = this.props;
@@ -60,9 +59,6 @@ class ProductPickerHeader extends React.Component {
</div>
</Form>
</div>
- <div className="results-text">
- Showing {numResults} results
- </div>
</div>
);
}
diff --git a/web/js/components/layer/product-picker/layer-list.js b/web/js/components/layer/product-picker/layer-list.js
index 521bde086..a14bac641 100644
--- a/web/js/components/layer/product-picker/layer-list.js
+++ b/web/js/components/layer/product-picker/layer-list.js
@@ -20,7 +20,7 @@ class LayerList extends React.Component {
/**
* Loads metadata for layer (if not previously loaded) and
- * triggers showing in layer dietal area
+ * triggers showing in layer detail area
*
* @param {string} layerId - the layer id to show metadata for
* @return {void}
@@ -115,9 +115,7 @@ class LayerList extends React.Component {
const { selectedLayerId } = this.state;
const { addLayer, removeLayer, activeLayers } = this.props;
- return filteredRows.length < 1 ? (
- <h3 className="no-results"> No results found. </h3>
- ) : (
+ return (
filteredRows.map(layer => {
const isEnabled = activeLayers.some(l => l.id === layer.id);
const isMetadataShowing = layer.id === selectedLayerId;
diff --git a/web/js/components/layer/product-picker/measurement-metadata-detail.js b/web/js/components/layer/product-picker/measurement-metadata-detail.js
index f790905e2..bc569c28c 100644
--- a/web/js/components/layer/product-picker/measurement-metadata-detail.js
+++ b/web/js/components/layer/product-picker/measurement-metadata-detail.js
@@ -1,5 +1,4 @@
import React from 'react';
-import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import util from '../../../util/util.js';
import Scrollbars from '../../util/scrollbar';
@@ -35,85 +34,81 @@ class MeasurementMetadataDetail extends React.Component {
}
}
- renderMobile() {
- const { source } = this.props;
- const { isMetadataExpanded, sourceMetaData } = this.state;
- const description = source && source.description;
+ renderMobile(data) {
+ const { isMetadataExpanded } = this.state;
+ const doesMetaDataNeedExpander = data.length >= 1000;
+ const isMetaVisible = isMetadataExpanded || !doesMetaDataNeedExpander;
+ return (
+ <div>
+ <div
+ className={ isMetaVisible ? 'source-metadata ' : 'source-metadata overflow' }
+ dangerouslySetInnerHTML={{ __html: data }}
+ />
+ {doesMetaDataNeedExpander && (
+ <div
+ className="metadata-more"
+ onClick={() => this.toggleMetadataExpansion()}
+ >
+ <span className={isMetadataExpanded ? 'ellipsis up' : 'ellipsis'}>
+ {isMetadataExpanded ? '^' : '...'}
+ </span>
+ </div>
+ )}
+ </div>
+ );
+ }
- if (description) {
- if (sourceMetaData[description]) {
- const { data } = sourceMetaData[description];
- const doesMetaDataNeedExpander = data.length >= 1000;
- const isMetaVisible = isMetadataExpanded || !doesMetaDataNeedExpander;
- return (
- <div>
- <div
- className={ isMetaVisible ? 'source-metadata ' : 'source-metadata overflow' }
- dangerouslySetInnerHTML={{ __html: data }}
- />
- {doesMetaDataNeedExpander && (
- <div
- className="metadata-more"
- onClick={() => this.toggleMetadataExpansion()}
- >
- <span className={isMetadataExpanded ? 'ellipsis up' : 'ellipsis'}>
- {isMetadataExpanded ? '^' : '...'}
- </span>
- </div>
- )}
+ renderDesktop(data) {
+ const { height, source } = this.props;
+ const { title } = source;
+
+ return (
+ <Scrollbars style={{ maxHeight: height + 'px' }}>
+ <div className="layers-all-layer">
+ <div className="layers-all-header">
+ <h3>{title}</h3>
</div>
- );
- } else {
- this.getSourceMetadata(source);
- return (
- <div className="no-results">
- <h5>Loading metadata ... </h5>
+ <div className="source-metadata">
+ <div dangerouslySetInnerHTML={{ __html: data }} />
</div>
- );
- }
- }
+ </div>
+ </Scrollbars>
+ );
}
- renderDesktop() {
- const { source, height, categoryTitle } = this.props;
+ render() {
+ const { isMobile, source, categoryTitle } = this.props;
const { sourceMetaData } = this.state;
- if (!source) {
+
+ if (!isMobile && !source) {
return (
- <div className="no-results">
+ <div className="no-selection">
<h3> {categoryTitle} </h3>
<h5> (Select a measurement) </h5>
</div>
);
}
- const { description, title } = source;
- if (sourceMetaData[description]) {
- const { data } = sourceMetaData[description];
+ const description = source && source.description;
+ if (!description) {
return (
- <Scrollbars style={{ maxHeight: height + 'px' }}>
- <div className="layers-all-layer">
- <div className="layers-all-header">
- <h3>{title}</h3>
- </div>
- <div className="source-metadata">
- <div dangerouslySetInnerHTML={{ __html: data }} />
- </div>
- </div>
- </Scrollbars>
+ <div className="no-selection">
+ <h5>No metadata found</h5>
+ </div>
);
- } else {
+ }
+
+ const data = sourceMetaData[description] && sourceMetaData[description].data;
+ if (!data) {
this.getSourceMetadata(source);
return (
- <div className="no-results">
+ <div className="no-selection">
<h5>Loading metadata ... </h5>
</div>
);
}
- }
- render() {
- const { isMobile } = this.props;
- return (isMobile ? this.renderMobile() : this.renderDesktop());
+ return (isMobile ? this.renderMobile(data) : this.renderDesktop(data));
}
}
diff --git a/web/js/components/layer/product-picker/product-picker.js b/web/js/components/layer/product-picker/product-picker.js
index 344785a8e..ae539b544 100644
--- a/web/js/components/layer/product-picker/product-picker.js
+++ b/web/js/components/layer/product-picker/product-picker.js
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import LayerList from './layer-list';
import CategoryGrid from './category-grid';
import ProductPickerHeader from './header';
-import LayerFilters from './layer-filters';
+
import {
toLower as lodashToLower,
values as lodashValues,
@@ -52,7 +52,6 @@ class ProductPicker extends React.Component {
filteredRows: props.filteredRows,
inputValue: '',
filterByAvailable: true,
- tooltipFilterAvailableOpen: false,
modalElement: null
};
this.runSearch = lodashDebounce(this.runSearch, 300);
@@ -262,8 +261,7 @@ class ProductPicker extends React.Component {
categoryType,
category,
selectedMeasurement,
- selectedLayer,
- filterByAvailable
+ selectedLayer
} = this.state;
const {
isMobile,
@@ -276,32 +274,35 @@ class ProductPicker extends React.Component {
removeLayer,
addLayer,
hasMeasurementSetting,
- layerConfig,
- height
+ height,
+ layerConfig
} = this.props;
- const listContainerClass = listType === 'search'
- ? isMobile ? 'layer-list-container search mobile' : 'layer-list-container search'
- : isMobile ? 'layer-list-container browse mobile' : 'layer-list-container browse';
- const detailContainerClass = listType === 'search'
- ? 'layer-detail-container layers-all search'
- : 'layer-detail-container layers-all browse';
-
+ const isSearching = listType === 'search';
const currentMeasureSource = this.getCurrentMeasureSource();
+ const listHeight = isMobile && isSearching ? height / 2 : height;
+ const listContainerClass = isSearching
+ ? isMobile
+ ? 'layer-list-container search mobile'
+ : 'layer-list-container search'
+ : isMobile
+ ? 'layer-list-container browse mobile'
+ : 'layer-list-container browse';
+ const detailContainerClass = isSearching
+ ? isMobile
+ ? 'layer-detail-container layers-all search mobile'
+ : 'layer-detail-container layers-all search'
+ : 'layer-detail-container layers-all browse';
- return (
+ return filteredRows.length ? (
<>
- {listType === 'search' &&
- <LayerFilters
- selectedDate={selectedDate}
- numResults={filteredRows.length}
- filterByAvailable={filterByAvailable}
- toggleFilterByAvailable={this.toggleFilterByAvailable.bind(this)}
- />
+ { isSearching &&
+ <div className="results-text">
+ Showing {filteredRows.length} layers
+ </div>
}
-
<div className={listContainerClass}>
- <Scrollbars style={{ maxHeight: height + 'px' }}>
+ <Scrollbars style={{ maxHeight: listHeight + 'px' }}>
<div className="product-outter-list-case">
<LayerList
isMobile={isMobile}
@@ -328,21 +329,26 @@ class ProductPicker extends React.Component {
</Scrollbars>
</div>
- {!isMobile && <div className={detailContainerClass}>
- {listType === 'search' ? (
+ <div className={detailContainerClass}>
+ {isSearching ? (
<LayerMetadataDetail
layer={selectedLayer}
- height={height}>
+ height={listHeight}>
</LayerMetadataDetail>
- ) : (
+ ) : !isMobile && (
<MeasurementMetadataDetail
categoryTitle={category.title}
source={currentMeasureSource}
height={height}>
</MeasurementMetadataDetail>
)}
- </div>}
+ </div>
</>
+ ) : (
+ <div className="no-results">
+ <i className="fas fa-5x fa-meteor"></i>
+ <h3> No matching layers found! </h3>
+ </div>
);
}
@@ -351,7 +357,8 @@ class ProductPicker extends React.Component {
listType,
categoryType,
category,
- inputValue
+ inputValue,
+ filterByAvailable
} = this.state;
const {
selectedProjection,
@@ -362,7 +369,8 @@ class ProductPicker extends React.Component {
onToggle,
categoryConfig,
measurementConfig,
- hasMeasurementSource
+ hasMeasurementSource,
+ selectedDate
} = this.props;
const isCategoryDisplay = listType === 'category' && selectedProjection === 'geographic';
const showCategoryTabs = isCategoryDisplay || categoryType === 'featured';
@@ -377,6 +385,8 @@ class ProductPicker extends React.Component {
<ModalHeader toggle={onToggle}>
<ProductPickerHeader
selectedProjection={selectedProjection}
+ selectedDate={selectedDate}
+ filterByAvailable={filterByAvailable}
listType={listType}
inputValue={inputValue}
isMobile={isMobile}
@@ -385,6 +395,7 @@ class ProductPicker extends React.Component {
width={width}
runSearch={this.runSearch.bind(this)}
updateListState={this.revertSearchState.bind(this)}
+ toggleFilterByAvailable={this.toggleFilterByAvailable.bind(this)}
/>
</ModalHeader>
@@ -406,7 +417,7 @@ class ProductPicker extends React.Component {
</NavItem>
))}
</Nav>
- <Scrollbars style={{ maxHeight: height + 'px' }}>
+ <Scrollbars style={{ maxHeight: (height - 80) + 'px' }}>
<div>
{isCategoryDisplay ? (
<CategoryGrid
@@ -485,8 +496,9 @@ const mapDispatchToProps = dispatch => ({
function mapStateToProps(state, ownProps) {
const { config, browser, proj, layers, compare, date } = state;
const { screenWidth, screenHeight } = browser;
+ const isMobile = browser.lessThan.medium;
const activeString = compare.isCompareA ? 'active' : 'activeB';
- const height = screenHeight - 140;
+ const height = screenHeight - (isMobile ? 100 : 140);
const width = getModalWidth(screenWidth);
const allLayers = getLayersForProjection(config, proj.id);
const activeLayers = layers[activeString];
@@ -496,13 +508,13 @@ function mapStateToProps(state, ownProps) {
measurementConfig: config.measurements,
layerConfig: config.layers,
selectedDate: date.selected,
+ isMobile,
height,
width,
allLayers,
filteredRows: allLayers,
activeLayers,
selectedProjection: proj.id,
- isMobile: browser.lessThan.medium,
filterProjections: layer => {
return !layer.projections[proj.id];
},