Skip to content

Migrate Public Data Sharing settings page to Angular - #77

Open
nllong wants to merge 5 commits into
mainfrom
feature/organization-sharing-migration
Open

Migrate Public Data Sharing settings page to Angular#77
nllong wants to merge 5 commits into
mainfrom
feature/organization-sharing-migration

Conversation

@nllong

@nllong nllong commented Jul 30, 2026

Copy link
Copy Markdown
Member

Summary

Ports the legacy AngularJS Organization Sharing page (/accounts/:organization_id/sharing) to this app under organizations/settings/sharing, per MIGRATION.md.

  • New SharingComponent: public feed status banner (link to Options to enable/disable), collapsible URL/query-param docs (JSON/HTML, GeoJSON when enabled), a working Public Query Threshold field (the legacy page fetched this value but never actually rendered a control for it), a searchable/filterable public column-selection table with select-all/indeterminate state, owner + is_parent permission gating (reuses UserService.auth$), loading/error/success states, save -> reload, dark mode, and responsive layout.
  • Reuses existing /api/v3/ endpoints only -- no backend changes:
    • OrganizationService.getSharedFields() -> organizations/{id}/shared_fields/
    • OrganizationService.getQueryThreshold() -> organizations/{id}/query_threshold/
    • AnalysisService.getUsedColumns() -> analyses/used_columns/
    • Save reuses the existing OrganizationService.updateSettings() -> organizations/{id}/save_settings/
  • Route + nav entry added under Organization Settings.
  • Added the ~12 Transloco keys that were missing (reused ~30 existing legacy strings for the rest).
  • Updated MIGRATION.md and .github/copilot-instructions.md status lists.

Screenshots

Overall page (public feed enabled, query threshold set, fields populated from seeded data):

Organization Sharing overview

Field search/filter + select-all (indeterminate state) interaction:

Field search and selection interaction

Validation

  • pnpm lint and pnpm build pass.
  • Live-tested end-to-end against a throwaway Docker backend with seeded property/tax lot data via Playwright: save/reload round-trip, field search + select-all, query-threshold validation, non-owner permission block, dark mode, and mobile layout.

Files touched

  • src/app/modules/organizations/settings/sharing/sharing.component.ts and .html (new)
  • src/app/modules/organizations/settings/settings.routes.ts and settings.component.ts
  • src/@seed/api/organization/organization.service.ts and organization.types.ts
  • src/@seed/api/analysis/analysis.service.ts and analysis.types.ts
  • public/i18n/en_US.json
  • MIGRATION.md, .github/copilot-instructions.md

Remaining risks

  • New Transloco keys were added to en_US.json for local dev but still need to be registered in Lokalise (source of truth) before the next pnpm update-translations pull, or they'll be overwritten.
  • Legacy AngularJS organization_sharing route/controller/partial were left untouched, per migration convention.

Update: "Add a field" + public URL test buttons

Follow-up based on review feedback that it wasn't clear how to add a new column to the public
list, and that testing the public feed URLs required manual copy/paste.

  • Add a field: the table previously only listed columns already populated with data
    (analyses/used_columns/). Added an "Add a field" autocomplete (backed by the existing
    ColumnService.getPropertyColumns() -> /api/v3/columns/ endpoint, same one used by the Column
    Settings page) that lists every Property/Tax Lot column in the org and appends the picked one as
    a new (unchecked) row -- so a field without data yet can still be marked public and saved.
  • Also fixed a latent edge case while touching this: a column already marked public that later
    lost all its data would silently fall out of used_columns and get unshared on the next save;
    it's now kept in the list instead.
  • Test buttons: added icon buttons next to the public JSON and HTML feed URLs that open them
    in a new tab. Discovered along the way that a plain <a target="_blank"> to these (same-origin)
    URLs was being silently downgraded back to same-tab navigation by the app-wide
    ExternalLinkDirective (it only forces a new tab for cross-origin links) -- worked around with
    an explicit window.open() call instead.
  • Clarified the in-template comments/help text and PUBLIC_SHARE_FIELDS_HELP copy to explain how
    the row list is populated and how to add to it.
  • New Transloco keys added to en_US.json.

Screenshots

Updated page with the "Add a field" control and public-URL "Test" buttons:

Updated Organization Sharing page

Typing in "Add a field" filters the org's full column catalog (not just used ones):

Add a field autocomplete

"Test" buttons next to the public JSON/HTML feed URLs:

Test URL buttons

Validation

  • pnpm lint and pnpm build pass.
  • Live-tested against this environment's real backend/data via Playwright: added an unused column
    via the new autocomplete, checked it and confirmed it lands in the save payload; clicked both
    "Test" buttons and confirmed each opens a distinct new tab with real feed data (no console
    errors, verified via browser_tabs/browser_console_messages).

- Add SharingComponent under organizations/settings/sharing: public feed
  status banner, collapsible URL/query-param docs (JSON/HTML/GeoJSON),
  a working Public Query Threshold field (legacy fetched but never
  rendered it), searchable/filterable public column-selection table with
  select-all, owner + is_parent permission gating, loading/error/success
  states, save/reload, dark mode, and responsive layout.
- Add OrganizationService.getSharedFields()/getQueryThreshold() and
  AnalysisService.getUsedColumns(), reusing existing v3 endpoints
  (organizations/{id}/shared_fields, organizations/{id}/query_threshold,
  analyses/used_columns) and the existing updateSettings() save flow.
  No new backend endpoints added.
- Wire up route + nav entry in organizations/settings.
- Add missing Transloco keys to public/i18n/en_US.json (reused ~30
  existing legacy strings, added 12 new ones for parity/validation).
- Update MIGRATION.md and copilot-instructions.md to move Organization
  Sharing from "not yet migrated" to "already migrated".

Validated with pnpm lint / pnpm build, and live-tested end-to-end
(save/reload, validation, non-owner permission block, dark mode,
mobile layout) against a throwaway backend with seeded property/tax
lot data via Playwright.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nllong added a commit to SEED-platform/seed that referenced this pull request Jul 30, 2026
Points at SEED-platform/seed-angular#77, which ports the legacy
Organization Sharing settings page (/accounts/:organization_id/sharing)
to the new Angular app under organizations/settings/sharing. No
backend/legacy AngularJS changes; reuses existing v3 endpoints only.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…t buttons

- SharingComponent now also fetches the org's full column catalog
  (ColumnService) so an "Add a field" autocomplete can append any
  Property/Tax Lot column to the sharable list, even ones without data yet
  (previously the table only showed already-populated "used" columns).
- Also keeps a previously-shared column visible even if its data was later
  cleared, instead of silently unsharing it on save.
- Added icon-button "Test" controls next to the public JSON/HTML feed URLs
  that open them in a new tab via window.open() (a plain <a target="_blank">
  gets overridden back to same-tab by the app-wide ExternalLinkDirective for
  same-origin links).
- Clarified in-template documentation/comments and the PUBLIC_SHARE_FIELDS_HELP
  copy on how rows are populated and how to add new ones.
- Added new Transloco keys to en_US.json.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Ports the legacy Organization Sharing settings page into the Angular app under organizations/settings/sharing, including public feed URL documentation, query-threshold configuration, and a field-sharing selection UI backed by existing /api/v3/ endpoints.

Changes:

  • Added a new Organization Sharing settings route + navigation entry under Organization Settings.
  • Implemented a new Sharing settings UI (public feed status, URL docs/test buttons, query threshold form, sharable-fields table + “Add a field” autocomplete).
  • Extended API layer types/services to fetch shared fields, query threshold, and “used columns” for the sharing UI.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/app/modules/organizations/settings/sharing/sharing.component.ts New Sharing page component: loads sharing data, handles filtering/selection, saves org settings.
src/app/modules/organizations/settings/sharing/sharing.component.html New Sharing page template: public feed status/docs, query threshold input, add-field autocomplete, share table + actions.
src/app/modules/organizations/settings/settings.routes.ts Adds the /organizations/settings/sharing route.
src/app/modules/organizations/settings/settings.component.ts Adds the Sharing entry to the settings navigation list.
src/@seed/api/organization/organization.types.ts Adds query_threshold/public_fields to Organization and defines shared-fields + query-threshold response types.
src/@seed/api/organization/organization.service.ts Adds getSharedFields() and getQueryThreshold() API methods.
src/@seed/api/analysis/analysis.types.ts Adds UsedColumn/UsedColumnsResponse types for the used-columns endpoint.
src/@seed/api/analysis/analysis.service.ts Adds getUsedColumns() API method for the sharing UI.
public/i18n/en_US.json Adds new Transloco keys used by the Sharing page UI.
MIGRATION.md Marks Organization Sharing as migrated and updates the route mapping notes.
.github/copilot-instructions.md Updates the migration status snapshot to include Organization Sharing.
Suppressed comments (2)

src/app/modules/organizations/settings/sharing/sharing.component.html:200

  • Each per-row mat-checkbox has no accessible label, so assistive tech can’t tell which field is being shared. Add an aria-label that includes the field’s display name.
                          <mat-checkbox [(ngModel)]="field.public_checked" [ngModelOptions]="{ standalone: true }"></mat-checkbox>

src/app/modules/organizations/settings/sharing/sharing.component.html:95

  • This heading is user-visible but isn’t passed through Transloco on a newly migrated page. Wrap it with t(...) so it can be localized consistently.
                    <h3>GeoJSON</h3>

Comment thread src/app/modules/organizations/settings/sharing/sharing.component.ts
Comment thread src/app/modules/organizations/settings/sharing/sharing.component.ts Outdated
Comment thread src/app/modules/organizations/settings/sharing/sharing.component.ts
Comment thread src/app/modules/organizations/settings/sharing/sharing.component.html Outdated
nllong and others added 3 commits July 31, 2026 06:29
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@nllong nllong changed the title Migrate Organization Sharing settings page to Angular Migrate Public Data Sharing settings page to Angular Aug 2, 2026
@nllong
nllong requested a review from kflemin August 2, 2026 14:30
@nllong nllong added enhancement New feature or request and removed enhancement New feature or request labels Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants