Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ const ExampleValueModal = ({
const initial = defaultValue || '';
setValue(initial);
}, [sellerAPIExampleProps, defaultValue, attribute, location]);

console.log('ExampleValueModal value:', value);
return (
<Modal
open={isOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const RightAddSellerProp = ({ onSelect }: Readonly<Props>) => {
const [selectedProp, setSelectedProp] = useState<any>({
location: rightSideInfo?.previousData?.targetLocation,
name: rightSideInfo?.previousData?.target,
schemaType: rightSideInfo?.previousData?.schemaType,
});
const pathParameters = useMemo(() => {
if (!sellerApi?.spec?.parameters) return [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ const RightAddSonataProp = ({
setSelectedProp,
onSelect,
});

return (
<Flex
vertical
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,19 @@ export const useCommonAddProp = ({
}
// selectedProp = { name: string, location: string }
// propery name should follow this format: @{{ prop_name }}
let propertyName = '';
if (selectedProp?.location === 'HYBRID') {
propertyName = `${selectedProp.name}`;
} else if (selectedProp?.location === 'QUERY') {
propertyName = selectedProp.schemaType === 'object'
? `${selectedProp.name}={}`
: `@{{${selectedProp.name}}}`;
} else {
propertyName = `@{{${selectedProp.name}}}`;
}
onSelect?.({
...selectedProp,
name: selectedProp?.location === 'HYBRID'?`${selectedProp.name}`:`@{{${selectedProp.name}}}`,
name: propertyName,
title: rightSideInfo?.title,
});
}, [selectedProp, onSelect, rightSideInfo]);
Expand Down Expand Up @@ -107,7 +117,6 @@ export const useCommonAddProp = ({
const handleAddParamHybrid = (value: string) => {
setHybridField("param", value);
};

const collapseItems = useMemo(() => {
const items: CollapseProps["items"] = [];
if (pathParameters.length) {
Expand Down Expand Up @@ -202,16 +211,6 @@ export const useCommonAddProp = ({
),
children: (
<Flex vertical gap={8} className={styles.paramList}>
{isOpen && currentProp?.path === "QUERY" && (
<ExampleValueModal
location={currentProp?.path || ""}
attribute={currentProp?.name || ""}
isOpen={isOpen}
onClose={close}
onOK={handleAddParamHybrid}
defaultValue={rightSideInfo?.previousData?.target}
/>
)}
{queryParameters.map((parameter: any) => {
const sellerValue = sellerAPIExampleProps?.param?.[parameter.name];
const sonataValue = rightSideInfo?.previousData?.target;
Expand All @@ -233,12 +232,14 @@ export const useCommonAddProp = ({
setSelectedProp({
location: "HYBRID",
name: sellerValue,
schemaType: parameter.schema?.type,
});
return;
}
setSelectedProp({
location: "QUERY",
name: parameter.name,
schemaType: parameter.schema?.type,
});
}}
>
Expand All @@ -249,9 +250,6 @@ export const useCommonAddProp = ({
type="link"
onClick={() => handleProp(parameter.name, "QUERY")}
>
{(sonataValue)
? "Edit value with variable"
: "Add value with variable"}
</Button>
) : null}
<TypeTag type={parameter.schema.type} />
Expand Down
Loading