mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-22 15:39:11 +00:00
refactor: add empty state for autoamtion form
This commit is contained in:
committed by
Carlos Valente
parent
2873698959
commit
c8bae76121
@@ -26,7 +26,7 @@ export default function EventEditorTriggers({ triggers, eventId }: EventEditorTr
|
|||||||
value: id,
|
value: id,
|
||||||
label: title,
|
label: title,
|
||||||
}));
|
}));
|
||||||
|
const hasAutomationOptions = allAutomationOptions.length > 0;
|
||||||
const triggerOptions = eventTriggerOptions.map((cycle) => ({ value: cycle, label: cycle }));
|
const triggerOptions = eventTriggerOptions.map((cycle) => ({ value: cycle, label: cycle }));
|
||||||
|
|
||||||
const duplicateIds = new Set<string>();
|
const duplicateIds = new Set<string>();
|
||||||
@@ -41,7 +41,7 @@ export default function EventEditorTriggers({ triggers, eventId }: EventEditorTr
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
if (allAutomationOptions.length === 0) return;
|
if (!hasAutomationOptions) return;
|
||||||
updateEntry({
|
updateEntry({
|
||||||
id: eventId,
|
id: eventId,
|
||||||
triggers: [
|
triggers: [
|
||||||
@@ -65,6 +65,12 @@ export default function EventEditorTriggers({ triggers, eventId }: EventEditorTr
|
|||||||
{automationsEnabled === false && (
|
{automationsEnabled === false && (
|
||||||
<Info>Automations are disabled. Event triggers stay configured, but they will not run until enabled.</Info>
|
<Info>Automations are disabled. Event triggers stay configured, but they will not run until enabled.</Info>
|
||||||
)}
|
)}
|
||||||
|
{automationsEnabled && !hasAutomationOptions && (
|
||||||
|
<Info>
|
||||||
|
<Info.Title>No automations available</Info.Title>
|
||||||
|
<Info.Body>Create an automation before attaching it to this event.</Info.Body>
|
||||||
|
</Info>
|
||||||
|
)}
|
||||||
{triggers.length > 0 && (
|
{triggers.length > 0 && (
|
||||||
<div className={style.triggerList}>
|
<div className={style.triggerList}>
|
||||||
<div className={style.triggerHeader}>
|
<div className={style.triggerHeader}>
|
||||||
@@ -110,7 +116,7 @@ export default function EventEditorTriggers({ triggers, eventId }: EventEditorTr
|
|||||||
* Duplicate combinations will only fire once per lifecycle event.
|
* Duplicate combinations will only fire once per lifecycle event.
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{allAutomationOptions.length > 0 && (
|
{hasAutomationOptions && (
|
||||||
<Button variant='ghosted' onClick={handleAdd}>
|
<Button variant='ghosted' onClick={handleAdd}>
|
||||||
<IoAdd /> Add automation
|
<IoAdd /> Add automation
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user