mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
refactor(editor): Remove unnecessary computed
on store methods (no-changelog)
This commit is contained in:
parent
6ba91b5e1e
commit
f10bbcf65c
|
@ -196,7 +196,6 @@ describe('ParameterInput.vue', () => {
|
||||||
throw new Error('Node does not have any credentials set');
|
throw new Error('Node does not have any credentials set');
|
||||||
});
|
});
|
||||||
|
|
||||||
// @ts-expect-error Readonly property
|
|
||||||
mockNodeTypesState.getNodeType = vi.fn().mockReturnValue({
|
mockNodeTypesState.getNodeType = vi.fn().mockReturnValue({
|
||||||
displayName: 'Test',
|
displayName: 'Test',
|
||||||
credentials: [
|
credentials: [
|
||||||
|
|
|
@ -1955,7 +1955,7 @@ describe('useCanvasOperations', () => {
|
||||||
const node = createTestNode({ id: nodeId, type: 'unknown-type' });
|
const node = createTestNode({ id: nodeId, type: 'unknown-type' });
|
||||||
|
|
||||||
workflowsStore.getNodeById.mockReturnValue(node);
|
workflowsStore.getNodeById.mockReturnValue(node);
|
||||||
nodeTypesStore.getNodeType = () => null;
|
nodeTypesStore.getNodeType.mockReturnValue(null);
|
||||||
|
|
||||||
const { revalidateNodeInputConnections } = useCanvasOperations({ router });
|
const { revalidateNodeInputConnections } = useCanvasOperations({ router });
|
||||||
revalidateNodeInputConnections(nodeId);
|
revalidateNodeInputConnections(nodeId);
|
||||||
|
@ -2104,7 +2104,7 @@ describe('useCanvasOperations', () => {
|
||||||
const node = createTestNode({ id: nodeId, type: 'unknown-type' });
|
const node = createTestNode({ id: nodeId, type: 'unknown-type' });
|
||||||
|
|
||||||
workflowsStore.getNodeById.mockReturnValue(node);
|
workflowsStore.getNodeById.mockReturnValue(node);
|
||||||
nodeTypesStore.getNodeType = () => null;
|
nodeTypesStore.getNodeType.mockReturnValue(null);
|
||||||
|
|
||||||
const { revalidateNodeOutputConnections } = useCanvasOperations({ router });
|
const { revalidateNodeOutputConnections } = useCanvasOperations({ router });
|
||||||
revalidateNodeOutputConnections(nodeId);
|
revalidateNodeOutputConnections(nodeId);
|
||||||
|
|
|
@ -84,8 +84,7 @@ export const useCredentialsStore = defineStore(STORES.CREDENTIALS, () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const allUsableCredentialsForNode = computed(() => {
|
const allUsableCredentialsForNode = (node: INodeUi): ICredentialsResponse[] => {
|
||||||
return (node: INodeUi): ICredentialsResponse[] => {
|
|
||||||
let credentials: ICredentialsResponse[] = [];
|
let credentials: ICredentialsResponse[] = [];
|
||||||
const nodeType = useNodeTypesStore().getNodeType(node.type, node.typeVersion);
|
const nodeType = useNodeTypesStore().getNodeType(node.type, node.typeVersion);
|
||||||
if (nodeType?.credentials) {
|
if (nodeType?.credentials) {
|
||||||
|
@ -99,38 +98,25 @@ export const useCredentialsStore = defineStore(STORES.CREDENTIALS, () => {
|
||||||
return aDate.getTime() - bDate.getTime();
|
return aDate.getTime() - bDate.getTime();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const getCredentialTypeByName = computed(() => {
|
const getCredentialTypeByName = (type: string): ICredentialType | undefined =>
|
||||||
return (type: string): ICredentialType | undefined => state.value.credentialTypes[type];
|
state.value.credentialTypes[type];
|
||||||
});
|
|
||||||
|
|
||||||
const getCredentialById = computed(() => {
|
const getCredentialById = (id: string): ICredentialsResponse => state.value.credentials[id];
|
||||||
return (id: string): ICredentialsResponse => state.value.credentials[id];
|
|
||||||
});
|
|
||||||
|
|
||||||
const getCredentialByIdAndType = computed(() => {
|
const getCredentialByIdAndType = (id: string, type: string): ICredentialsResponse | undefined => {
|
||||||
return (id: string, type: string): ICredentialsResponse | undefined => {
|
|
||||||
const credential = state.value.credentials[id];
|
const credential = state.value.credentials[id];
|
||||||
return !credential || credential.type !== type ? undefined : credential;
|
return !credential || credential.type !== type ? undefined : credential;
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const getCredentialsByType = computed(() => {
|
const getCredentialsByType = (credentialType: string): ICredentialsResponse[] =>
|
||||||
return (credentialType: string): ICredentialsResponse[] => {
|
allCredentialsByType.value[credentialType] || [];
|
||||||
return allCredentialsByType.value[credentialType] || [];
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
const getUsableCredentialByType = computed(() => {
|
const getUsableCredentialByType = (credentialType: string): ICredentialsResponse[] =>
|
||||||
return (credentialType: string): ICredentialsResponse[] => {
|
allUsableCredentialsByType.value[credentialType] || [];
|
||||||
return allUsableCredentialsByType.value[credentialType] || [];
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
const getNodesWithAccess = computed(() => {
|
const getNodesWithAccess = (credentialTypeName: string) => {
|
||||||
return (credentialTypeName: string) => {
|
const credentialType = getCredentialTypeByName(credentialTypeName);
|
||||||
const credentialType = getCredentialTypeByName.value(credentialTypeName);
|
|
||||||
if (!credentialType) {
|
if (!credentialType) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -140,11 +126,9 @@ export const useCredentialsStore = defineStore(STORES.CREDENTIALS, () => {
|
||||||
.map((nodeType) => nodeTypesStore.getNodeType(nodeType))
|
.map((nodeType) => nodeTypesStore.getNodeType(nodeType))
|
||||||
.filter(isPresent);
|
.filter(isPresent);
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const getScopesByCredentialType = computed(() => {
|
const getScopesByCredentialType = (credentialTypeName: string) => {
|
||||||
return (credentialTypeName: string) => {
|
const credentialType = getCredentialTypeByName(credentialTypeName);
|
||||||
const credentialType = getCredentialTypeByName.value(credentialTypeName);
|
|
||||||
if (!credentialType) {
|
if (!credentialType) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -171,10 +155,10 @@ export const useCredentialsStore = defineStore(STORES.CREDENTIALS, () => {
|
||||||
|
|
||||||
return [scopeDefault];
|
return [scopeDefault];
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const getCredentialOwnerName = computed(() => {
|
const getCredentialOwnerName = (
|
||||||
return (credential: ICredentialsResponse | IUsedCredential | undefined): string => {
|
credential: ICredentialsResponse | IUsedCredential | undefined,
|
||||||
|
): string => {
|
||||||
const { name, email } = splitName(credential?.homeProject?.name ?? '');
|
const { name, email } = splitName(credential?.homeProject?.name ?? '');
|
||||||
|
|
||||||
return name
|
return name
|
||||||
|
@ -183,15 +167,11 @@ export const useCredentialsStore = defineStore(STORES.CREDENTIALS, () => {
|
||||||
: name
|
: name
|
||||||
: (email ?? i18n.baseText('credentialEdit.credentialSharing.info.sharee.fallback'));
|
: (email ?? i18n.baseText('credentialEdit.credentialSharing.info.sharee.fallback'));
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const getCredentialOwnerNameById = computed(() => {
|
const getCredentialOwnerNameById = (credentialId: string): string => {
|
||||||
return (credentialId: string): string => {
|
const credential = getCredentialById(credentialId);
|
||||||
const credential = getCredentialById.value(credentialId);
|
return getCredentialOwnerName(credential);
|
||||||
|
|
||||||
return getCredentialOwnerName.value(credential);
|
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const httpOnlyCredentialTypes = computed(() => {
|
const httpOnlyCredentialTypes = computed(() => {
|
||||||
return allCredentialTypes.value.filter(
|
return allCredentialTypes.value.filter(
|
||||||
|
@ -372,7 +352,7 @@ export const useCredentialsStore = defineStore(STORES.CREDENTIALS, () => {
|
||||||
const { credentialTypeName } = params;
|
const { credentialTypeName } = params;
|
||||||
let newName = DEFAULT_CREDENTIAL_NAME;
|
let newName = DEFAULT_CREDENTIAL_NAME;
|
||||||
if (!TYPES_WITH_DEFAULT_NAME.includes(credentialTypeName)) {
|
if (!TYPES_WITH_DEFAULT_NAME.includes(credentialTypeName)) {
|
||||||
const cred = getCredentialTypeByName.value(credentialTypeName);
|
const cred = getCredentialTypeByName(credentialTypeName);
|
||||||
newName = cred ? getAppNameFromCredType(cred.displayName) : '';
|
newName = cred ? getAppNameFromCredType(cred.displayName) : '';
|
||||||
newName =
|
newName =
|
||||||
newName.length > 0 ? `${newName} ${DEFAULT_CREDENTIAL_POSTFIX}` : DEFAULT_CREDENTIAL_NAME;
|
newName.length > 0 ? `${newName} ${DEFAULT_CREDENTIAL_POSTFIX}` : DEFAULT_CREDENTIAL_NAME;
|
||||||
|
|
|
@ -56,10 +56,9 @@ export const useNodeTypesStore = defineStore(STORES.NODE_TYPES, () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const getNodeType = computed(() => {
|
const getNodeType = (nodeTypeName: string, version?: number): INodeTypeDescription | null => {
|
||||||
return (nodeTypeName: string, version?: number): INodeTypeDescription | null => {
|
|
||||||
if (utils.isCredentialOnlyNodeType(nodeTypeName)) {
|
if (utils.isCredentialOnlyNodeType(nodeTypeName)) {
|
||||||
return getCredentialOnlyNodeType.value(nodeTypeName, version);
|
return getCredentialOnlyNodeType(nodeTypeName, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
const nodeVersions = nodeTypes.value[nodeTypeName];
|
const nodeVersions = nodeTypes.value[nodeTypeName];
|
||||||
|
@ -70,32 +69,29 @@ export const useNodeTypesStore = defineStore(STORES.NODE_TYPES, () => {
|
||||||
const nodeType = nodeVersions[version ?? Math.max(...versionNumbers)];
|
const nodeType = nodeVersions[version ?? Math.max(...versionNumbers)];
|
||||||
return nodeType ?? null;
|
return nodeType ?? null;
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const getNodeVersions = computed(() => {
|
const getNodeVersions = (nodeTypeName: string): number[] => {
|
||||||
return (nodeTypeName: string): number[] => {
|
|
||||||
return Object.keys(nodeTypes.value[nodeTypeName] ?? {}).map(Number);
|
return Object.keys(nodeTypes.value[nodeTypeName] ?? {}).map(Number);
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const getCredentialOnlyNodeType = computed(() => {
|
const getCredentialOnlyNodeType = (
|
||||||
return (nodeTypeName: string, version?: number): INodeTypeDescription | null => {
|
nodeTypeName: string,
|
||||||
|
version?: number,
|
||||||
|
): INodeTypeDescription | null => {
|
||||||
const credentialName = utils.getCredentialTypeName(nodeTypeName);
|
const credentialName = utils.getCredentialTypeName(nodeTypeName);
|
||||||
const httpNode = getNodeType.value(
|
const httpNode = getNodeType(
|
||||||
HTTP_REQUEST_NODE_TYPE,
|
HTTP_REQUEST_NODE_TYPE,
|
||||||
version ?? CREDENTIAL_ONLY_HTTP_NODE_VERSION,
|
version ?? CREDENTIAL_ONLY_HTTP_NODE_VERSION,
|
||||||
);
|
);
|
||||||
const credential = useCredentialsStore().getCredentialTypeByName(credentialName);
|
const credential = useCredentialsStore().getCredentialTypeByName(credentialName);
|
||||||
return utils.getCredentialOnlyNodeType(httpNode, credential) ?? null;
|
return utils.getCredentialOnlyNodeType(httpNode, credential) ?? null;
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const isConfigNode = computed(() => {
|
const isConfigNode = (workflow: Workflow, node: INode, nodeTypeName: string): boolean => {
|
||||||
return (workflow: Workflow, node: INode, nodeTypeName: string): boolean => {
|
|
||||||
if (!workflow.nodes[node.name]) {
|
if (!workflow.nodes[node.name]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const nodeType = getNodeType.value(nodeTypeName);
|
const nodeType = getNodeType(nodeTypeName);
|
||||||
if (!nodeType) {
|
if (!nodeType) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -106,20 +102,15 @@ export const useNodeTypesStore = defineStore(STORES.NODE_TYPES, () => {
|
||||||
? outputTypes.filter((output) => output !== NodeConnectionType.Main).length > 0
|
? outputTypes.filter((output) => output !== NodeConnectionType.Main).length > 0
|
||||||
: false;
|
: false;
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const isTriggerNode = computed(() => {
|
const isTriggerNode = (nodeTypeName: string) => {
|
||||||
return (nodeTypeName: string) => {
|
const nodeType = getNodeType(nodeTypeName);
|
||||||
const nodeType = getNodeType.value(nodeTypeName);
|
|
||||||
return !!(nodeType && nodeType.group.includes('trigger'));
|
return !!(nodeType && nodeType.group.includes('trigger'));
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const isCoreNodeType = computed(() => {
|
const isCoreNodeType = (nodeType: INodeTypeDescription) => {
|
||||||
return (nodeType: INodeTypeDescription) => {
|
|
||||||
return nodeType.codex?.categories?.includes('Core Nodes');
|
return nodeType.codex?.categories?.includes('Core Nodes');
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const visibleNodeTypes = computed(() => {
|
const visibleNodeTypes = computed(() => {
|
||||||
return allLatestNodeTypes.value.filter((nodeType: INodeTypeDescription) => !nodeType.hidden);
|
return allLatestNodeTypes.value.filter((nodeType: INodeTypeDescription) => !nodeType.hidden);
|
||||||
|
@ -198,9 +189,8 @@ export const useNodeTypesStore = defineStore(STORES.NODE_TYPES, () => {
|
||||||
return nodesByOutputType;
|
return nodesByOutputType;
|
||||||
});
|
});
|
||||||
|
|
||||||
const isConfigurableNode = computed(() => {
|
const isConfigurableNode = (workflow: Workflow, node: INode, nodeTypeName: string): boolean => {
|
||||||
return (workflow: Workflow, node: INode, nodeTypeName: string): boolean => {
|
const nodeType = getNodeType(nodeTypeName);
|
||||||
const nodeType = getNodeType.value(nodeTypeName);
|
|
||||||
if (nodeType === null) {
|
if (nodeType === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +201,6 @@ export const useNodeTypesStore = defineStore(STORES.NODE_TYPES, () => {
|
||||||
? inputTypes.filter((input) => input !== NodeConnectionType.Main).length > 0
|
? inputTypes.filter((input) => input !== NodeConnectionType.Main).length > 0
|
||||||
: false;
|
: false;
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
|
|
|
@ -66,25 +66,19 @@ export const useTemplatesStore = defineStore(STORES.TEMPLATES, () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const getTemplatesById = computed(() => {
|
const getTemplatesById = (id: string): null | ITemplatesWorkflow => workflows.value[id];
|
||||||
return (id: string): null | ITemplatesWorkflow => workflows.value[id];
|
|
||||||
});
|
|
||||||
|
|
||||||
const getFullTemplateById = computed(() => {
|
const getFullTemplateById = (id: string): null | ITemplatesWorkflowFull => {
|
||||||
return (id: string): null | ITemplatesWorkflowFull => {
|
|
||||||
const template = workflows.value[id];
|
const template = workflows.value[id];
|
||||||
return template && 'full' in template && template.full ? template : null;
|
return template && 'full' in template && template.full ? template : null;
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const getCollectionById = computed(() => collections.value);
|
const getCollectionById = computed(() => collections.value);
|
||||||
|
|
||||||
const getCategoryById = computed(() => {
|
const getCategoryById = (id: string): null | ITemplatesCategory =>
|
||||||
return (id: string): null | ITemplatesCategory => categories.value[id as unknown as number];
|
categories.value[id as unknown as number];
|
||||||
});
|
|
||||||
|
|
||||||
const getSearchedCollections = computed(() => {
|
const getSearchedCollections = (query: ITemplatesQuery) => {
|
||||||
return (query: ITemplatesQuery) => {
|
|
||||||
const searchKey = getSearchKey(query);
|
const searchKey = getSearchKey(query);
|
||||||
const search = collectionSearches.value[searchKey];
|
const search = collectionSearches.value[searchKey];
|
||||||
if (!search) {
|
if (!search) {
|
||||||
|
@ -93,10 +87,8 @@ export const useTemplatesStore = defineStore(STORES.TEMPLATES, () => {
|
||||||
|
|
||||||
return search.collectionIds.map((collectionId: string) => collections.value[collectionId]);
|
return search.collectionIds.map((collectionId: string) => collections.value[collectionId]);
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const getSearchedWorkflows = computed(() => {
|
const getSearchedWorkflows = (query: ITemplatesQuery) => {
|
||||||
return (query: ITemplatesQuery) => {
|
|
||||||
const searchKey = getSearchKey(query);
|
const searchKey = getSearchKey(query);
|
||||||
const search = workflowSearches.value[searchKey];
|
const search = workflowSearches.value[searchKey];
|
||||||
if (!search) {
|
if (!search) {
|
||||||
|
@ -105,28 +97,22 @@ export const useTemplatesStore = defineStore(STORES.TEMPLATES, () => {
|
||||||
|
|
||||||
return search.workflowIds.map((workflowId: string) => workflows.value[workflowId]);
|
return search.workflowIds.map((workflowId: string) => workflows.value[workflowId]);
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const getSearchedWorkflowsTotal = computed(() => {
|
const getSearchedWorkflowsTotal = (query: ITemplatesQuery) => {
|
||||||
return (query: ITemplatesQuery) => {
|
|
||||||
const searchKey = getSearchKey(query);
|
const searchKey = getSearchKey(query);
|
||||||
const search = workflowSearches.value[searchKey];
|
const search = workflowSearches.value[searchKey];
|
||||||
|
|
||||||
return search ? search.totalWorkflows : 0;
|
return search ? search.totalWorkflows : 0;
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const isSearchLoadingMore = computed(() => {
|
const isSearchLoadingMore = (query: ITemplatesQuery) => {
|
||||||
return (query: ITemplatesQuery) => {
|
|
||||||
const searchKey = getSearchKey(query);
|
const searchKey = getSearchKey(query);
|
||||||
const search = workflowSearches.value[searchKey];
|
const search = workflowSearches.value[searchKey];
|
||||||
|
|
||||||
return Boolean(search && search.loadingMore);
|
return Boolean(search && search.loadingMore);
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const isSearchFinished = computed(() => {
|
const isSearchFinished = (query: ITemplatesQuery) => {
|
||||||
return (query: ITemplatesQuery) => {
|
|
||||||
const searchKey = getSearchKey(query);
|
const searchKey = getSearchKey(query);
|
||||||
const search = workflowSearches.value[searchKey];
|
const search = workflowSearches.value[searchKey];
|
||||||
|
|
||||||
|
@ -134,7 +120,6 @@ export const useTemplatesStore = defineStore(STORES.TEMPLATES, () => {
|
||||||
search && !search.loadingMore && search.totalWorkflows === search.workflowIds.length,
|
search && !search.loadingMore && search.totalWorkflows === search.workflowIds.length,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const hasCustomTemplatesHost = computed(() => {
|
const hasCustomTemplatesHost = computed(() => {
|
||||||
return settingsStore.templatesHost !== TEMPLATES_URLS.DEFAULT_API_HOST;
|
return settingsStore.templatesHost !== TEMPLATES_URLS.DEFAULT_API_HOST;
|
||||||
|
@ -317,7 +302,7 @@ export const useTemplatesStore = defineStore(STORES.TEMPLATES, () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCollections = async (query: ITemplatesQuery): Promise<ITemplatesCollection[]> => {
|
const getCollections = async (query: ITemplatesQuery): Promise<ITemplatesCollection[]> => {
|
||||||
const cachedResults = getSearchedCollections.value(query);
|
const cachedResults = getSearchedCollections(query);
|
||||||
if (cachedResults) {
|
if (cachedResults) {
|
||||||
return cachedResults;
|
return cachedResults;
|
||||||
}
|
}
|
||||||
|
@ -337,7 +322,7 @@ export const useTemplatesStore = defineStore(STORES.TEMPLATES, () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getWorkflows = async (query: ITemplatesQuery): Promise<ITemplatesWorkflow[]> => {
|
const getWorkflows = async (query: ITemplatesQuery): Promise<ITemplatesWorkflow[]> => {
|
||||||
const cachedResults = getSearchedWorkflows.value(query);
|
const cachedResults = getSearchedWorkflows(query);
|
||||||
if (cachedResults) {
|
if (cachedResults) {
|
||||||
categories.value = workflowSearches.value[getSearchKey(query)].categories ?? [];
|
categories.value = workflowSearches.value[getSearchKey(query)].categories ?? [];
|
||||||
return cachedResults;
|
return cachedResults;
|
||||||
|
@ -353,14 +338,14 @@ export const useTemplatesStore = defineStore(STORES.TEMPLATES, () => {
|
||||||
|
|
||||||
addWorkflows(payload.workflows);
|
addWorkflows(payload.workflows);
|
||||||
addWorkflowsSearch({ ...payload, query });
|
addWorkflowsSearch({ ...payload, query });
|
||||||
return getSearchedWorkflows.value(query) || [];
|
return getSearchedWorkflows(query) || [];
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMoreWorkflows = async (query: ITemplatesQuery): Promise<ITemplatesWorkflow[]> => {
|
const getMoreWorkflows = async (query: ITemplatesQuery): Promise<ITemplatesWorkflow[]> => {
|
||||||
if (isSearchLoadingMore.value(query) && !isSearchFinished.value(query)) {
|
if (isSearchLoadingMore(query) && !isSearchFinished(query)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const cachedResults = getSearchedWorkflows.value(query) || [];
|
const cachedResults = getSearchedWorkflows(query) || [];
|
||||||
const apiEndpoint: string = settingsStore.templatesHost;
|
const apiEndpoint: string = settingsStore.templatesHost;
|
||||||
|
|
||||||
setWorkflowSearchLoading(query);
|
setWorkflowSearchLoading(query);
|
||||||
|
@ -375,7 +360,7 @@ export const useTemplatesStore = defineStore(STORES.TEMPLATES, () => {
|
||||||
addWorkflows(payload.workflows);
|
addWorkflows(payload.workflows);
|
||||||
addWorkflowsSearch({ ...payload, query });
|
addWorkflowsSearch({ ...payload, query });
|
||||||
|
|
||||||
return getSearchedWorkflows.value(query) || [];
|
return getSearchedWorkflows(query) || [];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setWorkflowSearchLoaded(query);
|
setWorkflowSearchLoaded(query);
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -7,15 +7,13 @@ import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||||
import { i18n } from '@/plugins/i18n';
|
import { i18n } from '@/plugins/i18n';
|
||||||
import type { ProjectSharingData } from '@/types/projects.types';
|
import type { ProjectSharingData } from '@/types/projects.types';
|
||||||
import { splitName } from '@/utils/projects.utils';
|
import { splitName } from '@/utils/projects.utils';
|
||||||
import { computed } from 'vue';
|
|
||||||
|
|
||||||
export const useWorkflowsEEStore = defineStore(STORES.WORKFLOWS_EE, () => {
|
export const useWorkflowsEEStore = defineStore(STORES.WORKFLOWS_EE, () => {
|
||||||
const rootStore = useRootStore();
|
const rootStore = useRootStore();
|
||||||
const settingsStore = useSettingsStore();
|
const settingsStore = useSettingsStore();
|
||||||
const workflowStore = useWorkflowsStore();
|
const workflowStore = useWorkflowsStore();
|
||||||
|
|
||||||
const getWorkflowOwnerName = computed(() => {
|
const getWorkflowOwnerName = (
|
||||||
return (
|
|
||||||
workflowId: string,
|
workflowId: string,
|
||||||
fallback = i18n.baseText('workflows.shareModal.info.sharee.fallback'),
|
fallback = i18n.baseText('workflows.shareModal.info.sharee.fallback'),
|
||||||
): string => {
|
): string => {
|
||||||
|
@ -23,7 +21,6 @@ export const useWorkflowsEEStore = defineStore(STORES.WORKFLOWS_EE, () => {
|
||||||
const { name, email } = splitName(workflow?.homeProject?.name ?? '');
|
const { name, email } = splitName(workflow?.homeProject?.name ?? '');
|
||||||
return name ? (email ? `${name} (${email})` : name) : (email ?? fallback);
|
return name ? (email ? `${name} (${email})` : name) : (email ?? fallback);
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const setWorkflowSharedWith = (payload: {
|
const setWorkflowSharedWith = (payload: {
|
||||||
workflowId: string;
|
workflowId: string;
|
||||||
|
|
Loading…
Reference in a new issue