Skip to content

Commit

Permalink
Merge branch 'main' into jt/overwrite-weather-stories
Browse files Browse the repository at this point in the history
  • Loading branch information
jamestranovich-noaa authored Nov 27, 2024
2 parents 97e488b + 14c2c74 commit b90980a
Show file tree
Hide file tree
Showing 28 changed files with 728 additions and 240 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
/web/sites/*/settings*.php
/web/sites/*/services*.yml

# Ignore user interface translations
/web/config/sync/language/

# Ignore paths that contain user-generated content.
/web/sites/*/files
/web/sites/*/private
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ shell: ## Get a shell inside the Drupal container

ut: update-translations ## Update Drupal from local .po translation files
update-translations:
docker compose exec drupal drush locale:clear-status
docker compose exec drupal drush locale:update
docker compose exec drupal drush locale:import-all /opt/drupal/web/modules/weather_i18n/translations/
docker compose exec drupal drush cache:rebuild
zap-init: update-settings zap-containers rebuild pause install-site import-spatial load-spatial ## Delete the entire Docker environment and start from scratch.
zap: update-settings dump-spatial zap-containers rebuild pause install-site import-spatial load-spatial ## Delete the entire Docker environment and start from scratch.
Expand Down
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,13 @@ Languages and frameworks: PHP, Symfony, Twig
Docker does all the heavy lifting for set up and configurations. It's a cinch to get up and running. Make sure you have Docker installed locally.

1. Clone this repository into a new directory and `cd` into it.
2. Run `docker compose up` from the command line. Alternatively, install the
[Docker plugin](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker)
in VSCode, then right click on the docker-compose.yml and select **Compose
Up**.
3. Install our site configuration by running `make install-site`.
4. Browse to [http://localhost:8080](http://localhost:8080) in your broswer. You
should see a 404 page because we haven't defined any content. That's okay.
5. Browse to [http://localhost:8080/user/login](http://localhost:8080/user/login)
1. Run `make zap-init` from the command line. (Run `make zap` later on to restore to a clean state.)
1. Browse to [http://localhost:8080](http://localhost:8080) in your broswer. You
should see the home page of beta.weather.gov. That's okay.
1. Browse to [http://localhost:8080/user/login](http://localhost:8080/user/login)
to log in. Your username is `admin` and your password is `root`. Then you can
do stuff!
1. (optional) Install the node modules (`npm install`) into your node environment of choice.

## Editing and adding themes

Expand Down
6 changes: 6 additions & 0 deletions api-interop-layer/data/alerts/backgroundUpdateTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ export const updateAlerts = async ({ parent = parentPort } = {}) => {
kind: "land",
priority: Number.MAX_SAFE_INTEGER,
};

if (/\bevacuation\b/i.test(rawAlert.properties.event)) {
// For any alert with the word "evacuation", pin it to the same metadata
// as the NWS-defined evacuation alert.
alert.metadata = alertKinds.get("evacuation immediate");
}
}

// For now, we're only ingesting land alerts. Once we get into marine
Expand Down
38 changes: 38 additions & 0 deletions api-interop-layer/data/alerts/backgroundUpdateTask.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,44 @@ describe("alert background processing module", () => {
});
});

it("prioritizes unknown 'evacuation' alerts correctly", async () => {
response.json.resolves({
features: [
{
geometry: "geo",
properties: {
id: "one",
event: "Pasta Sauce Evacuation Emergency",
sent: dayjs().subtract(1, "minute").toISOString(),
effective: dayjs().subtract(1, "minute").toISOString(),
onset: dayjs().subtract(1, "minute").toISOString(),
expires: dayjs().add(1, "minute").toISOString(),
ends: dayjs().add(1, "minute").toISOString(),
},
},
],
});

await updateAlerts({ parent });

const newAlerts = getNewAlertsMessages();
const [
{
alert: { event, metadata },
},
] = newAlerts[0];

expect(event).to.equal("Pasta Sauce Evacuation Emergency");
expect(metadata).to.eql({
level: {
priority: 2048,
text: "other",
},
kind: "land",
priority: 8192,
});
});

it("posts an error if it encounters a problem", async () => {
fetch.rejects();

Expand Down
15 changes: 7 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"devDependencies": {
"@axe-core/playwright": "^4.10.1",
"@playwright/test": "^1.48.2",
"@types/node": "^22.9.0",
"@types/node": "^22.9.4",
"axe-core": "^4.10.2",
"chai": "^5.1.2",
"dayjs": "^1.11.13",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ resourceFields:
publicName: field_cwa_center_lon
enhancer:
id: ''
field_derived_wfo:
disabled: false
fieldName: field_derived_wfo
publicName: field_derived_wfo
enhancer:
id: ''
field_description:
disabled: false
fieldName: field_description
Expand Down Expand Up @@ -230,12 +236,6 @@ resourceFields:
publicName: field_starttime
enhancer:
id: ''
field_title:
disabled: false
fieldName: field_title
publicName: field_title
enhancer:
id: ''
field_weburl:
disabled: false
fieldName: field_weburl
Expand Down
11 changes: 11 additions & 0 deletions web/config/sync/language.content_settings.block_content.basic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
uuid: 69332094-c409-4ffd-8a04-522f7b44b042
langcode: en
status: true
dependencies:
config:
- block_content.type.basic
id: block_content.basic
target_entity_type_id: block_content
target_bundle: basic
default_langcode: site_default
language_alterable: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
uuid: 6c852100-03a4-46e0-804a-5bbce73a1361
langcode: en
status: true
dependencies:
config:
- block_content.type.no_title_block
id: block_content.no_title_block
target_entity_type_id: block_content
target_bundle: no_title_block
default_langcode: site_default
language_alterable: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
uuid: e2acc1ca-f204-4161-bc8d-9f2d6de04d8a
langcode: en
status: true
dependencies:
module:
- content_moderation
id: content_moderation_state.content_moderation_state
target_entity_type_id: content_moderation_state
target_bundle: content_moderation_state
default_langcode: site_default
language_alterable: false
11 changes: 11 additions & 0 deletions web/config/sync/language.content_settings.file.file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
uuid: 2c7651a5-4f11-44da-859c-9ae71e135cff
langcode: en
status: true
dependencies:
module:
- file
id: file.file
target_entity_type_id: file
target_bundle: file
default_langcode: site_default
language_alterable: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
uuid: dfed78ea-0146-4b6d-8b0a-122ea1fcfd42
langcode: en
status: true
dependencies:
module:
- menu_link_content
id: menu_link_content.menu_link_content
target_entity_type_id: menu_link_content
target_bundle: menu_link_content
default_langcode: site_default
language_alterable: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
uuid: 30c1dc77-3d1f-4777-940e-2285e0ea9415
langcode: en
status: true
dependencies:
config:
- node.type.dynamic_safety_information
id: node.dynamic_safety_information
target_entity_type_id: node
target_bundle: dynamic_safety_information
default_langcode: site_default
language_alterable: false
11 changes: 11 additions & 0 deletions web/config/sync/language.content_settings.node.page.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
uuid: b743cc08-c9c8-4061-a4fc-0940569c639a
langcode: en
status: true
dependencies:
config:
- node.type.page
id: node.page
target_entity_type_id: node
target_bundle: page
default_langcode: site_default
language_alterable: false
11 changes: 11 additions & 0 deletions web/config/sync/language.content_settings.node.testing_page.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
uuid: f98aea4f-326b-483d-88cc-fb71970be980
langcode: en
status: true
dependencies:
config:
- node.type.testing_page
id: node.testing_page
target_entity_type_id: node
target_bundle: testing_page
default_langcode: site_default
language_alterable: false
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ _core:
id: path_alias.path_alias
target_entity_type_id: path_alias
target_bundle: path_alias
default_langcode: und
default_langcode: site_default
language_alterable: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
uuid: 9ded0194-732f-438e-a678-c4edcac7544a
langcode: en
status: true
dependencies:
config:
- taxonomy.vocabulary.weather_event_types
id: taxonomy_term.weather_event_types
target_entity_type_id: taxonomy_term
target_bundle: weather_event_types
default_langcode: site_default
language_alterable: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
uuid: 7542789c-3e63-48be-8f0f-fdf63950f511
langcode: en
status: true
dependencies:
config:
- taxonomy.vocabulary.weather_forecast_offices
id: taxonomy_term.weather_forecast_offices
target_entity_type_id: taxonomy_term
target_bundle: weather_forecast_offices
default_langcode: site_default
language_alterable: false
11 changes: 11 additions & 0 deletions web/config/sync/language.content_settings.user.user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
uuid: 382dfec0-6912-4208-84d6-03a5886ed6ae
langcode: en
status: true
dependencies:
module:
- user
id: user.user
target_entity_type_id: user
target_bundle: user
default_langcode: site_default
language_alterable: false
9 changes: 9 additions & 0 deletions web/config/sync/language.entity.zh-hans.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
uuid: efa355e9-b8bc-4310-9ca3-d4c27a621fd5
langcode: en
status: true
dependencies: { }
id: zh-hans
label: 'Chinese, Simplified'
direction: ltr
weight: 1
locked: false
2 changes: 2 additions & 0 deletions web/config/sync/language.negotiation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ url:
source: path_prefix
prefixes:
en: ''
zh-hans: zh-hans
domains:
en: ''
zh-hans: ''
selected_langcode: site_default
Loading

0 comments on commit b90980a

Please sign in to comment.