Skip to content

Commit 1a24bef

Browse files
added header options in openApi data source in query editor
1 parent 7a26dc6 commit 1a24bef

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

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

+16-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { ControlParams, ControlType } from "comps/controls/controlParams";
3131
import MarkdownTooltip from "lowcoder-design/src/components/MarkdownTooltip";
3232
import { KeyValueControlParams, keyValueListControl } from "comps/controls/keyValueControl";
3333
import { VariablesControl } from "../httpQuery/graphqlQuery";
34+
import { HttpHeaderPropertyView } from "../httpQuery/httpQueryConstants";
3435

3536
function wrapConfig<CP extends {} = ControlParams>(
3637
paramsControl: ControlType,
@@ -144,18 +145,21 @@ function ActionSelectView(props: ActionSelectViewProps) {
144145
);
145146
}
146147

147-
function unionConfigToComp(config: QueryConfig): CompConstructor {
148-
const childrenMap: Record<string, CompConstructor> = {};
148+
export function unionConfigToComp(config: QueryConfig): CompConstructor {
149+
const childrenMap: Record<string, CompConstructor> = {
150+
};
149151
config.actions.forEach((child) => {
150152
childrenMap[child.actionName] = configToComp(child.params);
151153
});
152154

153155
const TmpComp = withTypeAndChildrenAbstract(
154156
childrenMap,
155157
config.actions[0].actionName,
156-
{},
158+
{
159+
headers: withDefault(keyValueListControl(), [{ key: "", value: "" }]),
160+
},
157161
"actionName",
158-
"action"
162+
"action",
159163
);
160164

161165
return class extends TmpComp {
@@ -171,6 +175,14 @@ function unionConfigToComp(config: QueryConfig): CompConstructor {
171175
currentActionName={currentActionName}
172176
onActionChange={(value) => this.dispatchChangeAndPreserveAction({ actionName: value })}
173177
/>
178+
{/* Headers */}
179+
<QueryConfigWrapper>
180+
<QueryConfigLabel>Headers</QueryConfigLabel>
181+
<QueryConfigItemWrapper>
182+
{this.children.headers.propertyView({ keyFlexBasics: 184, valueFlexBasics: 232 })}
183+
</QueryConfigItemWrapper>
184+
</QueryConfigWrapper>
185+
174186
{this.children.action.getPropertyView()}
175187
</>
176188
);

0 commit comments

Comments
 (0)