mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 23:19:09 +00:00
refactor: start with small runtimedata subset
This commit is contained in:
committed by
Carlos Valente
parent
eb0e5e6420
commit
c333117347
@@ -1,11 +1,4 @@
|
|||||||
import {
|
import { Automation, AutomationDTO, CustomFields, TimerLifeCycle, Trigger } from 'ontime-types';
|
||||||
Automation,
|
|
||||||
AutomationDTO,
|
|
||||||
CustomFields,
|
|
||||||
OntimeEvent,
|
|
||||||
TimerLifeCycle,
|
|
||||||
Trigger,
|
|
||||||
} from 'ontime-types';
|
|
||||||
|
|
||||||
type CycleLabel = {
|
type CycleLabel = {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -33,30 +26,28 @@ export function isAutomation(automation: AutomationDTO | Automation): automation
|
|||||||
return Object.hasOwn(automation, 'id');
|
return Object.hasOwn(automation, 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
export const staticSelectProperties = [
|
const staticSelectProperties = [
|
||||||
{ value: 'id', label: 'ID' },
|
{ value: 'eventNow.id', label: 'ID' },
|
||||||
{ value: 'title', label: 'Title' },
|
{ value: 'eventNow.title', label: 'Title' },
|
||||||
{ value: 'cue', label: 'Cue' },
|
{ value: 'eventNow.cue', label: 'Cue' },
|
||||||
{ value: 'countToEnd', label: 'Count to end' },
|
{ value: 'eventNow.countToEnd', label: 'Count to end' },
|
||||||
{ value: 'isPublic', label: 'Is public' },
|
{ value: 'eventNow.isPublic', label: 'Is public' },
|
||||||
{ value: 'skip', label: 'Skip' },
|
{ value: 'eventNow.note', label: 'Note' },
|
||||||
{ value: 'note', label: 'Note' },
|
{ value: 'eventNow.colour', label: 'Colour' },
|
||||||
{ value: 'colour', label: 'Colour' },
|
|
||||||
{ value: 'endAction', label: 'End action' },
|
|
||||||
{ value: 'timerType', label: 'Timer type' },
|
|
||||||
{ value: 'timeWarning', label: 'Time warning' },
|
|
||||||
{ value: 'timeDanger', label: 'Time danger' },
|
|
||||||
];
|
];
|
||||||
|
|
||||||
type SelectableField = {
|
type SelectableField = {
|
||||||
value: keyof OntimeEvent | string; // string for custom fields
|
value: string; // string encodes path in runtime state object
|
||||||
label: string;
|
label: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function makeFieldList(customFields: CustomFields): SelectableField[] {
|
export function makeFieldList(customFields: CustomFields): SelectableField[] {
|
||||||
return [
|
return [
|
||||||
...staticSelectProperties,
|
...staticSelectProperties,
|
||||||
...Object.entries(customFields).map(([key, { label }]) => ({ value: key, label: `Custom: ${label}` })),
|
...Object.entries(customFields).map(([key, { label }]) => ({
|
||||||
|
value: `eventNow.custom.${key}`,
|
||||||
|
label: `Custom: ${label}`,
|
||||||
|
})),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user