Skip to content

Commit

Permalink
Use real URLs, instead of a hardcoded local file
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed May 11, 2023
1 parent e588f7f commit b577ab3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ jobs:
node-version: 18.x
cache: 'npm'

- name: Install wasm-pack
uses: jetli/[email protected]

- name: Install dependencies
run: npm ci

- name: Build WASM
run: [ -d route_info ] && npm run wasm-release

- name: Install Playwright Browsers
run: npx playwright install --with-deps

Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ node_modules/
/playwright-report/
/playwright/.cache/
dist

assets/bristol.bin
12 changes: 6 additions & 6 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { onMount } from "svelte";
import authoritiesUrl from "../assets/authorities.geojson?url";
import type { Schema } from "./types";
import bristolUrl from "../assets/bristol.bin?url";
import * as Comlink from "comlink";
import workerWrapper from "./worker?worker";
import { type RouteInfo } from "./worker";
Expand Down Expand Up @@ -41,9 +40,11 @@
// HTTP and HTTPS content, so use the Cloudfront HTTPS interface. That'll need
// CDN invalidations when we update these files. But when serving locally for
// development, HTTPS is also fine to use.
var routeUrl = `https://atip.uk/route-snappers/${authorityName}.bin`;
var routeSnapperUrl = `https://atip.uk/route-snappers/${authorityName}.bin`;
var routeInfoUrl = `https://atip.uk/route-info/${authorityName}.bin`;
if (!prod) {
routeUrl = `https://atip.uk/route-snappers-dev/${authorityName}.bin`;
routeSnapperUrl = `https://atip.uk/route-snappers-dev/${authorityName}.bin`;
routeInfoUrl = `https://atip.uk/route-info-dev/${authorityName}.bin`;
}
let routeInfo: Comlink.Remote<RouteInfo>;
Expand Down Expand Up @@ -77,8 +78,7 @@
new workerWrapper()
);
routeInfo = await new MyWorker();
// TODO Like the route snapper, vary the URL of this
await routeInfo.loadFile(bristolUrl);
await routeInfo.loadFile(routeInfoUrl);
});
async function loadAuthorityBoundary(): Promise<FeatureCollection<Polygon>> {
Expand Down Expand Up @@ -132,7 +132,7 @@
<BoundaryLayer {boundaryGeojson} />
<InterventionLayer {schema} />
<HoverLayer />
<Toolbox {routeUrl} {schema} />
<Toolbox {routeSnapperUrl} {schema} />
<BaselayerSwitcher {style} />
<Legend {schema} />
</Map>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/draw/Toolbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import SnapPolygonMode from "./snap_polygon/SnapPolygonMode.svelte";
import SplitRouteMode from "./route/SplitRouteMode.svelte";
export let routeUrl: string;
export let routeSnapperUrl: string;
export let schema: Schema;
// Plumbed up from RouteMode, so we can pass it down to GeometryMode
// TODO Create this here too?
Expand Down Expand Up @@ -134,7 +134,7 @@
bind:this={routeMode}
{mode}
{changeMode}
url={routeUrl}
url={routeSnapperUrl}
bind:routeTool
/>
</div>
Expand Down

0 comments on commit b577ab3

Please sign in to comment.