Fix issue with trigger filters not saving (#14231)
* Fix issue with trigger filters not saving * use enum instead of nasty string --------- Co-authored-by: Michael Drury <me@michaeldrury.co.uk>
This commit is contained in:
parent
30e479242e
commit
5ab81543e3
|
@ -58,6 +58,7 @@
|
||||||
AutomationEventType,
|
AutomationEventType,
|
||||||
AutomationStepType,
|
AutomationStepType,
|
||||||
AutomationActionStepId,
|
AutomationActionStepId,
|
||||||
|
AutomationCustomIOType,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { FIELDS } from "constants/backend"
|
import { FIELDS } from "constants/backend"
|
||||||
import PropField from "./PropField.svelte"
|
import PropField from "./PropField.svelte"
|
||||||
|
@ -394,7 +395,9 @@
|
||||||
*/
|
*/
|
||||||
const onRowTriggerUpdate = async update => {
|
const onRowTriggerUpdate = async update => {
|
||||||
if (
|
if (
|
||||||
["tableId", "filters", "meta"].some(key => Object.hasOwn(update, key))
|
["tableId", AutomationCustomIOType.FILTERS, "meta"].some(key =>
|
||||||
|
Object.hasOwn(update, key)
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
let updatedAutomation
|
let updatedAutomation
|
||||||
|
@ -744,7 +747,11 @@
|
||||||
for (let [key, field] of properties) {
|
for (let [key, field] of properties) {
|
||||||
// need to look for the builder definition (keyed separately, see saveFilters)
|
// need to look for the builder definition (keyed separately, see saveFilters)
|
||||||
const defKey = `${key}-def`
|
const defKey = `${key}-def`
|
||||||
if (field.customType === "filters" && inputs?.[defKey]) {
|
if (
|
||||||
|
(field.customType === AutomationCustomIOType.FILTERS ||
|
||||||
|
field.customType === AutomationCustomIOType.TRIGGER_FILTER) &&
|
||||||
|
inputs?.[defKey]
|
||||||
|
) {
|
||||||
filters = inputs[defKey]
|
filters = inputs[defKey]
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -846,7 +853,7 @@
|
||||||
<Label>
|
<Label>
|
||||||
{label}
|
{label}
|
||||||
</Label>
|
</Label>
|
||||||
{#if value.customType === "trigger_filter"}
|
{#if value.customType === AutomationCustomIOType.TRIGGER_FILTER}
|
||||||
<Icon
|
<Icon
|
||||||
hoverable
|
hoverable
|
||||||
on:click={() =>
|
on:click={() =>
|
||||||
|
@ -977,7 +984,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{:else if value.customType === "filters" || value.customType === "trigger_filter"}
|
{:else if value.customType === AutomationCustomIOType.FILTERS || value.customType === AutomationCustomIOType.TRIGGER_FILTER}
|
||||||
<ActionButton fullWidth on:click={drawer.show}
|
<ActionButton fullWidth on:click={drawer.show}
|
||||||
>{filters.length > 0
|
>{filters.length > 0
|
||||||
? "Update Filter"
|
? "Update Filter"
|
||||||
|
|
|
@ -25,7 +25,7 @@ export const definition: AutomationTriggerSchema = {
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
type: AutomationIOType.OBJECT,
|
type: AutomationIOType.OBJECT,
|
||||||
customType: AutomationCustomIOType.FILTERS,
|
customType: AutomationCustomIOType.TRIGGER_FILTER,
|
||||||
title: "Filtering",
|
title: "Filtering",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue