Make embedded maps cooperate with page gestures
This commit is contained in:
parent
9cdd31c72e
commit
85039b76ef
|
|
@ -883,6 +883,7 @@ const createAidMap = element => {
|
||||||
attributionControl: true,
|
attributionControl: true,
|
||||||
renderWorldCopies: false,
|
renderWorldCopies: false,
|
||||||
trackResize: false,
|
trackResize: false,
|
||||||
|
cooperativeGestures: true,
|
||||||
dragRotate: !demoMap,
|
dragRotate: !demoMap,
|
||||||
pitchWithRotate: !demoMap,
|
pitchWithRotate: !demoMap,
|
||||||
scrollZoom: !demoMap
|
scrollZoom: !demoMap
|
||||||
|
|
@ -2483,6 +2484,7 @@ export const Hooks = {
|
||||||
zoom: initialCoordinates ? 13 : 5,
|
zoom: initialCoordinates ? 13 : 5,
|
||||||
locale: mapUiLocale(),
|
locale: mapUiLocale(),
|
||||||
attributionControl: true,
|
attributionControl: true,
|
||||||
|
cooperativeGestures: true,
|
||||||
dragRotate: false,
|
dragRotate: false,
|
||||||
pitchWithRotate: false
|
pitchWithRotate: false
|
||||||
})
|
})
|
||||||
|
|
|
||||||
13
assets/js/map_interactions.test.mjs
Normal file
13
assets/js/map_interactions.test.mjs
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import assert from "node:assert/strict"
|
||||||
|
import {readFile} from "node:fs/promises"
|
||||||
|
import test from "node:test"
|
||||||
|
|
||||||
|
const hooksSource = await readFile(new URL("./hooks.js", import.meta.url), "utf8")
|
||||||
|
|
||||||
|
test("every embedded MapLibre map uses cooperative gestures", () => {
|
||||||
|
const constructors = hooksSource.match(/new maplibregl\.Map\(\{/g) || []
|
||||||
|
const cooperativeOptions = hooksSource.match(/cooperativeGestures:\s*true/g) || []
|
||||||
|
|
||||||
|
assert.equal(constructors.length, 2)
|
||||||
|
assert.equal(cooperativeOptions.length, constructors.length)
|
||||||
|
})
|
||||||
|
|
@ -140,6 +140,50 @@ pod_snapshot() {
|
||||||
] | sort_by(.component, .name)' >"$1"
|
] | sort_by(.component, .name)' >"$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
web_readiness_snapshot() {
|
||||||
|
local output_file=$1
|
||||||
|
local jsonl_file="${output_file%.json}.jsonl"
|
||||||
|
local body
|
||||||
|
local pod
|
||||||
|
|
||||||
|
mapfile -t web_pods < <(
|
||||||
|
"${kube[@]}" get pods \
|
||||||
|
-l app.kubernetes.io/component=web \
|
||||||
|
--field-selector=status.phase=Running \
|
||||||
|
-o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}'
|
||||||
|
)
|
||||||
|
|
||||||
|
if [[ "${#web_pods[@]}" -ne 2 ]]; then
|
||||||
|
echo "Expected two running web pods; observed ${#web_pods[@]}." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
: >"$jsonl_file"
|
||||||
|
|
||||||
|
for pod in "${web_pods[@]}"; do
|
||||||
|
if ! body=$(
|
||||||
|
"${kube[@]}" exec -c web "$pod" -- sh -c \
|
||||||
|
'curl --silent --show-error --fail --max-time 2 \
|
||||||
|
"http://127.0.0.1:${PORT:?}/healthz/ready"'
|
||||||
|
); then
|
||||||
|
echo "The readiness endpoint failed inside web pod $pod." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
jq -cn \
|
||||||
|
--arg pod "$pod" \
|
||||||
|
--arg body "$body" \
|
||||||
|
'{
|
||||||
|
pod: $pod,
|
||||||
|
body: $body,
|
||||||
|
response: (try ($body | fromjson) catch null)
|
||||||
|
}' >>"$jsonl_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
jq -s 'sort_by(.pod)' "$jsonl_file" >"$output_file"
|
||||||
|
unlink "$jsonl_file"
|
||||||
|
}
|
||||||
|
|
||||||
stop_probe() {
|
stop_probe() {
|
||||||
unlink "$probe_marker" 2>/dev/null || true
|
unlink "$probe_marker" 2>/dev/null || true
|
||||||
|
|
||||||
|
|
@ -406,24 +450,21 @@ jq -s '{
|
||||||
samples: length,
|
samples: length,
|
||||||
failures: (map(select(.status != "200")) | length),
|
failures: (map(select(.status != "200")) | length),
|
||||||
retried_samples: (map(select(.retries > 0)) | length),
|
retried_samples: (map(select(.retries > 0)) | length),
|
||||||
total_retries: (map(.retries) | add),
|
total_retries: (map(.retries) | add)
|
||||||
nodes: (map(.body | fromjson? | .node) | map(select(. != null)) | unique)
|
|
||||||
}' "$probe_log" >"$output_dir/readiness-summary.json"
|
}' "$probe_log" >"$output_dir/readiness-summary.json"
|
||||||
|
|
||||||
"${kube[@]}" get pods \
|
web_readiness_snapshot "$output_dir/web-pod-readiness.json"
|
||||||
-l app.kubernetes.io/component=web \
|
|
||||||
-o json |
|
if ! jq -e '.samples > 0 and .failures == 0' \
|
||||||
jq '[.items[].status.podIP | "who_need_help@" + .] | sort' \
|
"$output_dir/readiness-summary.json" >/dev/null; then
|
||||||
>"$output_dir/current-web-nodes.json"
|
echo "Kind readiness was unavailable during the rollout." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if ! jq -e \
|
if ! jq -e \
|
||||||
--slurpfile current "$output_dir/current-web-nodes.json" '
|
'length == 2 and all(.response.status == "ready")' \
|
||||||
.samples > 0 and
|
"$output_dir/web-pod-readiness.json" >/dev/null; then
|
||||||
.failures == 0 and
|
echo "Both replacement web pods did not pass direct readiness checks." >&2
|
||||||
($current[0] | length) == 2 and
|
|
||||||
(($current[0] - .nodes) | length) == 0
|
|
||||||
' "$output_dir/readiness-summary.json" >/dev/null; then
|
|
||||||
echo "Kind readiness was unavailable or did not reach both web replicas." >&2
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user