diff --git a/CHANGES.md b/CHANGES.md index dd9e0725c7b..38c156f4656 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,9 +1,10 @@ # Change Log -#### next release (8.3.7) +#### next release (8.4.0) - **Breaking change:** Replaced `node-sass` with (dart) `sass` - You will need to update your `TerriaMap` to use `sass` instead of `node-sass`. +- Fix `WebMapServiceCatalogItem` `allowFeaturePicking` - Allow translation of TableStylingWorkflow. - Fix "Remove all" not removing selected/picked features - [The next improvement] diff --git a/buildprocess/ci-cleanup.js b/buildprocess/ci-cleanup.js index be06458c747..325a265b1ac 100644 --- a/buildprocess/ci-cleanup.js +++ b/buildprocess/ci-cleanup.js @@ -51,7 +51,8 @@ function makeSafeName(name) { return name .toLowerCase() .replace(/[^-a-z0-9]/g, "-") - .substring(0, 40); + .substring(0, 32) + .replace(/-*$/, ""); } function createIngress(branches) { @@ -73,7 +74,7 @@ function createIngress(branches) { host: "ci.terria.io", http: { paths: branches.map((branch) => ({ - path: "/" + branch.name + "(/|$)(.*)", + path: "/" + makeSafeName(branch.name) + "(/|$)(.*)", pathType: "ImplementationSpecific", backend: { service: { diff --git a/buildprocess/ci-deploy.sh b/buildprocess/ci-deploy.sh index c39c8f1b242..0904e609191 100644 --- a/buildprocess/ci-deploy.sh +++ b/buildprocess/ci-deploy.sh @@ -10,7 +10,9 @@ if [[ $GITHUB_BRANCH =~ ^greenkeeper/ ]]; then fi # A version of the branch name that can be used as a DNS name once we prepend and append some stuff. -SAFE_BRANCH_NAME=$(printf '%s' "${GITHUB_BRANCH,,:0:40}" | sed 's/[^-a-z0-9]/-/g') +SAFE_BRANCH_NAME=$(printf '%s' "${GITHUB_BRANCH:0:32}" | sed -e 's/./\L&/g' -e 's/[^-a-z0-9]/-/g' -e 's/-*$//') + +[[ $SAFE_BRANCH_NAME != $GITHUB_BRANCH ]] && echo "::warning file=buildprocess/ci-deploy.sh::Branch name sanitised to '${SAFE_BRANCH_NAME}' for kubernetes resources. This may work, however using branch names less than 32 characters long with [a-z0-9] and hyphen separators are preferred" gh api /repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA} -f state=pending -f context=deployment -f target_url=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} diff --git a/lib/Models/Catalog/Ows/WebMapServiceCatalogItem.ts b/lib/Models/Catalog/Ows/WebMapServiceCatalogItem.ts index 3ce6fd42aa7..0ef921f6ff3 100644 --- a/lib/Models/Catalog/Ows/WebMapServiceCatalogItem.ts +++ b/lib/Models/Catalog/Ows/WebMapServiceCatalogItem.ts @@ -398,7 +398,9 @@ class WebMapServiceCatalogItem return undefined; } - imageryProvider.enablePickFeatures = true; + // Reset feature picking for the current imagery layer. + // We disable feature picking for the next imagery layer. + imageryProvider.enablePickFeatures = this.allowFeaturePicking; return { imageryProvider, @@ -422,6 +424,7 @@ class WebMapServiceCatalogItem return undefined; } + // Disable feature picking for the next imagery layer. imageryProvider.enablePickFeatures = false; return { @@ -574,8 +577,8 @@ class WebMapServiceCatalogItem tilingScheme: this.tilingScheme, maximumLevel: this.getMaximumLevel(true) ?? this.maximumLevel, minimumLevel: this.minimumLevel, - credit: this.attribution, - enablePickFeatures: this.allowFeaturePicking + credit: this.attribution + // Note: we set enablePickFeatures in _currentImageryParts and _nextImageryParts }; if (isDefined(this.getFeatureInfoFormat?.type)) { diff --git a/test/Models/Catalog/Ows/WebMapServiceCatalogItemSpec.ts b/test/Models/Catalog/Ows/WebMapServiceCatalogItemSpec.ts index 05541195379..54284a78533 100644 --- a/test/Models/Catalog/Ows/WebMapServiceCatalogItemSpec.ts +++ b/test/Models/Catalog/Ows/WebMapServiceCatalogItemSpec.ts @@ -562,6 +562,85 @@ describe("WebMapServiceCatalogItem", function () { ); }); + it('creates "next" imagery provider when animating', async function () { + const terria = new Terria(); + const wmsItem = new WebMapServiceCatalogItem("some-layer", terria); + runInAction(() => { + wmsItem.setTrait(CommonStrata.definition, "url", "http://example.com"); + wmsItem.setTrait( + CommonStrata.definition, + "getCapabilitiesUrl", + "test/WMS/styles_and_dimensions.xml" + ); + wmsItem.setTrait(CommonStrata.definition, "layers", "C"); + wmsItem.setTrait( + CommonStrata.definition, + "currentTime", + "2002-01-01T00:00:00.000Z" + ); + }); + + terria.timelineStack.addToTop(wmsItem); + terria.timelineStack.activate(); + + (await wmsItem.loadMapItems()).throwIfError(); + + expect(wmsItem.mapItems.length).toBe(1); + expect(wmsItem.isPaused).toBe(true); + + runInAction(() => { + wmsItem.setTrait(CommonStrata.definition, "isPaused", false); + }); + + expect(wmsItem.mapItems.length).toBe(2); + expect(wmsItem.isPaused).toBe(false); + + const currentImageryProvider = wmsItem.mapItems[0] + .imageryProvider as WebMapServiceImageryProvider; + expect(currentImageryProvider instanceof WebMapServiceImageryProvider).toBe( + true + ); + expect(currentImageryProvider.enablePickFeatures).toBe(true); + + const nextMapItem = wmsItem.mapItems[1]; + const nextImageryProvider = + nextMapItem.imageryProvider as WebMapServiceImageryProvider; + expect(nextImageryProvider instanceof WebMapServiceImageryProvider).toBe( + true + ); + expect(nextImageryProvider.enablePickFeatures).toBe(false); + expect(nextMapItem.alpha).toBe(0); + expect(nextMapItem.show).toBe(true); + }); + + it("sets enableFeaturePicking to false", async function () { + const terria = new Terria(); + const wmsItem = new WebMapServiceCatalogItem("some-layer", terria); + runInAction(() => { + wmsItem.setTrait(CommonStrata.definition, "url", "http://example.com"); + wmsItem.setTrait(CommonStrata.definition, "allowFeaturePicking", false); + wmsItem.setTrait( + CommonStrata.definition, + "getCapabilitiesUrl", + "test/WMS/styles_and_dimensions.xml" + ); + wmsItem.setTrait(CommonStrata.definition, "layers", "C"); + }); + + (await wmsItem.loadMetadata()).throwIfError(); + + expect(wmsItem.mapItems.length).toBe(1); + expect(wmsItem.allowFeaturePicking).toBe(false); + + const imageryProvider = wmsItem.mapItems[0] + .imageryProvider as WebMapServiceImageryProvider; + expect( + imageryProvider instanceof WebMapServiceImageryProvider + ).toBeTruthy(); + + expect(imageryProvider.enablePickFeatures).toBe(false); + }); + it("dimensions and styles for a 'real' WMS layer", function (done) { const terria = new Terria(); const wmsItem = new WebMapServiceCatalogItem("some-layer", terria);