diff --git a/.github/workflows/deploy-sandbox.yaml b/.github/workflows/deploy-sandbox.yaml index f197b258d..dc6b916d3 100644 --- a/.github/workflows/deploy-sandbox.yaml +++ b/.github/workflows/deploy-sandbox.yaml @@ -14,6 +14,7 @@ on: - design - eric - greg + - james jobs: deploy-sandbox: @@ -32,7 +33,7 @@ jobs: cf_password: ${{ secrets[env.CF_PASSWORD] }} cf_org: nws-weathergov cf_space: ${{ github.event.inputs.environment }} - cf_command: "push -f manifests/manifest-${{ github.event.inputs.environment }}.yaml --var newrelic-license=${{ secrets.NEWRELIC_LICENSE }} --strategy rolling" + cf_command: "push -f manifests/manifest-${{ github.event.inputs.environment }}.yaml --var newrelic-license='${{ secrets.NEWRELIC_LICENSE }}' --var allowed-ips='${{secrets.ALLOWED_IP_ADDRESSES}}' --strategy rolling" - name: Run post-deploy steps in ${{ github.event.inputs.environment }} space uses: cloud-gov/cg-cli-tools@main diff --git a/docs/architecture/decisions/0017-we-will-use-an-interoperability-layer-between-the-nws-public-api-and-the-website.md b/docs/architecture/decisions/0017-we-will-use-an-interoperability-layer-between-the-nws-public-api-and-the-website.md new file mode 100644 index 000000000..1571b1f5e --- /dev/null +++ b/docs/architecture/decisions/0017-we-will-use-an-interoperability-layer-between-the-nws-public-api-and-the-website.md @@ -0,0 +1,31 @@ +# We will use an interoperability layer between the NWS public API and the website + +Date: 2024-10-01 + +### Status + +Accepted + +### Context + +The public NWS API is primary data source for all observation and forecast data. The way it is architected, it requires multiple roundtrip REST requests to obtain all of the information needed to display our website. The data that comes back from the API is not precisely the structure that works best for our website, so we do some amount of processing on it before using it to render the site. We currently cache API responses with Drupal caching mechanisms, but we do not cache the processed results. + +### Decision + +We will introduce a new API interop layer that sits between Drupal and the public NWS API. This layer will be built in Node.js to take advantage of its multithreading support and low memory footprint. + +The interop layer will present a single endpoint that returns all of the data relevant to rendering the website. Behind the scenes, the interop layer will make the necessary calls to the public API and the local geospatial database tables. The interop layer will also handle most of the processing of the raw data into structures that directly serve the website. + +### Consequences + +#### Positive +- In the immediate term, our Drupal modules for fetching data will be dramatically simplified if not entirely replaced. Because Drupal is single-threaded, offloading this functionality should have a positive impact on page load times. +- In the longer term, the interop layer can add caching for processed data, allowing much faster responses to page requests. +- The most significant portion of backend code is moved out of PHP and into Javascript, a language that is easier to support by 18F staff. Javascript also has very broad industry support (as does PHP), so this should not have any downstream negative consequences. +- We should have more flexibility over how we handle error cases. Currently our response to errors from the API is to simply show a red banner for whichever data component failed. Because of how the site was built with intertangled blocks, an error in one data component could cascade into errors for other components (e.g., if the forecast causes an error, we also don't show alerts). With the interop layer, we have an opportunity to separate the data components more cleanly and have more fine-grained error handling. + +#### Neutral +- Additional cloud resources will be required. It seems likely to be a relatively small impact since the total amount of computation work will remain roughly the same. + +#### Negative +- The interop layer introduces an additional programming language and runtime environment, increasing complexity. diff --git a/package-lock.json b/package-lock.json index 45dd02ee1..54f5f044b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "devDependencies": { "@axe-core/playwright": "^4.10.0", "@playwright/test": "^1.47.2", - "@types/node": "^22.7.1", + "@types/node": "^22.7.4", "axe-core": "^4.10.0", "chai": "^5.1.1", "cypress": "^13.14.2", @@ -633,9 +633,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "22.7.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.1.tgz", - "integrity": "sha512-adOMRLVmleuWs/5V/w5/l7o0chDK/az+5ncCsIapTKogsu/3MVWvSgP58qVTXi5IwpfGt8pMobNq9rOWtJyu5Q==", + "version": "22.7.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.4.tgz", + "integrity": "sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==", "dependencies": { "undici-types": "~6.19.2" } diff --git a/package.json b/package.json index 487225d54..cefd85e72 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "devDependencies": { "@axe-core/playwright": "^4.10.0", "@playwright/test": "^1.47.2", - "@types/node": "^22.7.1", + "@types/node": "^22.7.4", "axe-core": "^4.10.0", "chai": "^5.1.1", "cypress": "^13.14.2", diff --git a/tests/api/data/e2e/alerts/active__status=actual&area=CA.json b/tests/api/data/e2e/alerts/active__status=actual&area=CA.json index 377ab3057..53fab018d 100644 --- a/tests/api/data/e2e/alerts/active__status=actual&area=CA.json +++ b/tests/api/data/e2e/alerts/active__status=actual&area=CA.json @@ -5588,6 +5588,96 @@ "eventEndingTime": ["2024-01-05T02:00:00+00:00"] } } + }, + { + "id": "https://alert/tropical_cyclone_local_statement}", + "type": "Feature", + "geometry": null, + "properties": { + "@id": "https://alert/tropical_cyclone_local_statement}", + "@type": "wx:Alert", + "id": "tropical_cyclone_local_statement", + "areaDesc": "Over there. Over there. Send the word, to be heard, over there", + "geocode": { + "SAME": [], + "UGC": [] + }, + "affectedZones": ["https://every-alert/zone"], + "references": [], + "sent": "date:now -1 hour", + "effective": "date:now -1 hour", + "onset": "date:now -1 hour", + "expires": "date:now +1 hour", + "ends": "date:now +1 hour", + "status": "Actual", + "messageType": "Alert", + "category": "Met", + "severity": "Severe", + "certainty": "Likely", + "urgency": "Expected", + "event": "tropical cyclone local statement", + "sender": "w-nws.webmaster@noaa.gov", + "senderName": "NWS Anchorage AK", + "headline": "Tropical Cyclone Local Statement", + "description": "Not real", + "instruction": null, + "response": "Avoid", + "parameters": { + "AWIPSidentifier": ["CWFALU"], + "WMOidentifier": ["FZAK52 PAFC 031605 AAA"], + "NWSheadline": [ + "GALE WARNING THROUGH THURSDAY... ...HEAVY FREEZING SPRAY WARNING TONIGHT AND THURSDAY" + ], + "BLOCKCHANNEL": ["EAS", "NWEM", "CMAS"], + "VTEC": ["/O.NEW.PAFC.UP.W.3097.240104T0200Z-240105T0200Z/"], + "eventEndingTime": ["2024-01-05T02:00:00+00:00"] + } + } + }, + { + "id": "https://alert/cold_weather_advisory}", + "type": "Feature", + "geometry": null, + "properties": { + "@id": "https://alert/cold_weather_advisory}", + "@type": "wx:Alert", + "id": "cold_weather_advisory", + "areaDesc": "Over there. Over there. Send the word, to be heard, over there", + "geocode": { + "SAME": [], + "UGC": [] + }, + "affectedZones": ["https://every-alert/zone"], + "references": [], + "sent": "date:now -1 hour", + "effective": "date:now -1 hour", + "onset": "date:now -1 hour", + "expires": "date:now +1 hour", + "ends": "date:now +1 hour", + "status": "Actual", + "messageType": "Alert", + "category": "Met", + "severity": "Severe", + "certainty": "Likely", + "urgency": "Expected", + "event": "cold weather advisory", + "sender": "w-nws.webmaster@noaa.gov", + "senderName": "NWS Anchorage AK", + "headline": "Dummy alert", + "description": "Not real", + "instruction": null, + "response": "Avoid", + "parameters": { + "AWIPSidentifier": ["CWFALU"], + "WMOidentifier": ["FZAK52 PAFC 031605 AAA"], + "NWSheadline": [ + "GALE WARNING THROUGH THURSDAY... ...HEAVY FREEZING SPRAY WARNING TONIGHT AND THURSDAY" + ], + "BLOCKCHANNEL": ["EAS", "NWEM", "CMAS"], + "VTEC": ["/O.NEW.PAFC.UP.W.3097.240104T0200Z-240105T0200Z/"], + "eventEndingTime": ["2024-01-05T02:00:00+00:00"] + } + } } ] } diff --git a/web/modules/weather_blocks/src/Plugin/Block/Test/EndToEnd/Alerts/Filter.php.test b/web/modules/weather_blocks/src/Plugin/Block/Test/EndToEnd/Alerts/Filter.php.test index 27c9b9387..9b62635e4 100644 --- a/web/modules/weather_blocks/src/Plugin/Block/Test/EndToEnd/Alerts/Filter.php.test +++ b/web/modules/weather_blocks/src/Plugin/Block/Test/EndToEnd/Alerts/Filter.php.test @@ -115,6 +115,7 @@ final class AlertFilterTest extends EndToEndBase /** * Test that alerts are sorted correctly. * @group e2e + * @group eric */ public function testAlertSorting(): void { @@ -143,6 +144,8 @@ final class AlertFilterTest extends EndToEndBase "snow squall warning", "ice storm warning", "winter storm warning", + "lake effect snow warning", + "dust storm warning", "high wind warning", "tropical storm warning", "tsunami advisory", @@ -151,40 +154,30 @@ final class AlertFilterTest extends EndToEndBase "earthquake warning", "volcano warning", "ashfall warning", + "flood warning", "coastal flood warning", "lakeshore flood warning", - "flood warning", + "ashfall advisory", "high surf warning", - "dust storm warning", - "lake effect snow warning", "excessive heat warning", "tornado watch", "severe thunderstorm watch", "flash flood watch", "flood statement", - "wind chill warning", "extreme cold warning", - "hard freeze warning", "freeze warning", "red flag warning", "hurricane watch", "typhoon watch", "tropical storm watch", - "hurricane local statement", - "typhoon local statement", - "tropical storm local statement", - "tropical depression local statement", - "avalanche advisory", + "tropical cyclone local statement", "winter weather advisory", - "wind chill advisory", + "avalanche advisory", + "cold weather advisory", "heat advisory", - "urban and small stream flood advisory", - "small stream flood advisory", - "arroyo and small stream flood advisory", "flood advisory", - "hydrologic advisory", - "lakeshore flood advisory", "coastal flood advisory", + "lakeshore flood advisory", "high surf advisory", "dense fog advisory", "dense smoke advisory", @@ -192,22 +185,18 @@ final class AlertFilterTest extends EndToEndBase "lake wind advisory", "wind advisory", "frost advisory", - "ashfall advisory", "freezing fog advisory", "local area emergency", - "avalanche watch", - "blizzard watch", + "winter storm watch", "rip current statement", "beach hazards statement", - "winter storm watch", + "avalanche watch", + "flood watch", "coastal flood watch", "lakeshore flood watch", - "flood watch", "high wind watch", "excessive heat watch", "extreme cold watch", - "wind chill watch", - "lake effect snow watch", "freeze watch", "fire weather watch", "extreme fire danger", @@ -222,7 +211,7 @@ final class AlertFilterTest extends EndToEndBase "short term forecast", "administrative message", "test", - "child abduction emergency", + "child abduction emergency" ]; $this->onLocationRoute(37.805, -122.273); diff --git a/web/modules/weather_blocks/weather_blocks.module b/web/modules/weather_blocks/weather_blocks.module index 0b45ef816..1988ffbd7 100644 --- a/web/modules/weather_blocks/weather_blocks.module +++ b/web/modules/weather_blocks/weather_blocks.module @@ -67,6 +67,10 @@ function weather_blocks_template_preprocess_default_variables_alter( "https://cdn.star.nesdis.noaa.gov/WFO/$wfo/GEOCOLOR/$goes-" . strtoupper($wfo) . "-GEOCOLOR-600x600.gif", + "mp4" => + "https://cdn.star.nesdis.noaa.gov/WFO/$wfo/GEOCOLOR/$goes-" . + strtoupper($wfo) . + "-GEOCOLOR-600x600.mp4", ]; } } catch (Throwable $e) { diff --git a/web/modules/weather_data/src/Service/AlertUtility.php b/web/modules/weather_data/src/Service/AlertUtility.php index d2fc9ae3b..d706e0fa3 100644 --- a/web/modules/weather_data/src/Service/AlertUtility.php +++ b/web/modules/weather_data/src/Service/AlertUtility.php @@ -151,132 +151,132 @@ class AlertUtility "kind" => "ALERT_KIND_LAND", "priority" => 23552, ], - "winter storm warning" => [ + "heavy freezing spray warning" => [ "level" => "ALERT_LEVEL_WARNING", - "kind" => "ALERT_KIND_LAND", + "kind" => "ALERT_KIND_MARINE", "priority" => 24576, ], - "high wind warning" => [ + "winter storm warning" => [ "level" => "ALERT_LEVEL_WARNING", "kind" => "ALERT_KIND_LAND", "priority" => 25600, ], - "tropical storm warning" => [ + "lake effect snow warning" => [ "level" => "ALERT_LEVEL_WARNING", "kind" => "ALERT_KIND_LAND", "priority" => 26624, ], - "storm warning" => [ + "dust storm warning" => [ "level" => "ALERT_LEVEL_WARNING", - "kind" => "ALERT_KIND_MARINE", + "kind" => "ALERT_KIND_LAND", "priority" => 27648, ], - "tsunami advisory" => [ - "level" => "ALERT_LEVEL_OTHER", - "kind" => "ALERT_KIND_LAND", + "blowing dust warning" => [ + "level" => "ALERT_LEVEL_WARNING", + "kind" => "ALERT_KIND_OTHER", "priority" => 28672, ], - "tsunami watch" => [ - "level" => "ALERT_LEVEL_WATCH", + "high wind warning" => [ + "level" => "ALERT_LEVEL_WARNING", "kind" => "ALERT_KIND_LAND", "priority" => 29696, ], - "avalanche warning" => [ + "tropical storm warning" => [ "level" => "ALERT_LEVEL_WARNING", "kind" => "ALERT_KIND_LAND", "priority" => 30720, ], - "earthquake warning" => [ + "storm warning" => [ "level" => "ALERT_LEVEL_WARNING", - "kind" => "ALERT_KIND_LAND", + "kind" => "ALERT_KIND_MARINE", "priority" => 31744, ], - "volcano warning" => [ - "level" => "ALERT_LEVEL_WARNING", + "tsunami advisory" => [ + "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", "priority" => 32768, ], - "ashfall warning" => [ - "level" => "ALERT_LEVEL_WARNING", + "tsunami watch" => [ + "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_LAND", "priority" => 33792, ], - "coastal flood warning" => [ + "avalanche warning" => [ "level" => "ALERT_LEVEL_WARNING", "kind" => "ALERT_KIND_LAND", "priority" => 34816, ], - "lakeshore flood warning" => [ + "earthquake warning" => [ "level" => "ALERT_LEVEL_WARNING", "kind" => "ALERT_KIND_LAND", "priority" => 35840, ], - "flood warning" => [ + "volcano warning" => [ "level" => "ALERT_LEVEL_WARNING", "kind" => "ALERT_KIND_LAND", "priority" => 36864, ], - "high surf warning" => [ + "ashfall warning" => [ "level" => "ALERT_LEVEL_WARNING", "kind" => "ALERT_KIND_LAND", "priority" => 37888, ], - "dust storm warning" => [ + "flood warning" => [ "level" => "ALERT_LEVEL_WARNING", "kind" => "ALERT_KIND_LAND", "priority" => 38912, ], - "blowing dust warning" => [ + "coastal flood warning" => [ "level" => "ALERT_LEVEL_WARNING", - "kind" => "ALERT_KIND_OTHER", + "kind" => "ALERT_KIND_LAND", "priority" => 39936, ], - "lake effect snow warning" => [ + "lakeshore flood warning" => [ "level" => "ALERT_LEVEL_WARNING", "kind" => "ALERT_KIND_LAND", "priority" => 40960, ], + "ashfall advisory" => [ + "level" => "ALERT_LEVEL_OTHER", + "kind" => "ALERT_KIND_LAND", + "priority" => 41984, + ], + "high surf warning" => [ + "level" => "ALERT_LEVEL_WARNING", + "kind" => "ALERT_KIND_LAND", + "priority" => 43008, + ], "excessive heat warning" => [ "level" => "ALERT_LEVEL_WARNING", "kind" => "ALERT_KIND_LAND", - "priority" => 41984, + "priority" => 44032, ], "tornado watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_LAND", - "priority" => 43008, + "priority" => 45056, ], "severe thunderstorm watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_LAND", - "priority" => 44032, + "priority" => 46080, ], "flash flood watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_LAND", - "priority" => 45056, + "priority" => 47104, ], "gale warning" => [ "level" => "ALERT_LEVEL_WARNING", "kind" => "ALERT_KIND_MARINE", - "priority" => 46080, + "priority" => 48128, ], "flood statement" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 47104, - ], - "wind chill warning" => [ - "level" => "ALERT_LEVEL_WARNING", - "kind" => "ALERT_KIND_LAND", - "priority" => 48128, - ], - "extreme cold warning" => [ - "level" => "ALERT_LEVEL_WARNING", - "kind" => "ALERT_KIND_LAND", "priority" => 49152, ], - "hard freeze warning" => [ + "extreme cold warning" => [ "level" => "ALERT_LEVEL_WARNING", "kind" => "ALERT_KIND_LAND", "priority" => 50176, @@ -321,336 +321,271 @@ class AlertUtility "kind" => "ALERT_KIND_MARINE", "priority" => 58368, ], - "hurricane local statement" => [ + "tropical cyclone local statement" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", "priority" => 59392, ], - "typhoon local statement" => [ + "winter weather advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", "priority" => 60416, ], - "tropical storm local statement" => [ + "avalanche advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", "priority" => 61440, ], - "tropical depression local statement" => [ + "cold weather advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", "priority" => 62464, ], - "avalanche advisory" => [ + "heat advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", "priority" => 63488, ], - "winter weather advisory" => [ + "flood advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", "priority" => 64512, ], - "wind chill advisory" => [ + "coastal flood advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", "priority" => 65536, ], - "heat advisory" => [ - "level" => "ALERT_LEVEL_OTHER", - "kind" => "ALERT_KIND_LAND", - "priority" => 66560, - ], - "urban and small stream flood advisory" => [ - "level" => "ALERT_LEVEL_OTHER", - "kind" => "ALERT_KIND_LAND", - "priority" => 67584, - ], - "small stream flood advisory" => [ - "level" => "ALERT_LEVEL_OTHER", - "kind" => "ALERT_KIND_LAND", - "priority" => 68608, - ], - "arroyo and small stream flood advisory" => [ - "level" => "ALERT_LEVEL_OTHER", - "kind" => "ALERT_KIND_LAND", - "priority" => 69632, - ], - "flood advisory" => [ - "level" => "ALERT_LEVEL_OTHER", - "kind" => "ALERT_KIND_LAND", - "priority" => 70656, - ], - "hydrologic advisory" => [ - "level" => "ALERT_LEVEL_OTHER", - "kind" => "ALERT_KIND_LAND", - "priority" => 71680, - ], "lakeshore flood advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 72704, - ], - "coastal flood advisory" => [ - "level" => "ALERT_LEVEL_OTHER", - "kind" => "ALERT_KIND_LAND", - "priority" => 73728, + "priority" => 66560, ], "high surf advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 74752, - ], - "heavy freezing spray warning" => [ - "level" => "ALERT_LEVEL_WARNING", - "kind" => "ALERT_KIND_MARINE", - "priority" => 75776, + "priority" => 67584, ], "dense fog advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 76800, + "priority" => 68608, ], "dense smoke advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 77824, + "priority" => 69632, ], "small craft advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_MARINE", - "priority" => 78848, + "priority" => 70656, ], "brisk wind advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_MARINE", - "priority" => 79872, + "priority" => 71680, ], "hazardous seas warning" => [ "level" => "ALERT_LEVEL_WARNING", "kind" => "ALERT_KIND_MARINE", - "priority" => 80896, + "priority" => 72704, ], "dust advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_OTHER", - "priority" => 81920, + "priority" => 73728, ], "blowing dust advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 82944, + "priority" => 74752, ], "lake wind advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 83968, + "priority" => 75776, ], "wind advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 84992, + "priority" => 76800, ], "frost advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 86016, - ], - "ashfall advisory" => [ - "level" => "ALERT_LEVEL_OTHER", - "kind" => "ALERT_KIND_LAND", - "priority" => 87040, + "priority" => 77824, ], "freezing fog advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 88064, + "priority" => 78848, ], "freezing spray advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_MARINE", - "priority" => 89088, + "priority" => 79872, ], "low water advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_MARINE", - "priority" => 90112, + "priority" => 80896, ], "local area emergency" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 91136, - ], - "avalanche watch" => [ - "level" => "ALERT_LEVEL_WATCH", - "kind" => "ALERT_KIND_LAND", - "priority" => 92160, + "priority" => 81920, ], - "blizzard watch" => [ + "winter storm watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_LAND", - "priority" => 93184, + "priority" => 82944, ], "rip current statement" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 94208, + "priority" => 83968, ], "beach hazards statement" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 95232, + "priority" => 84992, ], "gale watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_MARINE", - "priority" => 96256, + "priority" => 86016, ], - "winter storm watch" => [ + "avalanche watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_LAND", - "priority" => 97280, + "priority" => 87040, ], "hazardous seas watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_MARINE", - "priority" => 98304, + "priority" => 88064, ], "heavy freezing spray watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_MARINE", - "priority" => 99328, + "priority" => 89088, ], - "coastal flood watch" => [ + "flood watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_LAND", - "priority" => 100352, + "priority" => 90112, ], - "lakeshore flood watch" => [ + "coastal flood watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_LAND", - "priority" => 101376, + "priority" => 91136, ], - "flood watch" => [ + "lakeshore flood watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_LAND", - "priority" => 102400, + "priority" => 92160, ], "high wind watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_LAND", - "priority" => 103424, + "priority" => 93184, ], "excessive heat watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_LAND", - "priority" => 104448, + "priority" => 94208, ], "extreme cold watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_LAND", - "priority" => 105472, - ], - "wind chill watch" => [ - "level" => "ALERT_LEVEL_WATCH", - "kind" => "ALERT_KIND_LAND", - "priority" => 106496, - ], - "lake effect snow watch" => [ - "level" => "ALERT_LEVEL_WATCH", - "kind" => "ALERT_KIND_LAND", - "priority" => 107520, - ], - "hard freeze watch" => [ - "level" => "ALERT_LEVEL_WATCH", - "kind" => "ALERT_KIND_MARINE", - "priority" => 108544, + "priority" => 95232, ], "freeze watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_LAND", - "priority" => 109568, + "priority" => 96256, ], "fire weather watch" => [ "level" => "ALERT_LEVEL_WATCH", "kind" => "ALERT_KIND_LAND", - "priority" => 110592, + "priority" => 97280, ], "extreme fire danger" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 111616, + "priority" => 98304, ], "911 telephone outage" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 112640, + "priority" => 99328, ], "coastal flood statement" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 113664, + "priority" => 100352, ], "lakeshore flood statement" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 114688, + "priority" => 101376, ], "special weather statement" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 115712, + "priority" => 102400, ], "marine weather statement" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_MARINE", - "priority" => 116736, + "priority" => 103424, ], "air quality alert" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 117760, + "priority" => 104448, ], "air stagnation advisory" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 118784, + "priority" => 105472, ], "hazardous weather outlook" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 119808, + "priority" => 106496, ], "hydrologic outlook" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 120832, + "priority" => 107520, ], "short term forecast" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 121856, + "priority" => 108544, ], "administrative message" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 122880, + "priority" => 109568, ], "test" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 123904, + "priority" => 110592, ], "child abduction emergency" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_LAND", - "priority" => 124928, + "priority" => 111616, ], "blue alert" => [ "level" => "ALERT_LEVEL_OTHER", "kind" => "ALERT_KIND_OTHER", - "priority" => 125952, - ], + "priority" => 112640, + ] ]; public static function getAlertTypes() diff --git a/web/modules/weather_data/src/Service/Test/AlertUtility.php.test b/web/modules/weather_data/src/Service/Test/AlertUtility.php.test index d5cc41b21..209c322f5 100644 --- a/web/modules/weather_data/src/Service/Test/AlertUtility.php.test +++ b/web/modules/weather_data/src/Service/Test/AlertUtility.php.test @@ -95,8 +95,8 @@ final class AlertUtilityTest extends TestCase $expected = [ $alerts[3], // active tornado warning - $alerts[2], // active volcano warning - $alerts[4], // active dust storm warning + $alerts[4], // active volcano warning + $alerts[2], // active dust storm warning $alerts[0], // active flood watch $alerts[1], // next hour air quality alert $alerts[5], // in two hours volcano warning diff --git a/web/modules/weather_data/src/Service/Test/Satellite.php.test b/web/modules/weather_data/src/Service/Test/Satellite.php.test index 3abdc7045..8cd0cf6e8 100644 --- a/web/modules/weather_data/src/Service/Test/Satellite.php.test +++ b/web/modules/weather_data/src/Service/Test/Satellite.php.test @@ -95,8 +95,8 @@ final class SatelliteTest extends TestCase $expected = [ $alerts[3], // active tornado warning - $alerts[2], // active volcano warning - $alerts[4], // active dust storm warning + $alerts[4], // active volcano warning + $alerts[2], // active dust storm warning $alerts[0], // active flood watch $alerts[1], // next hour air quality alert $alerts[5], // in two hours volcano warning diff --git a/web/themes/new_weather_theme/assets/js/components/alertMap.js b/web/themes/new_weather_theme/assets/js/components/alertMap.js index c6476064b..f31761378 100644 --- a/web/themes/new_weather_theme/assets/js/components/alertMap.js +++ b/web/themes/new_weather_theme/assets/js/components/alertMap.js @@ -131,6 +131,11 @@ const checkForLeaflet = () => { // If addEventListener is called multiple times with identical arguments, // the listener will only be added the first time. So, it's safe to just // keep doing this until we're done. + // + // It's also possible that we got here before the DOM load event, in which + // case the Leaflet, ESRI, and ESRI vector script tags may not even be + // present yet. So... wait on that as well! + document.addEventListener("DOMContentLoaded", checkForLeaflet); document .querySelector("[data-wx-leaflet]") ?.addEventListener("load", checkForLeaflet); diff --git a/web/themes/new_weather_theme/new_weather_theme.libraries.yml b/web/themes/new_weather_theme/new_weather_theme.libraries.yml index 86f7785d5..c29196793 100644 --- a/web/themes/new_weather_theme/new_weather_theme.libraries.yml +++ b/web/themes/new_weather_theme/new_weather_theme.libraries.yml @@ -63,12 +63,15 @@ leaflet: https://unpkg.com/leaflet@1.9.4/dist/leaflet.js: attributes: defer: true + id: data-wx-leaflet https://unpkg.com/esri-leaflet@3.0.12/dist/esri-leaflet.js: attributes: defer: true + id: data-wx-leaflet-esri https://unpkg.com/esri-leaflet-vector@4.2.3/dist/esri-leaflet-vector.js: attributes: defer: true + id: data-wx-leaflet-esri-vector digital-analytics-program: header: true diff --git a/web/themes/new_weather_theme/templates/partials/satellite.html.twig b/web/themes/new_weather_theme/templates/partials/satellite.html.twig index 40edf21c3..4a5be824c 100644 --- a/web/themes/new_weather_theme/templates/partials/satellite.html.twig +++ b/web/themes/new_weather_theme/templates/partials/satellite.html.twig @@ -14,8 +14,12 @@
-