Skip to content

UI - business-ui: Refactor Manager components #35125

Open
6 of 6 issues completed
Open

Description

@deetz99

This is a parent ticket to align all 'manage' functionality.

IMPORTANT: Additional changes may be asked in the child tickets relevant to that specific item.

Each child ticket should update the relevant Manager's component, composable and other required changes at the same time (May require schema or util changes).

In order to keep our projects maintainable, we should aim to stay consistent across components and composables. There are also some new patterns to help keep things consistent.

Directory structure

  • Components to be moved under 'Manage' directory. eg components/ManageOffices/index.vue -> components/Manage/Offices/index.vue
  • Composables to be moved under 'manage' directory. eg composables/useManageOffices.ts -> composables/manage/useManageOffices.ts

Composable Refactor

See useManageOffices for conventions.

  • Add optional opts param with optional cleanupFn property
  • Handle tableState only (not adding or expanded state)
  • Clone objects using cloneDeep (not structuredClone or json.parse/stringify)
    • this will preserve typing lost by json.parse and prevent unhandled errors cause by vue proxies in structuredClone
  • Update table should accept 1 argument and find the row to update via item.new.id
  • Rename methods/params/whatever else to use generic subject naming
  • When applying edited actions, use isEqualOmit to exclude non-editable fields (id, actions, etc)

Component Refactor

See ManageOffices for conventions.

  • Expanded state should be handled at the Manage component level
  • Adding state should be handled at the component level
  • Use useManageCommon for the variants, allowed actions, setActiveAlerts. label overrides, etc
  • Update naming to use generic 'subject' suffix where applicable (functions, refs, computeds, etc)
  • Update table component get-row-id prop :get-row-id="(row: TableBusinessState<T>) => row.new.id" (may require schema change)
  • Update props interface to include preventActions and actionPreventedSignal instead of using TS intersection
  • Clone objects using cloneDeep (not structuredClone or json.parse/stringify) for the same reason as the composables
  • Pass cleanup function to composable and let composable handle the callback (removes need for wrapper functions in component)
  • Remove required from defineModel options (active subjects are allowed to be undefined)
  • activeSubject defineModel should use 'active-subject' key
  • 'subject' prop should be optional

Implementation Refactor - IMPORTANT

  • Only if necessary - update usage in playground examples and current filings
    • May require schema changes (eg parties in corrections should all use the same model ref)
  • Ensure all current tests pass, dev to add additional at their discretion
  • Dev to ensure they do not introduce new bugs into any current filings (init, save and resume, typecheck, tests, etc should all still work correctly after refactor)

Sub-issues

Sub-issues

6 of 6 Issues completed
Loading 6 sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Colin EgressNuxt Layers

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions