Skip to content

Commit ed12206

Browse files
added onTimeout trigger on query
1 parent 85bc2db commit ed12206

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

client/packages/lowcoder/src/comps/queries/queryComp.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,13 @@ export const TriggerTypeOptions = [
101101
{ label: "On Page Load", value: "onPageLoad"},
102102
{ label: "On Input Change", value: "onInputChange"},
103103
{ label: "On Query Execution", value: "onQueryExecution"},
104+
{ label: "On Timeout", value: "onTimeout"},
104105
{ label: trans("query.triggerTypeAuto"), value: "automatic" },
105106
{ label: trans("query.triggerTypeManual"), value: "manual" },
106107
] as const;
107108

108109
export const JSTriggerTypeOptions = [
109-
{ label: trans("query.triggerTypeAuto"), value: "automatic" },
110+
{ label: trans("query.triggerTypePageLoad"), value: "automatic" },
110111
{ label: trans("query.triggerTypeManual"), value: "manual" },
111112
];
112113

@@ -160,7 +161,13 @@ const childrenMap = {
160161
},
161162
}),
162163
cancelPrevious: withDefault(BoolPureControl, false),
164+
// use only for onQueryExecution trigger
163165
depQueryName: SimpleNameComp,
166+
// use only for onTimeout trigger, triggers query after x time passed on page load
167+
delayTime: millisecondsControl({
168+
left: 0,
169+
defaultValue: 5 * 1000,
170+
})
164171
};
165172

166173
let QueryCompTmp = withTypeAndChildren<typeof QueryMap, ToInstanceType<typeof childrenMap>>(
@@ -317,6 +324,12 @@ function QueryView(props: QueryViewProps) {
317324
comp.dispatch(deferAction(executeQueryAction({})));
318325
}, 300);
319326
}
327+
328+
if(getTriggerType(comp) === "onTimeout") {
329+
setTimeout(() => {
330+
comp.dispatch(deferAction(executeQueryAction({})));
331+
}, comp.children.delayTime.getView());
332+
}
320333
}, []);
321334

322335
useFixedDelay(

client/packages/lowcoder/src/comps/queries/queryComp/queryPropertyView.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,16 @@ export const QueryGeneralPropertyView = (props: {
388388
/>
389389
</TriggerTypeStyled>
390390
)}
391+
{children.triggerType.getView() === 'onTimeout' && (
392+
<TriggerTypeStyled>
393+
{children.delayTime.propertyView({
394+
label: trans("query.timeout"),
395+
placeholder: "5s",
396+
tooltip: trans("query.timeoutTooltip", { maxSeconds: 3600, defaultSeconds: 5 }),
397+
placement: "bottom",
398+
})}
399+
</TriggerTypeStyled>
400+
)}
391401
</>
392402
)}
393403
</QuerySectionWrapper>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy