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

Commit850ccda

Browse files
committed
edits in querycomp
1 parent0ae6c23 commit850ccda

File tree

1 file changed

+39
-9
lines changed

1 file changed

+39
-9
lines changed

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

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -743,18 +743,48 @@ class QueryListComp extends QueryListTmpComp implements BottomResListComp {
743743
constname=this.genNewName(editorState);
744744
constcompType=extraInfo?.compType||"js";
745745
constdataSourceId=extraInfo?.dataSourceId;
746+
constcurlData=extraInfo?.curlData;
747+
console.log("CURL DATA",curlData)
748+
749+
750+
751+
// Build the payload that will be pushed to the list
752+
letpayload:any={
753+
id:id,
754+
name:name,
755+
datasourceId:dataSourceId,
756+
compType,
757+
triggerType:manualTriggerResource.includes(compType) ?"manual" :"automatic",
758+
isNewCreate:true,
759+
order:Date.now(),
760+
};
761+
762+
// If this is a REST API created from cURL, pre-populate the HTTP query fields
763+
if(compType==="restApi"&&curlData){
764+
constheadersArr=curlData.header
765+
?Object.entries(curlData.header).map(([key,value])=>({ key, value}))
766+
:[{key:"",value:""}];
767+
constparamsArr=curlData.params
768+
?Object.entries(curlData.params).map(([key,value])=>({ key, value}))
769+
:[{key:"",value:""}];
770+
771+
payload={
772+
...payload,
773+
comp:{
774+
httpMethod:curlData.method||"GET",
775+
path:curlData.url||"",
776+
headers:headersArr,
777+
params:paramsArr,
778+
bodyType:curlData.body ?"application/json" :"none",
779+
body:curlData.body ?JSON.stringify(curlData.body,null,2) :"",
780+
bodyFormData:[{key:"",value:"",type:"text"}],
781+
},
782+
};
783+
}
746784

747785
this.dispatch(
748786
wrapActionExtraInfo(
749-
this.pushAction({
750-
id:id,
751-
name:name,
752-
datasourceId:dataSourceId,
753-
compType,
754-
triggerType:manualTriggerResource.includes(compType) ?"manual" :"automatic",
755-
isNewCreate:true,
756-
order:Date.now(),
757-
}),
787+
this.pushAction(payload),
758788
{
759789
compInfos:[
760790
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp