Skip to content

Auto-detect single vs multi-zone center from AFP during provisioning #999

@rchlfryn

Description

@rchlfryn

Summary

When provisioning a new avalanche center, we should automatically check the AFP (Avalanche Forecast Program) data to determine if the center is a single-zone or multi-zone operation and provision accordingly.

Currently, provisioning creates the same 7 built-in pages regardless of zone count. Zone-aware navigation is handled dynamically at runtime (src/components/Header/utils.ts), but the built-in pages created during provisioning should also differ.

Areas to update

  • src/collections/Tenants/endpoints/provisionTenant.ts — Query AFP via getActiveForecastZones() from src/services/nac/nac.ts to determine zone count, then create the appropriate built-in pages:
    • Single zone: Create /forecasts/avalanche/{zone} page
    • Multi-zone: Create /forecasts/avalanche (all forecasts) + one page per zone at /forecasts/avalanche/{zone}
  • docs/onboarding.md — Already documents the single vs multi-zone difference (lines 22-34), update if provisioning handles this automatically
  • Filter built-in pages using DVAC navigationextractNavReferences (in provisionTenant.ts) already extracts builtInPageUrls from the template navigation. Use this to filter BUILT_IN_PAGES so only navigation-referenced built-in pages are created, matching how pages are already filtered. See TODO comments in provisionTenant.ts and onboardingActions.ts referencing Make automated topLevelNavItems use built-in pages & nav improvements #1002.

Context

From the onboarding provisioning PR — zone configuration was identified as something that could be automated rather than manually configured. The NAC API already provides zone data via getActiveForecastZones(centerSlug).

Acceptance Criteria

  • Query AFP data during provisioning to determine zone count
  • Create zone-specific built-in pages based on single vs multi-zone
  • Filter built-in pages to those referenced in DVAC's navigation (use navBuiltInPageUrls from extractNavReferences)
  • Handle cases where AFP data is unavailable (fall back to manual configuration)
  • Update onboarding docs to reflect automation

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions