Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdfd1673

Browse files
update variables usage in execute query action
1 parent17d38c1 commitdfd1673

File tree

1 file changed

+29
-19
lines changed

1 file changed

+29
-19
lines changed

‎client/packages/lowcoder/src/comps/controls/actionSelector/executeQueryAction.tsx‎

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getPromiseAfterDispatch } from "util/promiseUtils";
99
import{trans}from"i18n";
1010
import{withDefault}from"comps/generators";
1111
import{keyValueListControl}from"comps/controls/keyValueListControl";
12-
import{useCallback}from"react";
12+
import{useCallback,useEffect}from"react";
1313

1414
constExecuteQueryPropertyView=({
1515
comp,
@@ -19,16 +19,25 @@ const ExecuteQueryPropertyView = ({
1919
placement?:"query"|"table"
2020
})=>{
2121
constgetQueryOptions=useCallback((editorState?:EditorState)=>{
22-
constoptions:{label:string;value:string;variables?:Record<string,string>}[]=
23-
editorState
24-
?.queryCompInfoList()
25-
.map((info)=>{
22+
if(!editorState)return[];
23+
constoptions:{
24+
label:string;
25+
value:string;
26+
variables?:Record<string,string>
27+
}[]=editorState.getQueriesComp()
28+
.getView()
29+
.map((item)=>{
30+
constname=item.children.name.getView();
31+
constqVariables:Record<string,string>={};
32+
item.children.variables.toJsonValue().forEach(v=>{
33+
qVariables[v.key!]='';
34+
});
2635
return{
27-
label:info.name,
28-
value:info.name,
29-
variables:info.data.variables,
36+
label:name,
37+
value:name,
38+
variables:qVariables,
3039
}
31-
})
40+
})
3241
.filter(
3342
// Filter out the current query under query
3443
(option)=>{
@@ -67,7 +76,7 @@ const ExecuteQueryPropertyView = ({
6776
indicatorForAll:true,
6877
});
6978
},[comp.children.queryVariables.getView()])
70-
79+
7180
return(
7281
<>
7382
<BranchDiv$type={"inline"}>
@@ -114,26 +123,27 @@ const ExecuteQueryTmpAction = (function () {
114123
exportclassExecuteQueryActionextendsExecuteQueryTmpAction{
115124
overridegetView(){
116125
constqueryName=this.children.queryName.getView();
117-
// const queryParams = keyValueListToSearchStr(Array.isArray(this?.children?.query) ? (this.children.query as unknown as any[]).map((i: any) => i.getView() as KeyValue) : []);
118-
constresult=this.children.queryVariables.toJsonValue()
119-
.filter(item=>item.key!==""&&item.value!=="")
120-
.map(item=>({[item.keyasstring]:item.value}))
121-
.reduce((acc,curr)=>Object.assign(acc,curr),{});
122-
123-
result.$queryName=queryName;
124126
if(!queryName){
125127
return()=>Promise.resolve();
126128
}
127129

128-
return()=>
129-
getPromiseAfterDispatch(
130+
letresult=Object.values(this.children.queryVariables.getView())
131+
.filter((item)=>item.children.key.getView()!==""&&item.children.value.getView()!=="")
132+
.map((item)=>({[item.children.key.getView()asstring]:{value:item.children.value.getView()}}))
133+
.reduce((acc,curr)=>Object.assign(acc,curr),{});
134+
135+
result.$queryName={value:this.children.queryName.getView()};
136+
137+
return()=>{
138+
returngetPromiseAfterDispatch(
130139
this.dispatch,
131140
routeByNameAction(
132141
queryName,
133142
executeQueryAction({args:result})
134143
),
135144
{notHandledError:trans("eventHandler.notHandledError")}
136145
);
146+
}
137147
}
138148

139149
displayName(){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp