feat(frontend): disabled for action buttons can now depend on row

This commit is contained in:
Ruben Fiszel
2023-03-13 14:36:34 +01:00
parent 693608955f
commit 6aba317197
3 changed files with 17 additions and 11 deletions
@@ -127,6 +127,7 @@
<InputValue
{id}
input={configuration.disabled}
extraContext={extraQueryParams}
bind:value={disabled}
bind:error={errors.disabled}
/>
@@ -12,6 +12,7 @@
export let value: T
export let id: string | undefined = undefined
export let error: string = ''
export let extraContext: Record<string, any> = {}
let lastInput = input ? JSON.parse(JSON.stringify(input)) : undefined
@@ -72,16 +73,19 @@
}
function computeGlobalContext() {
return Object.fromEntries(
Object.entries($worldStore?.outputsById ?? {})
.filter(([k, _]) => k != id)
.map(([key, value]) => {
return [
key,
Object.fromEntries(Object.entries(value ?? {}).map((x) => [x[0], x[1].peak()]))
]
})
)
return {
...Object.fromEntries(
Object.entries($worldStore?.outputsById ?? {})
.filter(([k, _]) => k != id)
.map(([key, value]) => {
return [
key,
Object.fromEntries(Object.entries(value ?? {}).map((x) => [x[0], x[1].peak()]))
]
})
),
...extraContext
}
}
export function getValue(input: AppInput) {
@@ -43,7 +43,8 @@
disabled: {
fieldType: 'boolean',
type: 'eval',
expr: 'false'
expr: 'false',
tooltip: "Disabled based on a predicate. Use `row` to access the current row's data"
},
goto: {
tooltip: 'Go to an url on success if not empty',