feat(ui): Goals → Initiatives pages — list, detail, create/edit with teams and signals (G-P2-4)

Merged
EV
10d ago
+2303-1

What

G-P2-4 (UI): Goals → Initiatives. Part of the Gauzy ↔ Ever Works integration plan (06-gauzy-implementation-plan.md G-P2-4, decision D3b, in ever-co/homelab). Strategic Initiatives had a REST/GraphQL API but no Angular UI. Ever Works Missions will sync into them, so they need pages.

Builds on #10778 (initiative ↔ team links and teamIds). Until that merges, this diff also shows its commits.

WhereWhat
/pages/goals/initiatives (new lazy InitiativesModule)Lists the selected organization's initiatives the user may see. The server applies the leadership / organization / team visibility. Columns: title, state, visibility, directly linked teams, number of aligned projects, confidence, momentum. Add / Edit / Delete follow ORG_STRATEGIC_INITIATIVE_CREATE / _UPDATE / _DELETE. The route needs ORG_STRATEGIC_INITIATIVE_READ.
/pages/goals/initiatives/:idDetail page: intent, steward, state, visibility, signals (confidence, momentum, known risks, notes, last assessment), linked teams, aligned goals (with progress) and projects. Edit is shown by permission.
Create / edit dialogTitle, intent, state, visibility, steward (an organization employee), teams (multi-select → teamIds), and signals. Edits save the fields with PUT :id, then the signals with PUT :id/signals, which merges them and stamps the assessment.
MenuGoals → Initiatives (ORG_STRATEGIC_INITIATIVE_READ, under the Goals feature flag).
FavoritesA favorited initiative now opens its detail page instead of /pages/goals. favorite-links.routes.spec.ts resolves the new target.
ui-coreStrategicInitiativesService (list, get, create, update, signals, delete).
i18nSTRATEGIC_INITIATIVES.* (31 keys plus state, visibility, confidence and momentum labels) and MENU.INITIATIVES in all 14 language files, translated.

Nothing else changes for people who do not open the new pages.

Tests

  • initiatives.components.spec.ts (new). The three components compile against their templates (TestBed, jest-preset-angular):

    • the list loads the organization's initiatives and shows their teams;
    • create sends the trimmed title, teamIds and signals (risks one per line);
    • edit sends the fields, then the signals as one assessment;
    • the detail page shows intent, steward, teams, goals, projects and risks;
    • a malformed signals document reads as none.

    5 tests, all green.

  • favorite-links.routes.spec.ts (OrganizationStrategicInitiative → /pages/goals/initiatives/:id resolves) and the ui-core favorites specs (35) pass.

  • tsc -p apps/gauzy/tsconfig.app.json reports 0 errors.

  • The 30 node-only static gates and the egress static-hostname audit pass.

🤖 Generated with Claude Code


Summary by cubic

Adds Angular UI for strategic initiatives (G-P2-4 of the Gauzy ↔ Ever Works integration plan): list, detail, and create/edit pages under Goals → Initiatives, plus backend support to link initiatives directly to teams.

New Features

  • New lazy InitiativesModule at /pages/goals/initiatives lists the organization's initiatives with state, visibility, linked teams, projects, confidence, and momentum; add/edit/delete follow the ORG_STRATEGIC_INITIATIVE_* permissions.
  • A detail page (/pages/goals/initiatives/:id) shows intent, steward, state, visibility, signals, linked teams, aligned goals, and projects, with edit by permission; it edits with the initiative's own organization's employees and teams, whichever organization is selected.
  • The create/edit dialog takes title, intent, state, visibility, steward, teams (teamIds), and signals; edits save the fields, then the signals separately, and send cleared steward, confidence, and momentum as null so stored values are overwritten.
  • The list discards stale loads from earlier organization selections, and a favorited initiative now opens its detail page.

Backend and Migration

  • New many-to-many teams on OrganizationStrategicInitiative via migration 1791000000731 on Postgres, SQLite, and MySQL; on MySQL the pivot's foreign keys are created in one statement under a named lock whose name fits GET_LOCK's 64-character limit.
  • Links are set only through teamIds, each validated against the organization the initiative is saved in; updates replace the linkage when stated, moving to another organization without teamIds unlinks the old one's teams, and reads answer them on IOrganizationStrategicInitiativeRead.
  • visibilityScope: 'team' now includes members of directly linked teams.
  • New StrategicInitiativesService added to ui-core, with STRATEGIC_INITIATIVES.* translations across all 14 language files. New specs cover the components, the team-linking service, and the migration.