diff --git a/cmd/config/configuration.go b/cmd/config/configuration.go index f60a1aeb..d7e0abbf 100644 --- a/cmd/config/configuration.go +++ b/cmd/config/configuration.go @@ -30,7 +30,7 @@ var ( ) const ( - databaseConnectionString = "seelf.db?_journal=WAL&_timeout=5000&_foreign_keys=yes&_txlock=immediate" + databaseConnectionString = "seelf.db?_journal=WAL&_timeout=5000&_foreign_keys=yes&_txlock=immediate&_synchronous=NORMAL" defaultConfigFilename = "conf.yml" defaultPort = 8080 defaultHost = "" diff --git a/cmd/serve/front/src/lib/localization/en.ts b/cmd/serve/front/src/lib/localization/en.ts index 8ee82f53..46d1ea5e 100644 --- a/cmd/serve/front/src/lib/localization/en.ts +++ b/cmd/serve/front/src/lib/localization/en.ts @@ -111,14 +111,11 @@ You may reconsider and try to make the target reachable before deleting it.`, 'jobs.dates': 'Queued at / Not before', 'jobs.error': 'error', 'jobs.payload': 'payload', - 'jobs.policy': 'policy', - 'jobs.policy.preserve_group_order': 'Preserve group order on error', - 'jobs.policy.wait_others_resource_id': 'Wait for others jobs to finish on resource', - 'jobs.policy.cancellable': 'Cancellable', - 'jobs.policy.mergeable': 'Mergeable', 'jobs.group': 'group', - 'jobs.cancel': 'Cancel job', - 'jobs.cancel.confirm': 'Are you sure you want to cancel this job?', + 'jobs.dismiss': 'Dismiss job', + 'jobs.dismiss.confirm': 'Are you sure you want to dismiss this job?', + 'jobs.retry': 'Retry job', + 'jobs.retry.confirm': 'Are you sure you want to retry this job?', // Jobs names 'deployment.command.cleanup_app': 'Application cleanup', 'deployment.command.cleanup_target': 'Target cleanup', diff --git a/cmd/serve/front/src/lib/localization/fr.ts b/cmd/serve/front/src/lib/localization/fr.ts index 1bb645ea..62c447c8 100644 --- a/cmd/serve/front/src/lib/localization/fr.ts +++ b/cmd/serve/front/src/lib/localization/fr.ts @@ -115,14 +115,11 @@ Vous devriez probablement essayer de rendre la cible accessible avant de la supp 'jobs.dates': 'Créée le / Pas avant', 'jobs.error': 'erreur', 'jobs.payload': 'charge utile', - 'jobs.policy': 'politique', - 'jobs.policy.preserve_group_order': "Préserve l'ordre au sein du groupe en cas d'erreur", - 'jobs.policy.wait_others_resource_id': "Attend l'achèvement des tâches sur cette ressource", - 'jobs.policy.cancellable': 'Annulable', - 'jobs.policy.mergeable': 'Fusionnable', 'jobs.group': 'groupe', - 'jobs.cancel': 'Annuler la tâche', - 'jobs.cancel.confirm': 'Voulez-vous vraiment annuler la tâche ?', + 'jobs.dismiss': 'Ignorer la tâche', + 'jobs.dismiss.confirm': 'Voulez-vous vraiment ignorer la tâche ?', + 'jobs.retry': 'Relancer la tâche', + 'jobs.retry.confirm': 'Voulez-vous vraiment relancer la tâche ?', // Jobs names 'deployment.command.cleanup_app': "Nettoyage de l'application", 'deployment.command.cleanup_target': 'Nettoyage de la cible', diff --git a/cmd/serve/front/src/lib/resources/jobs.ts b/cmd/serve/front/src/lib/resources/jobs.ts index 8d0c5695..12d385d4 100644 --- a/cmd/serve/front/src/lib/resources/jobs.ts +++ b/cmd/serve/front/src/lib/resources/jobs.ts @@ -4,26 +4,18 @@ import type { Paginated } from '$lib/pagination'; export type Job = { id: string; - resource_id: string; group: string; message_name: string; message_data: string; queued_at: string; not_before: string; error_code?: string; - policy: number; retrieved: boolean; }; -export enum JobPolicy { - PreserveOrder = 1, - WaitForOthersResourceID = 2, - Cancellable = 4, - Mergeable = 8 -} - export interface JobsService { - delete(id: string): Promise; + dismiss(id: string): Promise; + retry(id: string): Promise; fetchAll(page: number, options?: FetchOptions): Promise>; queryAll(page: number): QueryResult>; } @@ -35,12 +27,18 @@ type Options = { export class RemoteJobsService implements JobsService { constructor(private readonly _fetcher: FetchService, private readonly _options: Options) {} - delete(id: string): Promise { + dismiss(id: string): Promise { return this._fetcher.delete(`/api/v1/jobs/${id}`, { invalidate: ['/api/v1/jobs'] }); } + retry(id: string): Promise { + return this._fetcher.put(`/api/v1/jobs/${id}`, { + invalidate: ['/api/v1/jobs'] + }); + } + queryAll(page: number): QueryResult> { return this._fetcher.query('/api/v1/jobs', { refreshInterval: this._options.pollingInterval, diff --git a/cmd/serve/front/src/routes/(main)/jobs/+page.svelte b/cmd/serve/front/src/routes/(main)/jobs/+page.svelte index b68341db..0d5b2e13 100644 --- a/cmd/serve/front/src/routes/(main)/jobs/+page.svelte +++ b/cmd/serve/front/src/routes/(main)/jobs/+page.svelte @@ -5,9 +5,9 @@ import Display from '$components/display.svelte'; import Pagination from '$components/pagination.svelte'; import Stack from '$components/stack.svelte'; - import CancelButton from './cancel-button.svelte'; - import service, { JobPolicy } from '$lib/resources/jobs'; + import service from '$lib/resources/jobs'; import l, { type AppTranslationsString } from '$lib/localization'; + import JobActionButton from './job-action-button.svelte'; let page = 1; @@ -15,32 +15,6 @@ return l.translate(messageName as AppTranslationsString); } - function translatePolicy(policy: number) { - if (!policy) { - return '-'; - } - - const policies: string[] = []; - - if ((policy & JobPolicy.PreserveOrder) !== 0) { - policies.push(l.translate('jobs.policy.preserve_group_order')); - } - - if ((policy & JobPolicy.WaitForOthersResourceID) !== 0) { - policies.push(l.translate('jobs.policy.wait_others_resource_id')); - } - - if ((policy & JobPolicy.Cancellable) !== 0) { - policies.push(l.translate('jobs.policy.cancellable')); - } - - if ((policy & JobPolicy.Mergeable) !== 0) { - policies.push(l.translate('jobs.policy.mergeable')); - } - - return policies.join(', '); - } - $: ({ data } = service.queryAll(page)); @@ -74,7 +48,6 @@ {:else if value === 'resource'}
{translateMessageName(item.message_name)}
-
{item.resource_id}
{/if} @@ -87,15 +60,15 @@ {item.message_data} - - {translatePolicy(item.policy)} - {item.error_code ?? '-'} - {#if (item.policy & JobPolicy.Cancellable) !== 0} - + {#if item.error_code} + + + + {/if} diff --git a/cmd/serve/front/src/routes/(main)/jobs/cancel-button.svelte b/cmd/serve/front/src/routes/(main)/jobs/job-action-button.svelte similarity index 59% rename from cmd/serve/front/src/routes/(main)/jobs/cancel-button.svelte rename to cmd/serve/front/src/routes/(main)/jobs/job-action-button.svelte index 66150549..d3d86fd4 100644 --- a/cmd/serve/front/src/routes/(main)/jobs/cancel-button.svelte +++ b/cmd/serve/front/src/routes/(main)/jobs/job-action-button.svelte @@ -1,26 +1,32 @@ -