diff --git a/assets/vue/app/domain/system/application/store/logsStore.js b/assets/vue/app/domain/system/application/store/logsStore.js index d9ea76a..e11743c 100644 --- a/assets/vue/app/domain/system/application/store/logsStore.js +++ b/assets/vue/app/domain/system/application/store/logsStore.js @@ -3,6 +3,13 @@ import { ApiJobRepository } from '../../../activity/infrastructure/api/ApiJobRep const jobRepository = new ApiJobRepository(); +// Statuts disponibles par filtre +const STATUS_MAP = { + failed: ['failed'], + completed: ['completed'], + all: ['failed', 'completed'], +}; + export const useLogsStore = defineStore('logs', { state: () => ({ logs: [], @@ -16,6 +23,7 @@ export const useLogsStore = defineStore('logs', { hasPreviousPage: false, sortBy: 'createdAt', sortOrder: 'DESC', + statusFilter: 'failed', // 'failed' | 'completed' | 'all' }), getters: { @@ -34,7 +42,7 @@ export const useLogsStore = defineStore('logs', { limit: this.limit, sortBy: this.sortBy, sortOrder: this.sortOrder, - status: ['failed'], + status: STATUS_MAP[this.statusFilter], type: 'scraping_job', }); @@ -65,6 +73,12 @@ export const useLogsStore = defineStore('logs', { await this.loadLogs(1); }, + async setStatusFilter(filter) { + this.statusFilter = filter; + this.currentPage = 1; + await this.loadLogs(1); + }, + async deleteLog(id) { try { await jobRepository.deleteJob(id); @@ -81,7 +95,10 @@ export const useLogsStore = defineStore('logs', { this.error = null; try { - await jobRepository.deleteJobs({ status: 'failed', type: 'scraping_job' }); + await jobRepository.deleteJobs({ + status: STATUS_MAP[this.statusFilter].join(','), + type: 'scraping_job', + }); await this.loadLogs(1); } catch (error) { this.error = error.message; diff --git a/assets/vue/app/domain/system/presentation/components/LogItem.vue b/assets/vue/app/domain/system/presentation/components/LogItem.vue index cd4be63..2b671dc 100644 --- a/assets/vue/app/domain/system/presentation/components/LogItem.vue +++ b/assets/vue/app/domain/system/presentation/components/LogItem.vue @@ -1,6 +1,6 @@