mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-20 14:39:06 +00:00
refactor: remove stop as a possible end action
This commit is contained in:
@@ -102,7 +102,6 @@ export default function EditorSettingsForm() {
|
|||||||
onChange={(event) => setDefaultEndAction(event.target.value as EndAction)}
|
onChange={(event) => setDefaultEndAction(event.target.value as EndAction)}
|
||||||
>
|
>
|
||||||
<option value={EndAction.None}>None</option>
|
<option value={EndAction.None}>None</option>
|
||||||
<option value={EndAction.Stop}>Stop</option>
|
|
||||||
<option value={EndAction.LoadNext}>Load next</option>
|
<option value={EndAction.LoadNext}>Load next</option>
|
||||||
<option value={EndAction.PlayNext}>Play next</option>
|
<option value={EndAction.PlayNext}>Play next</option>
|
||||||
</Select>
|
</Select>
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import {
|
|||||||
IoPlay,
|
IoPlay,
|
||||||
IoPlayForward,
|
IoPlayForward,
|
||||||
IoPlaySkipForward,
|
IoPlaySkipForward,
|
||||||
IoStop,
|
|
||||||
IoTime,
|
IoTime,
|
||||||
} from 'react-icons/io5';
|
} from 'react-icons/io5';
|
||||||
import { Tooltip } from '@chakra-ui/react';
|
import { Tooltip } from '@chakra-ui/react';
|
||||||
@@ -177,9 +176,6 @@ function EndActionIcon(props: { action: EndAction; className: string }) {
|
|||||||
if (action === EndAction.PlayNext) {
|
if (action === EndAction.PlayNext) {
|
||||||
return <IoPlayForward className={maybeActiveClasses} />;
|
return <IoPlayForward className={maybeActiveClasses} />;
|
||||||
}
|
}
|
||||||
if (action === EndAction.Stop) {
|
|
||||||
return <IoStop className={maybeActiveClasses} />;
|
|
||||||
}
|
|
||||||
return <IoPlay className={className} />;
|
return <IoPlay className={className} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,6 @@ function EventEditorTimes(props: EventEditorTimesProps) {
|
|||||||
variant='ontime'
|
variant='ontime'
|
||||||
>
|
>
|
||||||
<option value={EndAction.None}>None</option>
|
<option value={EndAction.None}>None</option>
|
||||||
<option value={EndAction.Stop}>Stop rundown</option>
|
|
||||||
<option value={EndAction.LoadNext}>Load next event</option>
|
<option value={EndAction.LoadNext}>Load next event</option>
|
||||||
<option value={EndAction.PlayNext}>Play next event</option>
|
<option value={EndAction.PlayNext}>Play next event</option>
|
||||||
</Select>
|
</Select>
|
||||||
|
|||||||
@@ -128,9 +128,7 @@ class RuntimeService {
|
|||||||
// handle end action if there was a timer playing
|
// handle end action if there was a timer playing
|
||||||
// actions are added to the queue stack to ensure that the order of operations is maintained
|
// actions are added to the queue stack to ensure that the order of operations is maintained
|
||||||
if (newState.eventNow) {
|
if (newState.eventNow) {
|
||||||
if (newState.eventNow.endAction === EndAction.Stop) {
|
if (newState.eventNow.endAction === EndAction.LoadNext) {
|
||||||
setTimeout(this.stop.bind(this), 0);
|
|
||||||
} else if (newState.eventNow.endAction === EndAction.LoadNext) {
|
|
||||||
setTimeout(this.loadNext.bind(this), 0);
|
setTimeout(this.loadNext.bind(this), 0);
|
||||||
} else if (newState.eventNow.endAction === EndAction.PlayNext) {
|
} else if (newState.eventNow.endAction === EndAction.PlayNext) {
|
||||||
setTimeout(this.startNext.bind(this), 0);
|
setTimeout(this.startNext.bind(this), 0);
|
||||||
|
|||||||
@@ -2,5 +2,4 @@ export enum EndAction {
|
|||||||
LoadNext = 'load-next',
|
LoadNext = 'load-next',
|
||||||
None = 'none',
|
None = 'none',
|
||||||
PlayNext = 'play-next',
|
PlayNext = 'play-next',
|
||||||
Stop = 'stop',
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ describe('validateEndAction()', () => {
|
|||||||
expect(endAction).toBe(EndAction.LoadNext);
|
expect(endAction).toBe(EndAction.LoadNext);
|
||||||
});
|
});
|
||||||
it('returns fallback otherwise', () => {
|
it('returns fallback otherwise', () => {
|
||||||
const emptyAction = validateEndAction('', EndAction.Stop);
|
const emptyAction = validateEndAction('', EndAction.LoadNext);
|
||||||
const invalidAction = validateEndAction('this-does-not-exist', EndAction.PlayNext);
|
const invalidAction = validateEndAction('this-does-not-exist', EndAction.PlayNext);
|
||||||
expect(emptyAction).toBe(EndAction.Stop);
|
expect(emptyAction).toBe(EndAction.LoadNext);
|
||||||
expect(invalidAction).toBe(EndAction.PlayNext);
|
expect(invalidAction).toBe(EndAction.PlayNext);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user