This commit introduces foundational changes to enable handling multiple rundowns within a single project.
Key changes:
- `rundown.dao.ts`:
- Replaced single global rundown cache with Map-based caches for rundowns, metadata, and custom field usage, keyed by RundownId.
- Updated `init`, getters, and transaction logic to operate on specific RundownIds.
- Added `removeRundownFromCache`.
- Basic unit tests for DAO operations implemented.
- `ProjectService.ts`:
- `loadProject` now initializes all rundowns from a project file into the DAO.
- `patchCurrentProject` updated to sync multiple rundowns with the DAO (add/update/remove from cache).
- Added new CRUD methods: `getAvailableRundownsInCurrentProject`, `createNewRundownInCurrentProject`, `deleteRundownFromCurrentProject`, `updateRundownMetadataInCurrentProject`.
- `RuntimeService.ts`:
- Introduced `activeRundownId` state.
- Implemented `setActiveRundown`, `clearActiveRundown`, `getActiveRundownId`.
- DAO calls within service now use `activeRundownId`.
- `notifyOfChangedEvents` now filters by active rundown.
- `RestorePoint` type and save/resume logic updated to include `rundownId`.
- Enhanced state reset in `runtimeState.ts` and `RuntimeService` for rundown context switching.
- `AppStateService.ts`:
- Extended `AppState` to persist `lastActiveRundowns` (map of projectFileName to last active RundownId).
- Added methods to manage this persisted preference.
- API Layer (Conceptual Outline):
- Project loading to make all rundowns available and activate last active.
- New CRUD APIs for rundowns within a project.
- New API for runtime activation (`/runtime/activate_rundown`).
- Existing runtime APIs to use activated context.
- Editing APIs to explicitly target `rundownId`.
Further work will involve implementing the API layer changes and comprehensively updating/writing tests across the application to align with this new architecture.
* adding block now/next data
* add to ui
* add blockNext
* indicate in UI
* fix test
* restore block start at value
* one loop
* stricter null comparison
* test fails
* dev throw if id cant be found
* fix spelling
* revert client stuff
* rename
* add comment
* change load to use metadata
* update roll to use metadata
* remove filterTimedEvents
* add comment
* atempth to refactor rollUtils
* refactor util functions
* refactor: WS
* refactor refetch
extract refetch keys to package/types
auto invalidata all keys
use refetch keys for project data
no need for constant update of info, just fetch when looking at it
split refetch and query keys
rename types
* refactor viewSettings
* fixup! refactor: WS
* rearange files and make types for api calls
* cleanup viewsettings
* switch exhaustiveCheck
* combine send socket function
* exhaustive check
* rename type to tag
* fixup! fixup! refactor: WS
* remove custom etag solution
* get errors from socket
* lint
* small change
---------
Co-authored-by: Carlos Valente <carlosvalente@pm.me>