From f16b9dff92bf9f89c8e19ba9b04a87998c5eb4a2 Mon Sep 17 00:00:00 2001 From: Wing Ho Date: Wed, 29 May 2019 18:34:11 +1000 Subject: [PATCH 01/28] wip catalog routing --- lib/ReactViews/DataCatalog/CatalogItem.jsx | 8 +- .../DataCatalog/DataCatalogItem.jsx | 11 +- .../DataCatalog/data-catalog-item.scss | 24 +- .../ExplorerWindow/Tabs/DataCatalogTab.jsx | 15 +- lib/ReactViews/SidePanel/SidePanel.jsx | 7 +- .../StandardUserInterface.jsx | 319 ++++++++++-------- package.json | 1 + 7 files changed, 218 insertions(+), 167 deletions(-) diff --git a/lib/ReactViews/DataCatalog/CatalogItem.jsx b/lib/ReactViews/DataCatalog/CatalogItem.jsx index b9ab9b2994c..8d500640220 100644 --- a/lib/ReactViews/DataCatalog/CatalogItem.jsx +++ b/lib/ReactViews/DataCatalog/CatalogItem.jsx @@ -2,7 +2,7 @@ import React from "react"; import PropTypes from "prop-types"; import classNames from "classnames"; import Icon from "../Icon.jsx"; - +import { Link } from "react-router-dom"; import defaultValue from "terriajs-cesium/Source/Core/defaultValue"; import Styles from "./data-catalog-item.scss"; @@ -28,7 +28,8 @@ function CatalogItem(props) { const stateToTitle = defaultValue(props.titleOverrides, STATE_TO_TITLE); return (
  • - + + + +
  • From 66084efbedc0e50cfca6d795dc22af3e46c20e5a Mon Sep 17 00:00:00 2001 From: Wing Ho Date: Thu, 8 Aug 2019 17:10:11 +1000 Subject: [PATCH 17/28] Fix group-selected-state & open on first load --- .../DataCatalog/DataCatalogGroup.jsx | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/ReactViews/DataCatalog/DataCatalogGroup.jsx b/lib/ReactViews/DataCatalog/DataCatalogGroup.jsx index 5bc11d0035c..e422cf91d8b 100644 --- a/lib/ReactViews/DataCatalog/DataCatalogGroup.jsx +++ b/lib/ReactViews/DataCatalog/DataCatalogGroup.jsx @@ -1,6 +1,7 @@ import React from "react"; import createReactClass from "create-react-class"; import PropTypes from "prop-types"; +import { withRouter } from "react-router-dom"; import URI from "urijs"; import addedByUser from "../../Core/addedByUser"; import removeUserAddedData from "../../Models/removeUserAddedData"; @@ -16,6 +17,7 @@ const DataCatalogGroup = createReactClass({ propTypes: { group: PropTypes.object.isRequired, viewState: PropTypes.object.isRequired, + match: PropTypes.object.isRequired, /** Overrides whether to get the open state of the group from the group model or manage it internally */ manageIsOpenLocally: PropTypes.bool, userData: PropTypes.bool, @@ -37,6 +39,16 @@ const DataCatalogGroup = createReactClass({ }; }, + componentDidMount() { + const group = this.props.group; + if (!group.isOpen) { + if (this.isSelected() && group.toggleOpen) { + // Toggle open when we initially navigate to a group + group.isOpen = true; + } + } + }, + toggleStateIsOpen() { this.setState({ isOpen: !this.state.isOpen @@ -68,9 +80,14 @@ const DataCatalogGroup = createReactClass({ }, isSelected() { - return addedByUser(this.props.group) - ? this.props.viewState.userDataPreviewedItem === this.props.group - : this.props.viewState.previewedItem === this.props.group; + const match = this.props.match || {}; + const { params } = match; + return ( + (addedByUser(this.props.group) + ? this.props.viewState.userDataPreviewedItem === this.props.group + : this.props.viewState.previewedItem === this.props.group) || + URI.decode(params.catalogMemberId) === this.props.group.uniqueId + ); }, getNameOrPrettyUrl() { @@ -125,4 +142,4 @@ const DataCatalogGroup = createReactClass({ } }); -module.exports = DataCatalogGroup; +module.exports = withRouter(DataCatalogGroup); From da13136cf2f1620c9852ffab0acd0d9a624845ba Mon Sep 17 00:00:00 2001 From: Wing Ho Date: Thu, 8 Aug 2019 17:26:47 +1000 Subject: [PATCH 18/28] Fix tabs not updating when navigating --- lib/ReactViewModels/ViewState.js | 22 +++++++++++++++++++ lib/ReactViews/DragDropFile.jsx | 10 ++++++++- .../ExplorerWindow/ExplorerWindow.jsx | 2 ++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/ReactViewModels/ViewState.js b/lib/ReactViewModels/ViewState.js index ebe48f0e061..dfe904023b1 100644 --- a/lib/ReactViewModels/ViewState.js +++ b/lib/ReactViewModels/ViewState.js @@ -6,6 +6,7 @@ import addedByUser from "../Core/addedByUser"; import knockout from "terriajs-cesium/Source/ThirdParty/knockout"; import MouseCoords from "./MouseCoords"; import SearchState from "./SearchState"; +import URI from "urijs"; export const DATA_CATALOG_NAME = "data-catalog"; export const USER_DATA_NAME = "my-data"; @@ -46,6 +47,7 @@ export default class ViewState { this.mobileView = null; this.isMapFullScreen = false; this.myDataIsUploadView = true; + this.matchFromExplorer = {}; this.history = {}; /** @@ -110,6 +112,7 @@ export default class ViewState { this._explorerPanelIsVisible = false; knockout.track(this, [ + "matchFromExplorer", "previewedItem", "catalogSearch", "_explorerPanelIsVisible", @@ -267,6 +270,24 @@ export default class ViewState { this._disclaimerHandler = new DisclaimerHandler(terria, this); + this._matchFromExplorerSubscription = knockout + .getObservable(this, "matchFromExplorer") + .subscribe(matchFromExplorer => { + if ( + matchFromExplorer && + matchFromExplorer.params && + matchFromExplorer.params.catalogMemberId + ) { + // viewCatalogMember handles which tab to activate + const idToFind = URI.decode(matchFromExplorer.params.catalogMemberId); + const catalogMember = terria.catalog.shareKeyIndex[idToFind]; + + if (defined(catalogMember)) { + this.viewCatalogMember(catalogMember); + } + } + }); + this._storyPromptHandler = knockout .getObservable(this, "storyShown") .subscribe(storyShown => { @@ -280,6 +301,7 @@ export default class ViewState { } dispose() { + this._matchFromExplorerSubscription.dispose(); this._sharedFromExplorerPanelSubscription.dispose(); this._previewedItemIdSubscription.dispose(); this._pickedFeaturesSubscription.dispose(); diff --git a/lib/ReactViews/DragDropFile.jsx b/lib/ReactViews/DragDropFile.jsx index a6c48265d27..5ff4b2d707b 100644 --- a/lib/ReactViews/DragDropFile.jsx +++ b/lib/ReactViews/DragDropFile.jsx @@ -2,9 +2,12 @@ import React from "react"; import createReactClass from "create-react-class"; import PropTypes from "prop-types"; import classNames from "classnames"; +import { withRouter } from "react-router-dom"; +import URI from "urijs"; import ObserveModelMixin from "./ObserveModelMixin"; import addUserFiles from "../Models/addUserFiles"; +import { CATALOG_ROUTE } from "../ReactViewModels/TerriaRouting.js"; import Styles from "./drag-drop-file.scss"; @@ -14,6 +17,7 @@ const DragDropFile = createReactClass({ propTypes: { terria: PropTypes.object, + history: PropTypes.object, viewState: PropTypes.object }, @@ -34,6 +38,10 @@ const DragDropFile = createReactClass({ if (this.props.viewState.explorerPanelIsVisible) { this.props.viewState.viewCatalogMember(addedCatalogItems[0]); this.props.viewState.openUserData(); + const pathToPush = `${CATALOG_ROUTE}${URI.encode( + addedCatalogItems[0].uniqueId + )}`; + this.props.history.push(pathToPush); } else { this.notifyUpload(addedCatalogItems); } @@ -100,4 +108,4 @@ const DragDropFile = createReactClass({ } }); -module.exports = DragDropFile; +module.exports = withRouter(DragDropFile); diff --git a/lib/ReactViews/ExplorerWindow/ExplorerWindow.jsx b/lib/ReactViews/ExplorerWindow/ExplorerWindow.jsx index f5d7fc09367..0ca6311ef1d 100644 --- a/lib/ReactViews/ExplorerWindow/ExplorerWindow.jsx +++ b/lib/ReactViews/ExplorerWindow/ExplorerWindow.jsx @@ -38,6 +38,7 @@ const ExplorerWindow = createReactClass({ /* eslint-disable-next-line camelcase */ UNSAFE_componentWillMount() { + this.props.viewState.matchFromExplorer = this.props.match; this.props.viewState.explorerPanelAnimating = true; const props = this.props; if ( @@ -64,6 +65,7 @@ const ExplorerWindow = createReactClass({ }, componentDidUpdate() { + this.props.viewState.matchFromExplorer = this.props.match; if (this.isVisible() && !this.state.visible) { this.onVisibilityChange(true); } From 8435d8a2a7ea089971c129b4449f0b9ff478a225 Mon Sep 17 00:00:00 2001 From: Wing Ho Date: Thu, 8 Aug 2019 19:12:39 +1000 Subject: [PATCH 19/28] Fix incorrect "About This Data" open-close flow Visibility was not toggled correctly when waiting for animation to finish --- lib/ReactViewModels/ViewState.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ReactViewModels/ViewState.js b/lib/ReactViewModels/ViewState.js index dfe904023b1..1e1eec32ee5 100644 --- a/lib/ReactViewModels/ViewState.js +++ b/lib/ReactViewModels/ViewState.js @@ -148,6 +148,7 @@ export default class ViewState { if (!bool && this.location && this.location.pathname !== "/") { setTimeout(() => { this.history.push("/"); + this._explorerPanelIsVisible = false; }, 300); } this._explorerPanelIsVisible = bool; From 533e6da05104331afe946082eddf6725a7a0a6c7 Mon Sep 17 00:00:00 2001 From: Wing Ho Date: Mon, 2 Dec 2019 16:33:51 +1100 Subject: [PATCH 20/28] Merge remote-tracking branch 'origin/master' into 1757-new-routing # Conflicts: # lib/ReactViewModels/ViewState.js # lib/ReactViews/DataCatalog/CatalogItem.jsx # lib/ReactViews/SidePanel/SidePanel.jsx # lib/ReactViews/StandardUserInterface/StandardUserInterface.jsx # package.json # test/ReactViews/StandardUserInterfaceSpec.jsx --- CHANGES.md | 523 +++++- README.md | 1 + doc/acknowledgements/attributions.md | 1513 ++++++++++------- doc/customizing/client-side-config.md | 3 + lib/Charts/BaseChart.js | 4 + lib/Charts/ChartData.js | 13 + lib/Charts/ChartRenderer.js | 460 +++-- lib/Charts/LineChart.js | 27 +- lib/Charts/MomentChart.js | 50 +- lib/Charts/MomentChartPoints.js | 197 +++ lib/Charts/Scales.js | 20 +- lib/Charts/Title.js | 11 +- lib/Charts/Tooltip.js | 136 +- lib/Charts/initializeChartTypes.js | 24 +- lib/Core/ConsoleAnalytics.js | 4 +- lib/Core/CorsProxy.js | 7 +- lib/Core/DataUri.js | 5 +- lib/Core/GoogleAnalytics.js | 4 +- lib/Core/ServerConfig.js | 4 +- lib/Core/TerriaError.js | 2 +- lib/Core/arraysAreEqual.js | 2 +- lib/Core/closeWhenEscapeIsPressed.js | 2 +- lib/Core/combineFilters.js | 2 +- lib/Core/containsAny.js | 2 +- lib/Core/formatNumberForLocale.js | 4 +- lib/Core/hashEntity.js | 2 +- lib/Core/isCommonMobilePlatform.js | 2 +- lib/Core/loadArrayBuffer.js | 2 +- lib/Core/loadBlob.js | 2 +- lib/Core/loadJson.js | 2 +- lib/Core/loadJson5.js | 2 +- lib/Core/loadJsonp.js | 5 +- lib/Core/loadSdmxDataJson.js | 2 +- lib/Core/loadSdmxStructureJson.js | 2 +- lib/Core/loadText.js | 2 +- lib/Core/loadView.js | 4 +- lib/Core/loadWithXhr.js | 8 +- lib/Core/loadXML.js | 2 +- lib/Core/markdownToHtml.js | 2 +- lib/Core/overrideProperty.js | 4 +- lib/Core/pollToPromise.js | 6 +- lib/Core/printWindow.js | 2 +- lib/Core/propertyGetTimeValues.js | 2 +- lib/Core/readJson.js | 2 +- lib/Core/readText.js | 5 +- lib/Core/readXml.js | 4 +- lib/Core/rectangleToPolygonArray.js | 4 +- lib/Core/runLater.js | 4 +- lib/Core/serializeToJson.js | 2 +- lib/Core/supportsWebGL.js | 2 +- lib/Core/updateFromJson.js | 6 +- lib/Language/defaults.jsx | 61 + lib/Language/en/translation.json | 11 + lib/Map/AbsCode.js | 7 +- lib/Map/AbsConcept.js | 9 +- lib/Map/AddressGeocoder.js | 3 +- lib/Map/CesiumDragPoints.js | 11 +- lib/Map/CesiumSelectionIndicator.js | 18 +- lib/Map/CesiumTileLayer.js | 26 +- lib/Map/ColorMap.js | 4 +- lib/Map/Concept.js | 5 +- lib/Map/DisplayVariablesConcept.js | 6 +- lib/Map/DragPoints.js | 2 +- lib/Map/DrawExtentHelper.js | 25 +- lib/Map/EarthGravityModel1996.js | 6 +- lib/Map/GnafAddressGeocoder.js | 7 +- lib/Map/ImageryProviderHooks.js | 7 +- lib/Map/LeafletDataSourceDisplay.js | 28 +- lib/Map/LeafletDragPoints.js | 7 +- lib/Map/LeafletScene.js | 2 +- lib/Map/LeafletVisualizer.js | 99 +- lib/Map/Legend.js | 7 +- lib/Map/MapboxVectorCanvasTileLayer.js | 6 +- lib/Map/MapboxVectorTileImageryProvider.js | 28 +- lib/Map/PickedFeatures.js | 2 +- lib/Map/RegionProvider.js | 13 +- lib/Map/RegionProviderList.js | 5 +- lib/Map/Reproject.js | 4 +- lib/Map/SummaryConcept.js | 2 +- lib/Map/TableColumn.js | 17 +- lib/Map/TableStructure.js | 31 +- lib/Map/VariableConcept.js | 6 +- lib/Map/computeRingWindingOrder.js | 6 +- lib/Map/createCredit.js | 2 +- lib/Map/featureDataToGeoJson.js | 4 +- lib/Map/getUrlForImageryTile.js | 5 +- lib/Map/gmlToGeoJson.js | 4 +- lib/Map/rectangleToLatLngBounds.js | 2 +- lib/Map/unionRectangleArray.js | 4 +- lib/Map/unionRectangles.js | 7 +- lib/Map/zoomRectangleFromPoint.js | 4 +- lib/Models/AbsDataset.js | 2 +- lib/Models/AbsIttCatalogGroup.js | 14 +- lib/Models/AbsIttCatalogItem.js | 21 +- lib/Models/ArcGisCatalogGroup.js | 11 +- lib/Models/ArcGisFeatureServerCatalogGroup.js | 13 +- lib/Models/ArcGisFeatureServerCatalogItem.js | 175 +- lib/Models/ArcGisMapServerCatalogGroup.js | 13 +- lib/Models/ArcGisMapServerCatalogItem.js | 29 +- lib/Models/BingMapsCatalogItem.js | 13 +- lib/Models/BooleanParameter.js | 3 +- lib/Models/BooleanParameterGroup.js | 3 +- lib/Models/CameraView.js | 32 +- lib/Models/CartoMapCatalogItem.js | 12 +- lib/Models/Catalog.js | 14 +- lib/Models/CatalogFunction.js | 16 +- lib/Models/CatalogGroup.js | 22 +- lib/Models/CatalogItem.js | 42 +- lib/Models/CatalogMember.js | 29 +- lib/Models/Cesium.js | 97 +- lib/Models/Cesium3DTilesCatalogItem.js | 47 +- lib/Models/CesiumTerrainCatalogItem.js | 10 +- lib/Models/CkanCatalogGroup.js | 15 +- lib/Models/CkanCatalogItem.js | 13 +- lib/Models/Clock.js | 6 +- lib/Models/CompositeCatalogItem.js | 17 +- lib/Models/CsvCatalogItem.js | 18 +- lib/Models/CswCatalogGroup.js | 17 +- lib/Models/CzmlCatalogItem.js | 12 +- lib/Models/DataSourceCatalogItem.js | 10 +- lib/Models/DateTimeParameter.js | 3 +- lib/Models/EnumerationParameter.js | 9 +- lib/Models/Feature.js | 4 +- lib/Models/FunctionParameter.js | 12 +- lib/Models/GeoJsonCatalogItem.js | 60 +- lib/Models/GeoJsonParameter.js | 5 +- lib/Models/GlobeOrMap.js | 13 +- lib/Models/GltfCatalogItem.js | 26 +- lib/Models/GnafApi.js | 8 +- lib/Models/GoogleUrlShortener.js | 12 +- lib/Models/GpxCatalogItem.js | 9 +- lib/Models/ImageryLayerCatalogItem.js | 207 ++- lib/Models/ImageryLayerFeatureInfo.js | 5 +- lib/Models/ImageryLayerPreloadHelpers.js | 2 +- lib/Models/IonImageryCatalogItem.js | 6 +- lib/Models/KmlCatalogItem.js | 20 +- lib/Models/Leaflet.js | 63 +- lib/Models/LegendHelper.js | 8 +- lib/Models/LineParameter.js | 7 +- lib/Models/MagdaCatalogItem.js | 13 +- lib/Models/MapInteractionMode.js | 4 +- lib/Models/MapboxMapCatalogItem.js | 11 +- lib/Models/MapboxVectorTileCatalogItem.js | 12 +- lib/Models/Metadata.js | 2 +- lib/Models/MetadataItem.js | 5 +- lib/Models/NoViewer.js | 4 +- lib/Models/NowViewing.js | 16 +- lib/Models/OgrCatalogItem.js | 11 +- lib/Models/OpenStreetMapCatalogItem.js | 13 +- lib/Models/PlacesLikeMeCatalogFunction.js | 7 +- lib/Models/PointParameter.js | 9 +- lib/Models/PolygonParameter.js | 7 +- lib/Models/RectangleParameter.js | 11 +- lib/Models/RegionDataParameter.js | 12 +- lib/Models/RegionMapping.js | 43 +- lib/Models/RegionParameter.js | 8 +- lib/Models/RegionTypeParameter.js | 7 +- lib/Models/ResultPendingCatalogItem.js | 5 +- lib/Models/SdmxJsonCatalogItem.js | 18 +- lib/Models/SelectAPolygonParameter.js | 5 +- .../SensorObservationServiceCatalogItem.js | 24 +- ...ensorObservationServiceRequestTemplate.xml | 52 +- lib/Models/ShareDataService.js | 10 +- lib/Models/ShortReportSection.js | 4 +- lib/Models/SocrataCatalogGroup.js | 17 +- lib/Models/SpatialDetailingCatalogFunction.js | 5 +- lib/Models/StringParameter.js | 3 +- lib/Models/TableCatalogItem.js | 26 +- lib/Models/TableColumnStyle.js | 6 +- lib/Models/TableDataSource.js | 59 +- lib/Models/TableStyle.js | 10 +- lib/Models/TerrainCatalogItem.js | 8 +- lib/Models/Terria.js | 90 +- lib/Models/TerriaJsonCatalogFunction.js | 15 +- lib/Models/TimeSeriesStack.js | 4 +- lib/Models/UrlTemplateCatalogItem.js | 8 +- lib/Models/UserDrawing.js | 29 +- lib/Models/WebFeatureServiceCatalogGroup.js | 13 +- lib/Models/WebFeatureServiceCatalogItem.js | 15 +- lib/Models/WebMapServiceCapabilities.js | 2 +- lib/Models/WebMapServiceCatalogGroup.js | 11 +- lib/Models/WebMapServiceCatalogItem.js | 50 +- lib/Models/WebMapTileServiceCatalogGroup.js | 11 +- lib/Models/WebMapTileServiceCatalogItem.js | 29 +- .../WebProcessingServiceCatalogFunction.js | 13 +- .../WebProcessingServiceCatalogGroup.js | 11 +- lib/Models/WebProcessingServiceCatalogItem.js | 11 +- lib/Models/WfsFeaturesCatalogGroup.js | 11 +- lib/Models/WhyAmISpecialCatalogFunction.js | 7 +- lib/Models/addUserCatalogMember.js | 6 +- lib/Models/calculateImageryLayerIntervals.js | 6 +- lib/Models/callWebCoverageService.js | 10 +- lib/Models/createCatalogItemFromFileOrUrl.js | 6 +- lib/Models/createCatalogMemberFromType.js | 2 +- lib/Models/createParameterFromType.js | 2 +- lib/Models/createRegexDeserializer.js | 2 +- lib/Models/createRegexSerializer.js | 2 +- lib/Models/extendLoad.js | 2 +- lib/Models/getAncestors.js | 2 +- lib/Models/getToken.js | 2 +- lib/Models/i18n.js | 35 + lib/Models/invokeTerriaAnalyticsService.js | 4 +- lib/Models/proxyCatalogItemUrl.js | 4 +- lib/Models/raiseErrorOnRejectedPromise.js | 5 +- lib/Models/registerCatalogMembers.js | 2 + lib/Models/sendFeedback.js | 7 +- lib/Models/setClockCurrentTime.js | 6 +- lib/Models/updateRectangleFromRegion.js | 2 +- lib/ReactViewModels/HelpScreen.js | 4 +- lib/ReactViewModels/HelpSequences.js | 2 +- lib/ReactViewModels/HelpViewState.js | 2 +- lib/ReactViewModels/ViewState.js | 75 +- lib/ReactViews/Custom/Chart/Chart.jsx | 25 +- .../Chart/ChartExpandAndDownloadButtons.jsx | 58 +- lib/ReactViews/Custom/Chart/chart.scss | 37 +- .../Custom/parseCustomHtmlToReact.js | 4 +- .../Custom/registerCustomComponentTypes.js | 26 +- lib/ReactViews/DataCatalog/CatalogGroup.jsx | 7 +- lib/ReactViews/DataCatalog/CatalogItem.jsx | 15 +- .../DataCatalog/DataCatalogItem.jsx | 21 +- .../DataCatalog/data-catalog-group.scss | 2 +- .../DataCatalog/data-catalog-item.scss | 7 + lib/ReactViews/Feedback/FeedbackButton.jsx | 5 +- lib/ReactViews/Generic/Dropdown.jsx | 5 +- lib/ReactViews/Generic/dropdown.scss | 5 + lib/ReactViews/Guidance/Guidance.jsx | 68 + lib/ReactViews/Guidance/GuidanceDot.jsx | 17 + lib/ReactViews/Guidance/guidance-dot.scss | 104 ++ lib/ReactViews/Guidance/guidance.scss | 46 + lib/ReactViews/Guide/Guide.jsx | 226 +++ lib/ReactViews/Guide/SatelliteGuide.jsx | 44 + lib/ReactViews/Guide/guide.scss | 127 ++ lib/ReactViews/Guide/satellite-guidance.js | 38 + .../HelpScreens/HelpMenuPanelBasic.jsx | 120 ++ lib/ReactViews/HelpScreens/help-panel.scss | 1 + lib/ReactViews/Hooks/useKeyPress.js | 41 + lib/ReactViews/Map/MenuBar.jsx | 34 + lib/ReactViews/Map/Navigation/Compass.jsx | 22 +- lib/ReactViews/Map/Navigation/MeasureTool.jsx | 38 +- lib/ReactViews/Map/Navigation/ZoomControl.jsx | 15 +- lib/ReactViews/Map/Panels/SettingPanel.jsx | 90 + lib/ReactViews/Map/Panels/setting-panel.scss | 32 + lib/ReactViews/Map/menu-bar.scss | 1 + lib/ReactViews/Mobile/MobileMenu.jsx | 10 + lib/ReactViews/Preview/DataPreviewMap.jsx | 11 +- lib/ReactViews/Preview/MappablePreview.jsx | 1 + .../getReactElementFromContents.js | 13 + .../SidePanel/EmptyWorkbenchMessage.jsx | 23 + lib/ReactViews/SidePanel/SidePanel.jsx | 27 +- .../StandardUserInterface/MapColumn.jsx | 8 +- .../StandardUserInterface.jsx | 35 +- lib/ReactViews/Transitions/FadeIn/FadeIn.jsx | 38 + .../Transitions/FadeIn/fade-in.scss | 14 + .../SlideUpFadeIn/SlideUpFadeIn.jsx | 38 + .../SlideUpFadeIn/slide-up-fade-in.scss | 18 + .../WelcomeMessage/WelcomeMessage.jsx | 197 +++ .../WelcomeMessage/welcome-message.scss | 127 ++ .../Controls/StyleSelectorSection.jsx | 2 + .../Controls/style-selector-section.scss | 22 + lib/Sass/global/_slider.scss | 11 +- lib/Styled/Spacing.jsx | 27 + lib/Styled/Text.jsx | 24 + lib/Styled/text.scss | 13 + lib/ViewModels/BaseMapViewModel.js | 2 +- .../BingMapsSearchProviderViewModel.js | 14 +- .../CatalogItemNameSearchProviderViewModel.js | 6 +- .../GazetteerSearchProviderViewModel.js | 4 +- lib/ViewModels/GnafSearchProviderViewModel.js | 4 +- .../NominatimSearchProviderViewModel.js | 14 +- lib/ViewModels/SearchProviderViewModel.js | 5 +- lib/ViewModels/SearchResultViewModel.js | 6 +- lib/ViewModels/TerriaViewer.js | 116 +- lib/ViewModels/createBingBaseMapOptions.js | 6 +- lib/ViewModels/selectBaseMap.js | 4 +- ...ateApplicationOnMessageFromParentWindow.js | 2 +- package.json | 12 +- test/Map/DragPointsSpec.js | 2 +- test/Map/EarthGravityModel1996Spec.js | 2 +- test/Map/TableColumnSpec.js | 2 +- test/Map/TableStructureSpec.js | 4 +- test/Map/unionRectanglesSpec.js | 2 +- test/Models/AbsIttCatalogItemSpec.js | 2 +- test/Models/CameraViewSpec.js | 13 +- test/Models/CatalogItemSpec.js | 7 +- test/Models/CatalogMemberSpec.js | 44 +- test/Models/CesiumSpec.js | 37 +- test/Models/CesiumTerrainCatalogItemSpec.js | 3 +- test/Models/CkanCatalogItemSpec.js | 2 +- test/Models/ClockSpec.js | 12 +- test/Models/CsvCatalogItemSpec.js | 12 +- test/Models/GnafApiSpec.js | 4 +- test/Models/ImageryLayerCatalogItemSpec.js | 26 +- test/Models/LeafletSpec.js | 18 +- test/Models/NowViewingSpec.js | 6 +- test/Models/SdmxJsonCatalogItemSpec.js | 4 +- ...SensorObservationServiceCatalogItemSpec.js | 6 +- test/Models/TerrainCatalogItemSpec.js | 2 +- test/Models/TerriaSpec.js | 28 + test/Models/UrlTemplateCatalogItemSpec.js | 3 +- test/Models/UserDrawingSpec.js | 14 +- test/Models/WebMapServiceCatalogGroupSpec.js | 6 +- test/Models/WebMapServiceCatalogItemSpec.js | 17 +- .../WebMapTileServiceCatalogItemSpec.js | 12 +- .../calculateImageryLayerIntervalsSpec.js | 4 +- test/Models/setClockCurrentTimeSpec.js | 5 +- .../DataCatalog/DataCatalogItemSpec.jsx | 25 +- test/ReactViews/MeasureToolSpec.jsx | 39 +- test/ReactViews/StandardUserInterfaceSpec.jsx | 17 +- test/ReactViews/TimelineSpec.jsx | 3 +- test/ReactViews/WelcomeMessageSpec.jsx | 36 + test/Utility/CustomMatchers.js | 2 +- test/Utility/loadAndStubTextResources.js | 2 +- test/ViewModels/GnafSearchProviderSpec.js | 4 +- wwwroot/data/regionMapping.json | 18 +- wwwroot/images/guides/satellite-feature.jpg | Bin 0 -> 68504 bytes wwwroot/images/guides/satellite-location.jpg | Bin 0 -> 37588 bytes wwwroot/images/guides/satellite-styles.jpg | Bin 0 -> 69806 bytes wwwroot/images/guides/satellite-time.jpg | Bin 0 -> 88796 bytes wwwroot/images/guides/satellite-zoom.jpg | Bin 0 -> 38568 bytes 319 files changed, 6253 insertions(+), 2104 deletions(-) create mode 100644 lib/Charts/MomentChartPoints.js create mode 100644 lib/Language/defaults.jsx create mode 100644 lib/Language/en/translation.json create mode 100644 lib/Models/i18n.js create mode 100644 lib/ReactViews/Guidance/Guidance.jsx create mode 100644 lib/ReactViews/Guidance/GuidanceDot.jsx create mode 100644 lib/ReactViews/Guidance/guidance-dot.scss create mode 100644 lib/ReactViews/Guidance/guidance.scss create mode 100644 lib/ReactViews/Guide/Guide.jsx create mode 100644 lib/ReactViews/Guide/SatelliteGuide.jsx create mode 100644 lib/ReactViews/Guide/guide.scss create mode 100644 lib/ReactViews/Guide/satellite-guidance.js create mode 100644 lib/ReactViews/HelpScreens/HelpMenuPanelBasic.jsx create mode 100644 lib/ReactViews/Hooks/useKeyPress.js create mode 100644 lib/ReactViews/ReactHelpers/getReactElementFromContents.js create mode 100644 lib/ReactViews/SidePanel/EmptyWorkbenchMessage.jsx create mode 100644 lib/ReactViews/Transitions/FadeIn/FadeIn.jsx create mode 100644 lib/ReactViews/Transitions/FadeIn/fade-in.scss create mode 100644 lib/ReactViews/Transitions/SlideUpFadeIn/SlideUpFadeIn.jsx create mode 100644 lib/ReactViews/Transitions/SlideUpFadeIn/slide-up-fade-in.scss create mode 100644 lib/ReactViews/WelcomeMessage/WelcomeMessage.jsx create mode 100644 lib/ReactViews/WelcomeMessage/welcome-message.scss create mode 100644 lib/Styled/Spacing.jsx create mode 100644 lib/Styled/Text.jsx create mode 100644 lib/Styled/text.scss create mode 100644 test/ReactViews/WelcomeMessageSpec.jsx create mode 100644 wwwroot/images/guides/satellite-feature.jpg create mode 100644 wwwroot/images/guides/satellite-location.jpg create mode 100644 wwwroot/images/guides/satellite-styles.jpg create mode 100644 wwwroot/images/guides/satellite-time.jpg create mode 100644 wwwroot/images/guides/satellite-zoom.jpg diff --git a/CHANGES.md b/CHANGES.md index a1919ca6297..2e55602a131 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,45 @@ Change Log ========== + +### Next release +* Fixed a bug where calling `openAddData()` or `closeCatalog()` on ViewState did not correctly apply the relevant `mobileViewOptions` for mobile views. +* Fixed filter by available dates on ImageryLayerCatalogItem not copying to the clone when the item is split. +* Fixed an error in `regionMapping.json` that causes some states to be mismatched when using Australian state codes in a column labelled "state". It is still recommended to use "ste", "ste_code" or "ste_code_2016" over "state" for column labels when matching against Australian state codes. +* Fixed bug where "User data" catalog did not have add-buttons. +* Added ability to re-add "User data" CSV items once removed from workbench. +* Added proper basic internationalisation beginnings via i18next & react-i18next +* Changed catalog item event labels to include the full catalog item path, rather than just the catalog item name. +* Welcome message, in-app guides & new feature prompts are now disabled by default. These can be re-enabled by setting the `showWelcomeMessage`, `showInAppGuides` & `showFeaturePrompts` options in config.json. +* Updated Welcome Message to pass its props to `WelcomeMessagePrimaryBtnClick` & `WelcomeMessageSecondaryBtnClick` overrides + +### v7.9.0 + +* Upgraded to Cesium v1.63.1. This upgrade may cause more problems than usual because Cesium has switched from AMD to ES6 modules. If you run into problems, please contact us: https://terria.io/contact + +### v7.8.0 + +* Added ability to do in-app, "static guides" through ``s +* Added in-app Guide for time enabled WMS items +* Initial implementation of language overrides to support setting custom text throughout the application. +* Added ability to pass `leafletUpdateInterval` to an `ImageryLayerCatalogItem` to throttle the number of requests made to a server. + +### v7.7.0 + +* Added a quality slider for the 3D map to the Map panel, allowing control of Cesium's maximumScreenSpaceError and resolutionScale properties. +* Allowed MapboxMapCatalogItems to be specified in catalog files using type `mapbox-map`. +* We now use styles derived from `drawingInfo` from Esri Feature Services. +* Chart related enhancements: + * Added momentPoints chart type to plot points along an available line chart. + * Added zooming and panning on the chart panel. + * Various preventative fixes to prevent chart crashes. +* Increased the tolerance for intermittent tile failures from time-varying raster layers. More failures will now be allowed before the layer is disabled. +* Sensor Observation Service `GetFeatureOfInterest` requests no longer erroneously include `temporalFilters`. Also improved the generated request XML to be more compliant with the specification. +* Fixed a bug where differences in available dates for `ImageryLayerCatalogItem` from original list of dates vs a new list of dates, would cause an error. +* Improved support for layers rendered across the anti-meridian in 2D (Leaflet). +* Fixed a crash when splitting a layer with a `momentPoints` chart item. +* Fixed a crash when the specified Web Map Service (WMS) layer could not be found in the `GetCapabilities` document and an alternate legend was not explicitly specified. + ### v7.6.11 * Added a workaround for a bug in Google Chrome v76 and v77 that caused problems with sizing of the bottom dock, such as cutting off the timeline and flickering on and off over the map. @@ -64,7 +103,7 @@ Change Log ### v7.6.0 * Added video intro to building a story -* Allow vector tiles for region mapping to return 404 for empty tiles. +* Allow vector tiles for region mapping to return 404 for empty tiles. ### v7.5.2 @@ -84,7 +123,7 @@ Change Log ### v7.4.1 * Remove dangling comma in `regionMapping.json`. -* `WebMapServicCatalogItem` now includes the current `style` in generated `GetLegendGraphic` URLs. +* `WebMapServicCatalogItem` now includes the current `style` in generated `GetLegendGraphic` URLs. ### v7.4.0 @@ -1038,4 +1077,482 @@ Change Log * Added support for the csv datetime formats: YYYY, YYYY-MM and YYYY-MM-DD HH:MM(:SS). * Improved formatting of datetimes from csv files in the feature info panel. * Removed variables consisting only of html tags from the Now Viewing panel. -* Improved +* Improved handling of rows with missing dates in csv time columns. +* Introduced four new json tableStyle parameters: + - `replaceWithZeroValues`: Defaults to `[null, '-']`. These values are coloured as if they were zero if they appear in a csv column with numbers. `null` catches missing values. These rows are ignored if they appear in a csv time column. + - `replaceWithNullValues`: Defaults to `['na', 'NA']`. These values are coloured as if they were null if they appear in a csv column with numbers. These rows are ignored if they appear in a csv time column. + - `nullColor`: A css string. Defaults to a dark blue. This colour is used to display null values (but it does not appear on the legend). It is also used to colour points when no variable is selected. + - `timeColumn`: Provide the name or index (starting at 0) of a csv column, if any. Defaults to the first time column found, if any. Use `null` to explicitly disregard all time columns. +* Added id matching for catalog members: +* Improved formatting of datetimes from csv files in the feature info panel. +* Removed variables consisting only of HTML tags from the Now Viewing panel. +* Added ID matching for catalog members: + - An `id` field can now be set in JSON for catalog members + - When sharing an enabled catalog item via a share link, the share link will reference the catalog item's ID + rather than its name as is done currently. + - The ID of an item should be accessed via `uniqueId` - if a catalog member doesn't have an ID set, this returns a + default value of the item's name plus the ID of its parent. This means that if all the ancestors of a catalog + member have no ID set, its ID will be its full path in the catalog. + - This means that if an item is renamed or moved, share links that reference it will still work. + - A `shareKeys` property can be also be set that contains an array of all ids that should lead to this item. This means + that a share link for an item that didn't previously have an ID set can still be used if it's moved, as long as it + has its old default ID set in `shareKeys` + - Old share links will still work as long as the items they lead to aren't renamed or moved. + - Refactor of JSON serialization - now rather than passing a number of flags that determine what should and shouldn't be + serialized, an `itemFilter` and `propertyFilter` are passed in options. These are usually composed of multiple filters, + combined using `combineFilters`. + - An index of all items currently in the catalog against all of that item's shareKeys is now maintained in `Catalog` + and can be used for O(1) lookups of any item regardless of its location. + - CatalogMembers now contain a reference to their parent CatalogGroup - this means that the catalog tree can now be + traversed in both directions. + - When serializing user-added items in the catalog, the children of `CatalogGroup`s with the `url` property set are + not serialized. Settings like `opacity` for their descendants that need to be preserved are serialized separately. +* Generated legends now use SVG (vector) format, which look better on high resolution devices. +* Created new Legend class, making it easy to generate client-side legends for different kinds of data. +* Generate client-side legends for ArcGIS MapServer catalog items, by fetching JSON file, instead of just providing link to external page. +* Fix Leaflet feature selection when zoomed out enough that the world is repeated. +* Improved handling of lat/lon CSV files with missing latitude or longitude values. +* Fixed a bug that prevented `SocrataCataloGroup` from working in Internet Explorer 9. +* Added `CkanCatalogItem`, which can be used to reference a particular resource of any compatible type on a CKAN server. +* Fixed a bug that caused the Now Viewing tab to display incorrectly in Internet Explorer 11 when switching directly to it from the Data Catalogue tab. + +### 1.0.54 + +* Fixed a bug in `AbsIttCatalogItem` that caused no legend to be displayed. + +### 1.0.53 + +* Improved compatibility with Internet Explorer 9. +* Made `CswCatalogGroup` able to find geospatial datasets on more CSW servers. +* Allow WMS parameters to be specified in json in uppercase (eg. STYLES). + +### 1.0.52 + +* Added `MapBoxMapCatalogItem`, which is especially useful for base maps. A valid access token must be provided. +* Added a `getContainer()` method to Terria's `currentViewer`. +* Dramatically improved the performance of region mapping. +* Introduced new quantisation (color binning) methods to dramatically improve the display of choropleths (numerical quantities displayed as colors) for CSV files, instead of always using linear. Four values for `colorBinMethod` are supported: + * "auto" (default), usually means "ckmeans" + * "ckmeans": use "CK means" method, an improved version of Jenks Even Breaks to form clusters of values that are as distinct as possible. + * "quantile": use quantiles, evenly distributing values between bins + * "none": use the previous linear color mapping method. +* The default style for CSV files is now 7 color bins with CK means method. +* Added support for color palettes from Color Brewer (colorbrewer2.org). Within `tableStyle`, use a value like `"colorPalette": "10-class BrBG"`. +* Improved the display of legends for CSV files, accordingly. +* URLs for legends are now encapsulated in a `LegendUrl` model, which accepts a mime type that will affect how the + legend is rendered in the sidebar. +* Added support for the Socrata "new backend" with GeoJSON download to `SocrataCatalogGroup`. +* Moved URL config parameters to config.json, with sensible defaults. Specifically: + * regionMappingDefinitionsUrl: 'data/regionMapping.json', + * conversionServiceBaseUrl: '/convert/', + * proj4ServiceBaseUrl: '/proj4/', + * corsProxyBaseUrl: '/proxy/' +* Deprecated terria.regionMappingDefinitionsUrl (set it in config.json or leave it as default). + +### 1.0.51 + +* Fixed a typo that prevented clearing the search query +* Added support for Nominatim search API hosted by OpenStreetMap (http://wiki.openstreetmap.org/wiki/Nominatim) with `NominatimSearchProviderViewModel`. This works by merging to 2 queries : one with the bounding parameter for the nearest results, and the other without the bounding parameter. The `countryCodes` property can be set to limit the result to a set of specific countries. +* Added `MapProgressBarViewModel`. When added to the user interface with `MapProgressBarViewModel.create`, it shows a bar at the top of the map window indicating tile load progress. +* We no longer show the entity's ID (which is usually a meaningless GUID) on the feature info panel when the feature does not have a name. Instead, we leave the area blank. +* Fixed a bug with time-dynamic imagery layers that caused features to be picked from the next time to be displayed, in addition to the current one. +* Replace `.` and `#` with `_` in property names meant to be used with `featureInfoTemplate`, so that these properties can be accessed by the [mustache](https://mustache.github.io/) templating engine. +* Added support for time-varying properties (e.g. from a CZML file) on the feature info panel. +* `Cesium.zoomTo` now takes the terrain height into account when zooming to a rectangle. + +### 1.0.50 + +* Put a white background behind legend images to fix legend images with transparent background being nearly invisible. +* Search entries are no longer duplicated for catalog items that appear in multiple places in the Data Catalogue +* Fixed the layer order changing in Cesium when a CSV variable is chosen. +* Layer name is now shown in the catalog item info panel for ESRI ArcGIS MapServer layers. +* Retrieve WFS or WCS URL associated with WMS data sources using DescribeLayer if no dataUrl is present. +* Downgrade Leaflet to 0.7.3 to fix specific feature clicking problems with 2D maps. +* Use `PolylineGraphics` instead of `PolygonGraphics` for unfilled polygons with an outline width greater than 1. This works around the fact that Cesium does not support polygons with outline width great than 1 on Windows due to a WebGL limitation. +* Sorted ABS age variables numerically, not alphabetically. +* Removed extra space at the bottom of base map buttons. +* Share links now remember the currently active tab in the `ExplorerPanelViewModel`. +* Fixed a bug that prevented region mapping from working over HTTPS. +* The proxy is now used to avoid a mixed content warning when accessing an HTTP dataset from an HTTPS deployment of TerriaJS. +* Added `CameraView.fromLookAt` and `CameraView.fromPositionHeadingPitchRoll` functions. These functions can be used to position the camera in new ways. + +### 1.0.49 + +* Fixed a bug that caused poor performance when clicking a point on the map with lots of features and then closing the feature information panel. +* Apply linkify, instead of markdown, to properties shown in the Feature Info Panel. +* Fixed a bug that prevented feature scaling by value. +* Fixed a bug that prevented the csv `displayDuration` from working. +* Fixed a bug that ignored which column of the csv file to show as the legend initially. +* `NowViewingTabViewModel` is now composed of a number of sections. Each section is given the opportunity to determine whether it applies to each catalog item. Custom sections may be added by adding them to NowViewingTabViewModel.sections`. +* `CsvCatalogItem` and `AbsIttCatalogItem` now expose a `concepts` property that can be used to adjust the display. +* Added `Terria.cesiumBaseUrl` property. +* The user interface container DOM element may now be provided to `TerriaViewer` by specifying `uiContainer` in its options. Previously it always used an element named `ui`. +* Legend URLs are now accessed via the proxy, if applicable. +* Fixed a bug that prevented feature scaling by value. +* Added support for [Urthecast](https://www.urthecast.com/) with `UrthecastCatalogGroup`. +* Fixed a bug that caused a `TypeError` on load when the share URL included enabled datasets with an order different from their order in the catalog. +* Improved the message that is shown to the user when their browser supports WebGL but it has a "major performance caveat". +* Fixed a bug that could cause an exception in some browsers (Internet Explorer, Safari) when loading a GeoJSON with embedded styles. +* Fixed a bug with Leaflet 2D map where clicks on animation controls or timeline would also register on the map underneath causing undesired feature selection and, when double clicked, zooming (also removed an old hack that disabled dragging while using the timeline slider) +* Changed Australian Topography base map server and updated the associated thumbnail. +* Added `updateApplicationOnMessageFromParentWindow` function. After an app calls this function at startup, TerriaJS can be controlled by its parent window when embedded in an `iframe` by messages sent with `window.postMessage`. + +### 1.0.48 + +* Added the ability to disable feature picking for `ArcGisMapServerCatalogItem`. +* Disabled feature picking for the Australian Topography and Australian Hydrography base layers created by `createAustraliaBaseMapOptions`. + +### 1.0.47 + +* Make it possible to disable CSV region mapping warnings with the `showWarnings` init parameter. +* The `name` of a feature from a CSV file is now taken from a `name` or `title` column, if it exists. Previously the name was always "Site Data". +* Fixed a bug that caused time-dynamic WMS layers with just one time to not be displayed. +* Underscores are now replaced with spaces in the feature info panel for `GeoJsonCatalogItem`. +* Added Proj4 projections to the location bar. Clicking on the bar switches between lats/longs and projected coordinates. To enable this, set `useProjection` to `true` +* Show information for all WMS features when a location is clicked. +* Fixed a bug that caused an exception when running inside an `