This commit is contained in:
parent
c52497f7ed
commit
61acad1147
3 changed files with 23 additions and 4 deletions
BIN
directus/data.db
BIN
directus/data.db
Binary file not shown.
|
@ -4,6 +4,7 @@ type Options = {
|
||||||
token: string
|
token: string
|
||||||
instance: string
|
instance: string
|
||||||
flow: string
|
flow: string
|
||||||
|
debug: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
type Data = {
|
type Data = {
|
||||||
|
@ -26,13 +27,14 @@ type Data = {
|
||||||
|
|
||||||
export default defineOperationApi<Options>({
|
export default defineOperationApi<Options>({
|
||||||
id: 'windmill',
|
id: 'windmill',
|
||||||
handler: async ({ token, instance, flow }, { data }) => {
|
handler: async ({ token, instance, flow, debug }, { data }) => {
|
||||||
const last = data.$last as Data
|
const last = data.$last as Data
|
||||||
const body = JSON.stringify({
|
const body = JSON.stringify({
|
||||||
event: last.event ?? "manual",
|
event: last.event ?? "manual",
|
||||||
instance: instance,
|
instance: instance,
|
||||||
collection: last.collection ?? last.body?.collection,
|
collection: last.collection ?? last.body?.collection,
|
||||||
keys: last.keys ?? last.body?.keys ?? [last.key]
|
keys: last.keys ?? last.body?.keys ?? [last.key],
|
||||||
|
debug: debug,
|
||||||
})
|
})
|
||||||
|
|
||||||
return await fetch(`https://windmill.swablab.de/api/r/${flow}`, {
|
return await fetch(`https://windmill.swablab.de/api/r/${flow}`, {
|
||||||
|
|
|
@ -5,7 +5,7 @@ export default defineOperationApp({
|
||||||
name: "swablab windmill",
|
name: "swablab windmill",
|
||||||
icon: "wind_power",
|
icon: "wind_power",
|
||||||
description: "trigger a windmill action",
|
description: "trigger a windmill action",
|
||||||
overview: ({ instance, flow }) => [
|
overview: ({ instance, flow, debug }) => [
|
||||||
{
|
{
|
||||||
label: "Instance",
|
label: "Instance",
|
||||||
text: instance,
|
text: instance,
|
||||||
|
@ -14,6 +14,10 @@ export default defineOperationApp({
|
||||||
label: "Flow",
|
label: "Flow",
|
||||||
text: flow,
|
text: flow,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Debug",
|
||||||
|
text: debug,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
|
@ -24,7 +28,7 @@ export default defineOperationApp({
|
||||||
width: "full",
|
width: "full",
|
||||||
interface: "input",
|
interface: "input",
|
||||||
required: true,
|
required: true,
|
||||||
note: "See Vaultwarden",
|
note: "see vaultwarden",
|
||||||
options: {
|
options: {
|
||||||
masked: true
|
masked: true
|
||||||
}
|
}
|
||||||
|
@ -63,5 +67,18 @@ export default defineOperationApp({
|
||||||
note: "https://windmill.swablab.de/api/r/..."
|
note: "https://windmill.swablab.de/api/r/..."
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: "debug",
|
||||||
|
name: "Debug",
|
||||||
|
type: "boolean",
|
||||||
|
schema: {
|
||||||
|
default_value: false
|
||||||
|
},
|
||||||
|
meta: {
|
||||||
|
width: "full",
|
||||||
|
interface: "checkbox",
|
||||||
|
note: "not always suppported"
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue