Custom fields views (#789)

* style: show field colour in editor

* feat: custom fields in cuesheet

* feat: custom fields in operator

* refactor: update CSV export
This commit is contained in:
Carlos Valente
2024-02-24 22:04:20 +01:00
committed by GitHub
parent 474f1e2177
commit da7ef59216
22 changed files with 229 additions and 539 deletions
@@ -17,7 +17,7 @@ import {
import { data, db } from '../../modules/loadDb.js';
import { safeMerge } from './DataProvider.utils.js';
import { isProduction } from '../../setup.js';
import { isTest } from '../../setup.js';
export class DataProvider {
static getData() {
@@ -110,7 +110,7 @@ export class DataProvider {
}
static async persist() {
if (!isProduction) {
if (isTest) {
return;
}
await db.write();
@@ -220,6 +220,7 @@ export function mutateCache<T extends object>(mutation: MutatingFn<T>) {
// TODO: should we trottle this?
// defer writing to the database
setImmediate(() => {
console.log('writing to database', persistedRundown.length)
DataProvider.setRundown(persistedRundown);
});
@@ -283,7 +284,6 @@ export function edit({ persistedRundown, eventId, patch }: EditArgs): Required<M
const eventInMemory = persistedRundown[indexAt];
const newEvent = makeEvent(eventInMemory, patch);
console.log('got', patch, 'will make', newEvent);
const newRundown = [...persistedRundown];
newRundown[indexAt] = newEvent;
+1 -1
View File
@@ -402,7 +402,7 @@ export function createPatch(originalEvent: OntimeEvent, patchEvent: Partial<Onti
revision: originalEvent.revision,
timeWarning: patchEvent.timeWarning ?? originalEvent.timeWarning,
timeDanger: patchEvent.timeDanger ?? originalEvent.timeDanger,
custom: patchEvent.custom ?? originalEvent.custom,
custom: { ...originalEvent.custom, ...patchEvent.custom },
};
}