Skip to content

Commit 9c374c6

Browse files
Added onInputChange, onQueryExecution and onTimeout triggers on JS/Stream queries
1 parent 20c1882 commit 9c374c6

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,21 @@ interface AfterExecuteQueryAction {
9797
result: QueryResult;
9898
}
9999

100+
const CommonTriggerOptions = [
101+
{ label: trans("query.triggerTypeInputChange"), value: "onInputChange"},
102+
{ label: trans("query.triggerTypeQueryExec"), value: "onQueryExecution"},
103+
{ label: trans("query.triggerTypeTimeout"), value: "onTimeout"},
104+
]
105+
100106
export const TriggerTypeOptions = [
101-
{ label: "On Page Load", value: "onPageLoad"},
102-
{ label: "On Input Change", value: "onInputChange"},
103-
{ label: "On Query Execution", value: "onQueryExecution"},
104-
{ label: "On Timeout", value: "onTimeout"},
107+
{ label: trans("query.triggerTypePageLoad"), value: "onPageLoad"},
108+
...CommonTriggerOptions,
105109
{ label: trans("query.triggerTypeAuto"), value: "automatic" },
106110
{ label: trans("query.triggerTypeManual"), value: "manual" },
107111
] as const;
108112

109113
export const JSTriggerTypeOptions = [
114+
...CommonTriggerOptions,
110115
{ label: trans("query.triggerTypePageLoad"), value: "automatic" },
111116
{ label: trans("query.triggerTypeManual"), value: "manual" },
112117
];
@@ -244,13 +249,13 @@ QueryCompTmp = class extends QueryCompTmp {
244249
const isInputChangeTrigger = getTriggerType(this) === "onInputChange";
245250

246251
if (
247-
action.type === CompActionTypes.UPDATE_NODES_V2 &&
248-
(
252+
action.type === CompActionTypes.UPDATE_NODES_V2
253+
&& (
249254
isAutomatic
250255
|| isInputChangeTrigger
251256
|| (isPageLoadTrigger && notExecuted)
252-
) &&
253-
(!isJsQuery || (isJsQuery && notExecuted)) // query which has deps can be executed on page load(first time)
257+
)
258+
// && (!isJsQuery || (isJsQuery && notExecuted)) // query which has deps can be executed on page load(first time)
254259
) {
255260
const next = super.reduce(action);
256261
const depends = this.children.comp.node()?.dependValues();

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,8 @@ export const QueryGeneralPropertyView = (props: {
391391
{children.triggerType.getView() === 'onTimeout' && (
392392
<TriggerTypeStyled>
393393
{children.delayTime.propertyView({
394-
label: trans("query.timeout"),
394+
label: trans("query.delayTime"),
395395
placeholder: "5s",
396-
tooltip: trans("query.timeoutTooltip", { maxSeconds: 3600, defaultSeconds: 5 }),
397396
placement: "bottom",
398397
})}
399398
</TriggerTypeStyled>

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,10 @@ export const en = {
738738
"triggerTypeAuto": "Inputs Change or On Page Load",
739739
"triggerTypePageLoad": "When the Application (Page) loads",
740740
"triggerTypeManual": "Only when you trigger it manually",
741+
"triggerTypeInputChange": "When Inputs Change",
742+
"triggerTypeQueryExec": "After Query Execution",
743+
"triggerTypeTimeout": "After the Timeout Interval",
744+
"delayTime": "Delay Time",
741745
"chooseDataSource": "Choose Data Source",
742746
"method": "Method",
743747
"updateExceptionDataSourceTitle": "Update Failing Data Source",

0 commit comments

Comments
 (0)