mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-01 04:19:12 +00:00
refactor: improve form ux
This commit is contained in:
committed by
Carlos Valente
parent
c333117347
commit
39e012452b
+8
-6
@@ -27,13 +27,12 @@
|
|||||||
.titleSection,
|
.titleSection,
|
||||||
.filterSection,
|
.filterSection,
|
||||||
.oscSection,
|
.oscSection,
|
||||||
.httpSection,
|
.httpSection {
|
||||||
.companionSection {
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-gap: 0.5rem;
|
grid-gap: 0.5rem;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
align-self: end;
|
align-self: flex-end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,10 +40,13 @@
|
|||||||
.ruleSection,
|
.ruleSection,
|
||||||
.filterSection,
|
.filterSection,
|
||||||
.oscSection,
|
.oscSection,
|
||||||
.httpSection,
|
.httpSection {
|
||||||
.companionSection {
|
label, div {
|
||||||
label {
|
// we use the div as non-interactive placeholder for button cells
|
||||||
|
// it needs to match the size of the label element
|
||||||
font-size: calc(1rem - 3px);
|
font-size: calc(1rem - 3px);
|
||||||
|
}
|
||||||
|
label {
|
||||||
color: $label-gray;
|
color: $label-gray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -212,8 +212,10 @@ export default function AutomationForm(props: AutomationFormProps) {
|
|||||||
{...register(`filters.${index}.field`, { required: { value: true, message: 'Required field' } })}
|
{...register(`filters.${index}.field`, { required: { value: true, message: 'Required field' } })}
|
||||||
size='sm'
|
size='sm'
|
||||||
variant='ontime'
|
variant='ontime'
|
||||||
placeholder='Event field'
|
|
||||||
>
|
>
|
||||||
|
<option selected hidden disabled value=''>
|
||||||
|
Event field
|
||||||
|
</option>
|
||||||
{fieldList.map(({ value, label }) => (
|
{fieldList.map(({ value, label }) => (
|
||||||
<option key={value} value={value}>
|
<option key={value} value={value}>
|
||||||
{label}
|
{label}
|
||||||
@@ -228,8 +230,10 @@ export default function AutomationForm(props: AutomationFormProps) {
|
|||||||
{...register(`filters.${index}.operator`, { required: { value: true, message: 'Required field' } })}
|
{...register(`filters.${index}.operator`, { required: { value: true, message: 'Required field' } })}
|
||||||
size='sm'
|
size='sm'
|
||||||
variant='ontime'
|
variant='ontime'
|
||||||
placeholder='Operator'
|
|
||||||
>
|
>
|
||||||
|
<option selected hidden disabled value=''>
|
||||||
|
Operator
|
||||||
|
</option>
|
||||||
<option value='equals'>equals</option>
|
<option value='equals'>equals</option>
|
||||||
<option value='not_equals'>not equals</option>
|
<option value='not_equals'>not equals</option>
|
||||||
<option value='contains'>contains</option>
|
<option value='contains'>contains</option>
|
||||||
@@ -248,6 +252,9 @@ export default function AutomationForm(props: AutomationFormProps) {
|
|||||||
autoComplete='off'
|
autoComplete='off'
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
<div>
|
||||||
|
<span> </span>
|
||||||
|
<div>
|
||||||
<IconButton
|
<IconButton
|
||||||
aria-label='Delete'
|
aria-label='Delete'
|
||||||
icon={<IoTrash />}
|
icon={<IoTrash />}
|
||||||
@@ -259,6 +266,8 @@ export default function AutomationForm(props: AutomationFormProps) {
|
|||||||
isLoading={false}
|
isLoading={false}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<Button
|
||||||
@@ -354,8 +363,10 @@ export default function AutomationForm(props: AutomationFormProps) {
|
|||||||
/>
|
/>
|
||||||
<Panel.Error>{rowErrors?.args?.message}</Panel.Error>
|
<Panel.Error>{rowErrors?.args?.message}</Panel.Error>
|
||||||
</label>
|
</label>
|
||||||
|
<div>
|
||||||
|
<span> </span>
|
||||||
<Panel.InlineElements relation='inner'>
|
<Panel.InlineElements relation='inner'>
|
||||||
<Button size='sm' variant='ontime-ghosted' onClick={() => handleTestOSCOutput(index)}>
|
<Button size='sm' variant='ontime-ghosted-white' onClick={() => handleTestOSCOutput(index)}>
|
||||||
Test
|
Test
|
||||||
</Button>
|
</Button>
|
||||||
<IconButton
|
<IconButton
|
||||||
@@ -371,6 +382,7 @@ export default function AutomationForm(props: AutomationFormProps) {
|
|||||||
</Panel.InlineElements>
|
</Panel.InlineElements>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (isHTTPOutput(output)) {
|
if (isHTTPOutput(output)) {
|
||||||
@@ -400,8 +412,10 @@ export default function AutomationForm(props: AutomationFormProps) {
|
|||||||
/>
|
/>
|
||||||
<Panel.Error>{rowErrors?.url?.message}</Panel.Error>
|
<Panel.Error>{rowErrors?.url?.message}</Panel.Error>
|
||||||
</label>
|
</label>
|
||||||
|
<div>
|
||||||
|
<span> </span>
|
||||||
<Panel.InlineElements relation='inner'>
|
<Panel.InlineElements relation='inner'>
|
||||||
<Button size='sm' variant='ontime-ghosted' onClick={() => handleTestHTTPOutput(index)}>
|
<Button size='sm' variant='ontime-ghosted-white' onClick={() => handleTestHTTPOutput(index)}>
|
||||||
Test
|
Test
|
||||||
</Button>
|
</Button>
|
||||||
<IconButton
|
<IconButton
|
||||||
@@ -417,6 +431,7 @@ export default function AutomationForm(props: AutomationFormProps) {
|
|||||||
</Panel.InlineElements>
|
</Panel.InlineElements>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// there should be no other output types
|
// there should be no other output types
|
||||||
|
|||||||
@@ -77,7 +77,9 @@ export default function AutomationsList(props: AutomationsListProps) {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{arrayAutomations.length === 0 && (
|
{arrayAutomations.length === 0 && (
|
||||||
<Panel.TableEmpty handleClick={() => setAutomationFormData(automationPlaceholder)} />
|
<Panel.TableEmpty
|
||||||
|
handleClick={!automationFormData ? () => setAutomationFormData(automationPlaceholder) : undefined}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
{arrayAutomations.map((automationId) => {
|
{arrayAutomations.map((automationId) => {
|
||||||
if (!Object.hasOwn(automations, automationId)) {
|
if (!Object.hasOwn(automations, automationId)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user