mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(core): Bring active executions into executions controller (no-changelog) (#8371)
This commit is contained in:
@@ -27,8 +27,8 @@ export async function getActiveWorkflows(context: IRestApiContext) {
|
||||
return await makeRestApiRequest(context, 'GET', '/active-workflows');
|
||||
}
|
||||
|
||||
export async function getCurrentExecutions(context: IRestApiContext, filter: IDataObject) {
|
||||
return await makeRestApiRequest(context, 'GET', '/executions-current', { filter });
|
||||
export async function getActiveExecutions(context: IRestApiContext, filter: IDataObject) {
|
||||
return await makeRestApiRequest(context, 'GET', '/executions/active', { filter });
|
||||
}
|
||||
|
||||
export async function getExecutions(
|
||||
|
||||
@@ -553,7 +553,7 @@ export default defineComponent({
|
||||
},
|
||||
async loadActiveExecutions(): Promise<void> {
|
||||
const activeExecutions = isEmpty(this.workflowFilterCurrent.metadata)
|
||||
? await this.workflowsStore.getCurrentExecutions(this.workflowFilterCurrent)
|
||||
? await this.workflowsStore.getActiveExecutions(this.workflowFilterCurrent)
|
||||
: [];
|
||||
for (const activeExecution of activeExecutions) {
|
||||
if (activeExecution.workflowId && !activeExecution.workflowName) {
|
||||
@@ -573,7 +573,7 @@ export default defineComponent({
|
||||
// ever get ids 500, 501, 502 and 503 when they finish
|
||||
const promises = [this.workflowsStore.getPastExecutions(filter, this.requestItemsPerRequest)];
|
||||
if (isEmpty(filter.metadata)) {
|
||||
promises.push(this.workflowsStore.getCurrentExecutions({}));
|
||||
promises.push(this.workflowsStore.getActiveExecutions({}));
|
||||
}
|
||||
|
||||
const results = await Promise.all(promises);
|
||||
|
||||
@@ -111,7 +111,7 @@ describe('ExecutionsList.vue', () => {
|
||||
workflowsStore = useWorkflowsStore();
|
||||
|
||||
vi.spyOn(workflowsStore, 'fetchAllWorkflows').mockResolvedValue(workflowsData);
|
||||
vi.spyOn(workflowsStore, 'getCurrentExecutions').mockResolvedValue([]);
|
||||
vi.spyOn(workflowsStore, 'getActiveExecutions').mockResolvedValue([]);
|
||||
});
|
||||
|
||||
it('should render empty list', async () => {
|
||||
|
||||
@@ -64,7 +64,7 @@ import { findLast } from 'lodash-es';
|
||||
import { useRootStore } from '@/stores/n8nRoot.store';
|
||||
import {
|
||||
getActiveWorkflows,
|
||||
getCurrentExecutions,
|
||||
getActiveExecutions,
|
||||
getExecutionData,
|
||||
getExecutions,
|
||||
getNewWorkflow,
|
||||
@@ -1276,7 +1276,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
|
||||
return await makeRestApiRequest(rootStore.getRestApiContext, 'GET', '/executions', sendData);
|
||||
},
|
||||
|
||||
async getCurrentExecutions(filter: IDataObject): Promise<IExecutionsCurrentSummaryExtended[]> {
|
||||
async getActiveExecutions(filter: IDataObject): Promise<IExecutionsCurrentSummaryExtended[]> {
|
||||
let sendData = {};
|
||||
if (filter) {
|
||||
sendData = {
|
||||
@@ -1287,7 +1287,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
|
||||
return await makeRestApiRequest(
|
||||
rootStore.getRestApiContext,
|
||||
'GET',
|
||||
'/executions-current',
|
||||
'/executions/active',
|
||||
sendData,
|
||||
);
|
||||
},
|
||||
@@ -1355,7 +1355,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
|
||||
return await makeRestApiRequest(
|
||||
rootStore.getRestApiContext,
|
||||
'POST',
|
||||
`/executions-current/${executionId}/stop`,
|
||||
`/executions/active/${executionId}/stop`,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1370,7 +1370,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
|
||||
try {
|
||||
const rootStore = useRootStore();
|
||||
if ((!requestFilter.status || !requestFilter.finished) && isEmpty(requestFilter.metadata)) {
|
||||
activeExecutions = await getCurrentExecutions(rootStore.getRestApiContext, {
|
||||
activeExecutions = await getActiveExecutions(rootStore.getRestApiContext, {
|
||||
workflowId: requestFilter.workflowId,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user