diff --git a/GUI/src/components/FlowElementsPopup/PreviousVariables.tsx b/GUI/src/components/FlowElementsPopup/PreviousVariables.tsx index 77b97714..ad0267e7 100644 --- a/GUI/src/components/FlowElementsPopup/PreviousVariables.tsx +++ b/GUI/src/components/FlowElementsPopup/PreviousVariables.tsx @@ -87,7 +87,10 @@ const PreviousVariables: FC = ({ node }) => { const endpointNodes = previousNodes.filter((node) => node.data.stepType === StepType.UserDefined); const names = endpointNodes.map((node) => node.data.label?.toString().split(' ')[0]); const filteredEndpointsVariables = endpointsVariables.filter((endpoint) => names.includes(endpoint.name)); - setEndpoints(filteredEndpointsVariables); + const uniqueEndpointsVariables = Array.from( + new Map(filteredEndpointsVariables.map((endpoint) => [endpoint.name, endpoint])).values(), + ); + setEndpoints(uniqueEndpointsVariables); // Get Assign variables const assignNodes: Node[] = @@ -196,59 +199,75 @@ const PreviousVariables: FC = ({ node }) => { style={{ borderBottom: border, borderTop: border }} /> )} - {endpoints.map((endpoint) => ( - - - - {endpoint.chips.map((chip) => { - const typeColor = getTypeColor(chip.data); - const dragData: Assign = { - id: v4(), - key: chip.name, - value: stringToTemplate(chip.value), - data: chip.data, - }; - - return isObject(chip.data) ? ( - - { - setEndpointsObjectTree( - endpointsObjectTree?.path === chip.value - ? null - : { - data: chip.data, - path: chip.value, - }, - ); - }} - > - {endpointsObjectTree?.path === chip.value ? chip.name + ' ▲' : chip.name + ' ▼'} - - - ) : ( - - - {chip.name} - - - ); - })} - - - ))} + {endpoints.length > 0 && ( + + {endpoints.map((endpoint) => ( + + + + {endpoint.chips.map((chip) => { + const typeColor = getTypeColor(chip.data); + const dragData: Assign = { + id: v4(), + key: chip.name, + value: stringToTemplate(chip.value), + data: chip.data, + }; + + return isObject(chip.data) ? ( + + { + setEndpointsObjectTree( + endpointsObjectTree?.path === chip.value + ? null + : { + data: chip.data, + path: chip.value, + }, + ); + }} + > + {endpointsObjectTree?.path === chip.value ? chip.name + ' ▲' : chip.name + ' ▼'} + + + ) : ( + + + {chip.name} + + + ); + })} + + + ))} + + )} )} {isObject(endpointsObjectTree?.data) && ( diff --git a/GUI/src/i18n/en/common.json b/GUI/src/i18n/en/common.json index 365c5a70..36bfa71d 100644 --- a/GUI/src/i18n/en/common.json +++ b/GUI/src/i18n/en/common.json @@ -456,6 +456,9 @@ "environmentVariables": { "title": "Environment Variables" }, + "apiResponses": { + "title": "API Responses" + }, "helpers": { "title": "Tools", "map": "Change items", diff --git a/GUI/src/i18n/et/common.json b/GUI/src/i18n/et/common.json index 77d2178f..8e65362f 100644 --- a/GUI/src/i18n/et/common.json +++ b/GUI/src/i18n/et/common.json @@ -430,6 +430,9 @@ "environmentVariables": { "title": "Keskkonnamuutujad" }, + "apiResponses": { + "title": "API vastused" + }, "dateAndTime": { "title": "Kuupäev ja kellaaeg", "base": "Põhi", diff --git a/GUI/src/store/new-services.store.ts b/GUI/src/store/new-services.store.ts index d59cac1a..9671a7d0 100644 --- a/GUI/src/store/new-services.store.ts +++ b/GUI/src/store/new-services.store.ts @@ -362,7 +362,9 @@ const useServiceStore = create((set, get) => ({ variables.push(variable); }); - set({ endpointsResponseVariables: variables }); + const uniqueVariables = Array.from(new Map(variables.map((variable) => [variable.name, variable])).values()); + + set({ endpointsResponseVariables: uniqueVariables }); } catch (e) { console.error(e); }