fix(editor): Adding projectId execution filters

This commit is contained in:
Csaba Tuncsik 2024-11-05 16:17:02 +01:00
parent 5af35abae8
commit 91a61abd47
No known key found for this signature in database
2 changed files with 12 additions and 3 deletions

View file

@ -1351,6 +1351,7 @@ export type ExecutionFilterType = {
export type ExecutionsQueryFilter = { export type ExecutionsQueryFilter = {
status?: ExecutionStatus[]; status?: ExecutionStatus[];
projectId?: string;
workflowId?: string; workflowId?: string;
finished?: boolean; finished?: boolean;
waitTill?: boolean; waitTill?: boolean;

View file

@ -14,9 +14,11 @@ import type {
import { useRootStore } from '@/stores/root.store'; import { useRootStore } from '@/stores/root.store';
import { makeRestApiRequest, unflattenExecutionData } from '@/utils/apiUtils'; import { makeRestApiRequest, unflattenExecutionData } from '@/utils/apiUtils';
import { executionFilterToQueryFilter, getDefaultExecutionFilters } from '@/utils/executionUtils'; import { executionFilterToQueryFilter, getDefaultExecutionFilters } from '@/utils/executionUtils';
import { useProjectsStore } from '@/stores/projects.store';
export const useExecutionsStore = defineStore('executions', () => { export const useExecutionsStore = defineStore('executions', () => {
const rootStore = useRootStore(); const rootStore = useRootStore();
const projectsStore = useProjectsStore();
const loading = ref(false); const loading = ref(false);
const itemsPerPage = ref(10); const itemsPerPage = ref(10);
@ -24,9 +26,15 @@ export const useExecutionsStore = defineStore('executions', () => {
const activeExecution = ref<ExecutionSummary | null>(null); const activeExecution = ref<ExecutionSummary | null>(null);
const filters = ref<ExecutionFilterType>(getDefaultExecutionFilters()); const filters = ref<ExecutionFilterType>(getDefaultExecutionFilters());
const executionsFilters = computed<ExecutionsQueryFilter>(() => const executionsFilters = computed<ExecutionsQueryFilter>(() => {
executionFilterToQueryFilter(filters.value), const filter = executionFilterToQueryFilter(filters.value);
);
if (projectsStore.currentProjectId) {
filter.projectId = projectsStore.currentProjectId;
}
return filter;
});
const currentExecutionsFilters = computed<Partial<ExecutionFilterType>>(() => ({ const currentExecutionsFilters = computed<Partial<ExecutionFilterType>>(() => ({
...(filters.value.workflowId !== 'all' ? { workflowId: filters.value.workflowId } : {}), ...(filters.value.workflowId !== 'all' ? { workflowId: filters.value.workflowId } : {}),
})); }));