mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
feat(core): Fix populating of node custom api call options (#5303)
* feat(core): Fix populating of node custom api call options * lint fixes * Adress PR comments * Add e2e test and only inject custom API options for latest version * Make sure to injectCustomApiCallOption for the latest version of node
This commit is contained in:
@@ -233,7 +233,7 @@ const telemetry = instance?.proxy.$telemetry;
|
||||
const { categorizedItems: allNodes, isTriggerNode } = useNodeTypesStore();
|
||||
const containsAPIAction = computed(
|
||||
() =>
|
||||
state.latestNodeData?.properties.some((p) =>
|
||||
activeNodeActions.value?.properties.some((p) =>
|
||||
p.options?.find((o) => o.name === CUSTOM_API_CALL_NAME),
|
||||
) === true,
|
||||
);
|
||||
@@ -338,27 +338,10 @@ function getCustomAPICallHintLocale(key: string) {
|
||||
interpolate: { nodeNameTitle },
|
||||
});
|
||||
}
|
||||
// The nodes.json doesn't contain API CALL option so we need to fetch the node detail
|
||||
// to determine if need to render the API CALL hint
|
||||
async function fetchNodeDetails() {
|
||||
if (!state.activeNodeActions) return;
|
||||
|
||||
const { getNodesInformation } = useNodeTypesStore();
|
||||
const { version, name } = state.activeNodeActions;
|
||||
const payload = {
|
||||
name,
|
||||
version: Array.isArray(version) ? version?.slice(-1)[0] : version,
|
||||
} as INodeTypeNameVersion;
|
||||
|
||||
const nodesInfo = await getNodesInformation([payload], false);
|
||||
|
||||
state.latestNodeData = nodesInfo[0];
|
||||
}
|
||||
|
||||
function setActiveActionsNodeType(nodeType: INodeTypeDescription | null) {
|
||||
state.activeNodeActions = nodeType;
|
||||
setShowTabs(false);
|
||||
fetchNodeDetails();
|
||||
|
||||
if (nodeType) trackActionsView();
|
||||
}
|
||||
|
||||
@@ -116,7 +116,11 @@
|
||||
</n8n-text>
|
||||
</div>
|
||||
|
||||
<div v-if="isCustomApiCallSelected(nodeValues)" class="parameter-item parameter-notice">
|
||||
<div
|
||||
v-if="isCustomApiCallSelected(nodeValues)"
|
||||
class="parameter-item parameter-notice"
|
||||
data-test-id="node-parameters-http-notice"
|
||||
>
|
||||
<n8n-notice
|
||||
:content="
|
||||
$locale.baseText('nodeSettings.useTheHttpRequestNode', {
|
||||
|
||||
@@ -56,9 +56,12 @@ const customNodeActionsParsers: {
|
||||
},
|
||||
};
|
||||
|
||||
function filterSinglePlaceholderAction(actions: INodeActionTypeDescription[]) {
|
||||
function filterActions(actions: INodeActionTypeDescription[]) {
|
||||
return actions.filter(
|
||||
(action: INodeActionTypeDescription, _: number, arr: INodeActionTypeDescription[]) => {
|
||||
const isApiCall = action.actionKey === CUSTOM_API_CALL_KEY;
|
||||
if (isApiCall) return false;
|
||||
|
||||
const isPlaceholderTriggerAction = action.actionKey === PLACEHOLDER_RECOMMENDED_ACTION_KEY;
|
||||
return !isPlaceholderTriggerAction || (isPlaceholderTriggerAction && arr.length > 1);
|
||||
},
|
||||
@@ -339,7 +342,7 @@ export const useNodeCreatorStore = defineStore(STORES.NODE_CREATOR, {
|
||||
|
||||
const filteredNodes = Object.values(mergedNodes).map((node) => ({
|
||||
...node,
|
||||
actions: filterSinglePlaceholderAction(node.actions || []),
|
||||
actions: filterActions(node.actions || []),
|
||||
}));
|
||||
|
||||
return filteredNodes;
|
||||
|
||||
Reference in New Issue
Block a user