@abyss-project/commons-front-core 18.1.0 → 18.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +92 -99
- package/catalog/pages/CookieConsent.tsx +112 -61
- package/catalog/pages/DeliveryHistory.tsx +66 -79
- package/catalog/pages/DeliverySubscriptions.tsx +110 -127
- package/catalog/pages/ScheduledTasks.tsx +117 -117
- package/catalog/specs/captures.spec.ts +145 -145
- package/catalog/specs/cookie-consent-modal.spec.ts +145 -5
- package/catalog/specs/write-capture-index.ts +81 -81
- package/dist/CookieConsentSettings-JQ9582_7.js +687 -0
- package/dist/{Surface-z5TuQzlh.js → Surface-dziv23sf.js} +40 -50
- package/dist/{Tabs-C4K0mLME.js → Tabs-_onUZBA-.js} +1 -1
- package/dist/components/business/CookieConsent/containing-block.d.ts +19 -0
- package/dist/components/business/CookieConsent/containing-block.spec.d.ts +1 -0
- package/dist/components/business/CookieConsent/use-banner-portal.d.ts +9 -0
- package/dist/components/business/Deliveries/DeliveryHistory.component.d.ts +3 -4
- package/dist/components/business/Deliveries/DeliverySubscriptionForm.d.ts +2 -3
- package/dist/components/business/Deliveries/deliveries.logic.d.ts +0 -11
- package/dist/components/business/Deliveries/deliveries.types.d.ts +4 -12
- package/dist/cookie-consent.js +2 -2
- package/dist/{design-theme-BFkCN7Nz.js → design-theme-B3C3z1gE.js} +1 -1
- package/dist/{editors-Eb3PHnxn.js → editors-BhQlONOy.js} +27 -27
- package/dist/editors.js +1 -1
- package/dist/hooks/use-rich-intl.hook.d.ts +2 -12
- package/dist/{index-CYBvIQsH.js → index-B6LMTOKG.js} +3 -3
- package/dist/{index-CUhMNEUo.js → index-B6w5_TeJ.js} +3 -3
- package/dist/{index-Dqm1dC1j.js → index-BBF-FvT6.js} +2 -2
- package/dist/{index-B76nCWpd.js → index-BGAZK8Vk.js} +2 -2
- package/dist/{index-CFDEfvCD.js → index-BGJobvxw.js} +1 -1
- package/dist/{index-CtkfWhK1.js → index-BTDlbjWW.js} +2 -2
- package/dist/{index-BKRudpMw.js → index-BcjlG5TB.js} +2 -2
- package/dist/{index-BcO-JFrs.js → index-BeMiREqf.js} +2 -2
- package/dist/{index-CWD0waD8.js → index-ByN6DcaL.js} +2 -2
- package/dist/{index-BaL2x2GW.js → index-CJI1dJrw.js} +3 -3
- package/dist/{index-BlOP01yA.js → index-D1mQgWN3.js} +2 -2
- package/dist/{index-z5ZOXlY8.js → index-DLlWMDxB.js} +4 -4
- package/dist/{index-Ckzcg8qD.js → index-DNd8NZnu.js} +4 -4
- package/dist/{index-Ckzmgx9X.js → index-Dakpr4C1.js} +3 -3
- package/dist/{index-CrZZo4r1.js → index-DkZAsKob.js} +2 -2
- package/dist/{index-CQ7z2zKY.js → index-DprTO7yi.js} +4 -4
- package/dist/{index-CtVoDSIn.js → index-N4BwXTyk.js} +2 -2
- package/dist/{index-Bw4XnSa0.js → index-V4F4Sk7y.js} +2 -2
- package/dist/{index-CRFGogWn.js → index-y-TnfE6Z.js} +2 -2
- package/dist/{index-2lNOK7eK.js → index-yFJTDKIX.js} +2 -2
- package/dist/{index-DRtBc440.js → index-ytgNPz5f.js} +2 -2
- package/dist/index.js +5790 -5880
- package/dist/legacy.js +6 -6
- package/dist/test/vitest-workers.d.ts +18 -0
- package/dist/test/vitest-workers.spec.d.ts +1 -0
- package/dist/translations/en.d.ts +1 -6
- package/dist/translations/fr.d.ts +1 -6
- package/package.json +3 -3
- package/vitest.config.ts +6 -0
- package/dist/CookieConsentSettings-DUoKKRMZ.js +0 -595
|
@@ -1,127 +1,110 @@
|
|
|
1
|
-
import { DeliverySubscriptions } from '../../src/components/business/Deliveries/DeliverySubscriptions.component';
|
|
2
|
-
import type { DeliverySubscriptionsProps } from '../../src/components/business/Deliveries/deliveries.types';
|
|
3
|
-
import {
|
|
4
|
-
EVENT_TYPES_BY_SOURCE,
|
|
5
|
-
SOURCES,
|
|
6
|
-
deliveryFormat,
|
|
7
|
-
page,
|
|
8
|
-
source,
|
|
9
|
-
subscription,
|
|
10
|
-
} from '../../src/components/business/Deliveries/test-support/deliveries.fixtures';
|
|
11
|
-
import { Example, LastEvent, Showcase, useEventLog } from '../frame';
|
|
12
|
-
|
|
13
|
-
const PERMISSIONS = {
|
|
14
|
-
canCreate: true,
|
|
15
|
-
canUpdate: true,
|
|
16
|
-
canDelete: true,
|
|
17
|
-
canResetSecret: true,
|
|
18
|
-
canReadHistory: true,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const POPULATED = [
|
|
22
|
-
subscription(),
|
|
23
|
-
subscription({
|
|
24
|
-
id: 'sub-2',
|
|
25
|
-
source: source('FORM'),
|
|
26
|
-
eventTypes: ['FORM_SUBMISSION'],
|
|
27
|
-
url: 'https://discord.com/api/webhooks/1234/abcd',
|
|
28
|
-
format: deliveryFormat('DISCORD'),
|
|
29
|
-
consecutiveFailures: 3,
|
|
30
|
-
}),
|
|
31
|
-
subscription({
|
|
32
|
-
id: 'sub-3',
|
|
33
|
-
source: source('STORAGE'),
|
|
34
|
-
eventTypes: ['STORAGE_UPLOAD', 'STORAGE_DELETE'],
|
|
35
|
-
url: 'https://files.example.com/hooks/storage',
|
|
36
|
-
isEnabled: false,
|
|
37
|
-
disabledAt: new Date('2026-11-02T08:00:00Z'),
|
|
38
|
-
consecutiveFailures: 10,
|
|
39
|
-
}),
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
const secretFor = (id: string) => `whsec_catalog_${id}_do-not-use`;
|
|
43
|
-
|
|
44
|
-
export const DeliverySubscriptionsPage = () => {
|
|
45
|
-
const { log } = useEventLog();
|
|
46
|
-
const base = (
|
|
47
|
-
list: DeliverySubscriptionsProps['list'],
|
|
48
|
-
): DeliverySubscriptionsProps => ({
|
|
49
|
-
sources: SOURCES,
|
|
50
|
-
eventTypesBySource: EVENT_TYPES_BY_SOURCE,
|
|
51
|
-
list,
|
|
52
|
-
create: async (body) => {
|
|
53
|
-
log(`créer ${body.url}`);
|
|
54
|
-
return {
|
|
55
|
-
deliverySubscription: subscription({ id: 'sub-new', url: body.url }),
|
|
56
|
-
secret: secretFor('new'),
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
update: async (id, body) => {
|
|
60
|
-
log(`modifier ${id}`);
|
|
61
|
-
return subscription({ id, ...body });
|
|
62
|
-
},
|
|
63
|
-
remove: async (id) => log(`supprimer ${id}`),
|
|
64
|
-
resetSecret: async (id) => {
|
|
65
|
-
log(`secret ${id}`);
|
|
66
|
-
return {
|
|
67
|
-
deliverySubscription: subscription({ id }),
|
|
68
|
-
secret: secretFor(id),
|
|
69
|
-
};
|
|
70
|
-
},
|
|
71
|
-
onOpenHistory: (row) => log(`historique ${row.id}`),
|
|
72
|
-
flowUrl: 'https://flow.abyss.example/deliveries',
|
|
73
|
-
permissions: PERMISSIONS,
|
|
74
|
-
});
|
|
75
|
-
return (
|
|
76
|
-
<Showcase
|
|
77
|
-
family="Métier"
|
|
78
|
-
name="DeliverySubscriptions"
|
|
79
|
-
description="Les abonnements de livraison d'un périmètre : liste, création et édition en panneau, secret affiché une seule fois, activation, suppression confirmée. Les données et les actions passent par des props."
|
|
80
|
-
>
|
|
81
|
-
<Example title="Peuplé" maxWidth={1100}>
|
|
82
|
-
<DeliverySubscriptions {...base(async () => page(POPULATED))} />
|
|
83
|
-
</Example>
|
|
84
|
-
<Example title="
|
|
85
|
-
<DeliverySubscriptions
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
</Example>
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
</Example>
|
|
112
|
-
<Example title="Lecture seule" maxWidth={1100}>
|
|
113
|
-
<DeliverySubscriptions
|
|
114
|
-
{...base(async () => page(POPULATED))}
|
|
115
|
-
permissions={{
|
|
116
|
-
canCreate: false,
|
|
117
|
-
canUpdate: false,
|
|
118
|
-
canDelete: false,
|
|
119
|
-
canResetSecret: false,
|
|
120
|
-
canReadHistory: true,
|
|
121
|
-
}}
|
|
122
|
-
/>
|
|
123
|
-
</Example>
|
|
124
|
-
<LastEvent />
|
|
125
|
-
</Showcase>
|
|
126
|
-
);
|
|
127
|
-
};
|
|
1
|
+
import { DeliverySubscriptions } from '../../src/components/business/Deliveries/DeliverySubscriptions.component';
|
|
2
|
+
import type { DeliverySubscriptionsProps } from '../../src/components/business/Deliveries/deliveries.types';
|
|
3
|
+
import {
|
|
4
|
+
EVENT_TYPES_BY_SOURCE,
|
|
5
|
+
SOURCES,
|
|
6
|
+
deliveryFormat,
|
|
7
|
+
page,
|
|
8
|
+
source,
|
|
9
|
+
subscription,
|
|
10
|
+
} from '../../src/components/business/Deliveries/test-support/deliveries.fixtures';
|
|
11
|
+
import { Example, LastEvent, Showcase, useEventLog } from '../frame';
|
|
12
|
+
|
|
13
|
+
const PERMISSIONS = {
|
|
14
|
+
canCreate: true,
|
|
15
|
+
canUpdate: true,
|
|
16
|
+
canDelete: true,
|
|
17
|
+
canResetSecret: true,
|
|
18
|
+
canReadHistory: true,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const POPULATED = [
|
|
22
|
+
subscription(),
|
|
23
|
+
subscription({
|
|
24
|
+
id: 'sub-2',
|
|
25
|
+
source: source('FORM'),
|
|
26
|
+
eventTypes: ['FORM_SUBMISSION'],
|
|
27
|
+
url: 'https://discord.com/api/webhooks/1234/abcd',
|
|
28
|
+
format: deliveryFormat('DISCORD'),
|
|
29
|
+
consecutiveFailures: 3,
|
|
30
|
+
}),
|
|
31
|
+
subscription({
|
|
32
|
+
id: 'sub-3',
|
|
33
|
+
source: source('STORAGE'),
|
|
34
|
+
eventTypes: ['STORAGE_UPLOAD', 'STORAGE_DELETE'],
|
|
35
|
+
url: 'https://files.example.com/hooks/storage',
|
|
36
|
+
isEnabled: false,
|
|
37
|
+
disabledAt: new Date('2026-11-02T08:00:00Z'),
|
|
38
|
+
consecutiveFailures: 10,
|
|
39
|
+
}),
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
const secretFor = (id: string) => `whsec_catalog_${id}_do-not-use`;
|
|
43
|
+
|
|
44
|
+
export const DeliverySubscriptionsPage = () => {
|
|
45
|
+
const { log } = useEventLog();
|
|
46
|
+
const base = (
|
|
47
|
+
list: DeliverySubscriptionsProps['list'],
|
|
48
|
+
): DeliverySubscriptionsProps => ({
|
|
49
|
+
sources: SOURCES,
|
|
50
|
+
eventTypesBySource: EVENT_TYPES_BY_SOURCE,
|
|
51
|
+
list,
|
|
52
|
+
create: async (body) => {
|
|
53
|
+
log(`créer ${body.url}`);
|
|
54
|
+
return {
|
|
55
|
+
deliverySubscription: subscription({ id: 'sub-new', url: body.url }),
|
|
56
|
+
secret: secretFor('new'),
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
update: async (id, body) => {
|
|
60
|
+
log(`modifier ${id}`);
|
|
61
|
+
return subscription({ id, ...body });
|
|
62
|
+
},
|
|
63
|
+
remove: async (id) => log(`supprimer ${id}`),
|
|
64
|
+
resetSecret: async (id) => {
|
|
65
|
+
log(`secret ${id}`);
|
|
66
|
+
return {
|
|
67
|
+
deliverySubscription: subscription({ id }),
|
|
68
|
+
secret: secretFor(id),
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
onOpenHistory: (row) => log(`historique ${row.id}`),
|
|
72
|
+
flowUrl: 'https://flow.abyss.example/deliveries',
|
|
73
|
+
permissions: PERMISSIONS,
|
|
74
|
+
});
|
|
75
|
+
return (
|
|
76
|
+
<Showcase
|
|
77
|
+
family="Métier"
|
|
78
|
+
name="DeliverySubscriptions"
|
|
79
|
+
description="Les abonnements de livraison d'un périmètre : liste, création et édition en panneau, secret affiché une seule fois, activation, suppression confirmée. Les données et les actions passent par des props."
|
|
80
|
+
>
|
|
81
|
+
<Example title="Peuplé" maxWidth={1100}>
|
|
82
|
+
<DeliverySubscriptions {...base(async () => page(POPULATED))} />
|
|
83
|
+
</Example>
|
|
84
|
+
<Example title="Vide" maxWidth={1100}>
|
|
85
|
+
<DeliverySubscriptions {...base(async () => page([]))} />
|
|
86
|
+
</Example>
|
|
87
|
+
<Example title="En cours de chargement" maxWidth={1100}>
|
|
88
|
+
<DeliverySubscriptions {...base(() => new Promise(() => undefined))} />
|
|
89
|
+
</Example>
|
|
90
|
+
<Example title="Le chargement a échoué" maxWidth={1100}>
|
|
91
|
+
<DeliverySubscriptions
|
|
92
|
+
{...base(() => Promise.reject(new Error('Flow indisponible')))}
|
|
93
|
+
/>
|
|
94
|
+
</Example>
|
|
95
|
+
<Example title="Lecture seule" maxWidth={1100}>
|
|
96
|
+
<DeliverySubscriptions
|
|
97
|
+
{...base(async () => page(POPULATED))}
|
|
98
|
+
permissions={{
|
|
99
|
+
canCreate: false,
|
|
100
|
+
canUpdate: false,
|
|
101
|
+
canDelete: false,
|
|
102
|
+
canResetSecret: false,
|
|
103
|
+
canReadHistory: true,
|
|
104
|
+
}}
|
|
105
|
+
/>
|
|
106
|
+
</Example>
|
|
107
|
+
<LastEvent />
|
|
108
|
+
</Showcase>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
import { ScheduledTasks } from '../../src/components/business/Deliveries/ScheduledTasks.component';
|
|
2
|
-
import type { ScheduledTasksProps } from '../../src/components/business/Deliveries/deliveries.types';
|
|
3
|
-
import {
|
|
4
|
-
page,
|
|
5
|
-
runStatus,
|
|
6
|
-
scheduledTask,
|
|
7
|
-
taskRun,
|
|
8
|
-
} from '../../src/components/business/Deliveries/test-support/deliveries.fixtures';
|
|
9
|
-
import { Example, LastEvent, Showcase, useEventLog } from '../frame';
|
|
10
|
-
|
|
11
|
-
const PERMISSIONS = {
|
|
12
|
-
canCreate: true,
|
|
13
|
-
canUpdate: true,
|
|
14
|
-
canDelete: true,
|
|
15
|
-
canRegenerateSecret: true,
|
|
16
|
-
canTrigger: true,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const POPULATED = [
|
|
20
|
-
scheduledTask(),
|
|
21
|
-
scheduledTask({
|
|
22
|
-
id: 'task-2',
|
|
23
|
-
name: 'Rapport hebdomadaire',
|
|
24
|
-
schedule: '@weekly',
|
|
25
|
-
isEnabled: false,
|
|
26
|
-
lastRunAt: null,
|
|
27
|
-
}),
|
|
28
|
-
scheduledTask({
|
|
29
|
-
id: 'task-3',
|
|
30
|
-
name: 'Synchronisation des factures',
|
|
31
|
-
schedule: '*/15 * * * *',
|
|
32
|
-
consecutiveFailures: 4,
|
|
33
|
-
}),
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
const RUNS = [
|
|
37
|
-
taskRun(),
|
|
38
|
-
taskRun({
|
|
39
|
-
id: 'run-2',
|
|
40
|
-
scheduledFor: new Date('2026-11-01T03:00:00Z'),
|
|
41
|
-
status: runStatus('FAILED'),
|
|
42
|
-
responseCode: 500,
|
|
43
|
-
durationMs: 1204,
|
|
44
|
-
}),
|
|
45
|
-
taskRun({
|
|
46
|
-
id: 'run-3',
|
|
47
|
-
scheduledFor: new Date('2026-10-31T03:00:00Z'),
|
|
48
|
-
status: runStatus('TIMED_OUT'),
|
|
49
|
-
responseCode: null,
|
|
50
|
-
durationMs: 30000,
|
|
51
|
-
}),
|
|
52
|
-
];
|
|
53
|
-
|
|
54
|
-
export const ScheduledTasksPage = () => {
|
|
55
|
-
const { log } = useEventLog();
|
|
56
|
-
const base = (list: ScheduledTasksProps['list']): ScheduledTasksProps => ({
|
|
57
|
-
list,
|
|
58
|
-
create: async (body) => {
|
|
59
|
-
log(`créer ${body.name}`);
|
|
60
|
-
return {
|
|
61
|
-
scheduledTask: scheduledTask({ id: 'task-new', isEnabled: false }),
|
|
62
|
-
secret: 'cron_catalog_new_do-not-use',
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
update: async (id, body) => {
|
|
66
|
-
log(`modifier ${id}`);
|
|
67
|
-
return scheduledTask({ id, ...body });
|
|
68
|
-
},
|
|
69
|
-
remove: async (id) => log(`supprimer ${id}`),
|
|
70
|
-
regenerateSecret: async (id) => {
|
|
71
|
-
log(`secret ${id}`);
|
|
72
|
-
return {
|
|
73
|
-
scheduledTask: scheduledTask({ id }),
|
|
74
|
-
secret: 'cron_catalog_regenerated_do-not-use',
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
trigger: async (id) => log(`lancer ${id}`),
|
|
78
|
-
listRuns: async () => page(RUNS),
|
|
79
|
-
permissions: PERMISSIONS,
|
|
80
|
-
flowUrl: 'https://flow.abyss.example/scheduled-tasks',
|
|
81
|
-
});
|
|
82
|
-
return (
|
|
83
|
-
<Showcase
|
|
84
|
-
family="Métier"
|
|
85
|
-
name="ScheduledTasks"
|
|
86
|
-
description="Les tâches planifiées d'un périmètre : liste, création et édition en panneau, « lancer maintenant », secret affiché une seule fois et historique des exécutions."
|
|
87
|
-
>
|
|
88
|
-
<Example title="Peuplé" maxWidth={1100}>
|
|
89
|
-
<ScheduledTasks {...base(async () => page(POPULATED))} />
|
|
90
|
-
</Example>
|
|
91
|
-
<Example title="Vide" maxWidth={1100}>
|
|
92
|
-
<ScheduledTasks {...base(async () => page([]))} />
|
|
93
|
-
</Example>
|
|
94
|
-
<Example title="En cours de chargement" maxWidth={1100}>
|
|
95
|
-
<ScheduledTasks {...base(() => new Promise(() => undefined))} />
|
|
96
|
-
</Example>
|
|
97
|
-
<Example title="Le chargement a échoué" maxWidth={1100}>
|
|
98
|
-
<ScheduledTasks
|
|
99
|
-
{...base(() => Promise.reject(new Error('Flow indisponible')))}
|
|
100
|
-
/>
|
|
101
|
-
</Example>
|
|
102
|
-
<Example title="Lecture seule" maxWidth={1100}>
|
|
103
|
-
<ScheduledTasks
|
|
104
|
-
{...base(async () => page(POPULATED))}
|
|
105
|
-
permissions={{
|
|
106
|
-
canCreate: false,
|
|
107
|
-
canUpdate: false,
|
|
108
|
-
canDelete: false,
|
|
109
|
-
canRegenerateSecret: false,
|
|
110
|
-
canTrigger: false,
|
|
111
|
-
}}
|
|
112
|
-
/>
|
|
113
|
-
</Example>
|
|
114
|
-
<LastEvent />
|
|
115
|
-
</Showcase>
|
|
116
|
-
);
|
|
117
|
-
};
|
|
1
|
+
import { ScheduledTasks } from '../../src/components/business/Deliveries/ScheduledTasks.component';
|
|
2
|
+
import type { ScheduledTasksProps } from '../../src/components/business/Deliveries/deliveries.types';
|
|
3
|
+
import {
|
|
4
|
+
page,
|
|
5
|
+
runStatus,
|
|
6
|
+
scheduledTask,
|
|
7
|
+
taskRun,
|
|
8
|
+
} from '../../src/components/business/Deliveries/test-support/deliveries.fixtures';
|
|
9
|
+
import { Example, LastEvent, Showcase, useEventLog } from '../frame';
|
|
10
|
+
|
|
11
|
+
const PERMISSIONS = {
|
|
12
|
+
canCreate: true,
|
|
13
|
+
canUpdate: true,
|
|
14
|
+
canDelete: true,
|
|
15
|
+
canRegenerateSecret: true,
|
|
16
|
+
canTrigger: true,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const POPULATED = [
|
|
20
|
+
scheduledTask(),
|
|
21
|
+
scheduledTask({
|
|
22
|
+
id: 'task-2',
|
|
23
|
+
name: 'Rapport hebdomadaire',
|
|
24
|
+
schedule: '@weekly',
|
|
25
|
+
isEnabled: false,
|
|
26
|
+
lastRunAt: null,
|
|
27
|
+
}),
|
|
28
|
+
scheduledTask({
|
|
29
|
+
id: 'task-3',
|
|
30
|
+
name: 'Synchronisation des factures',
|
|
31
|
+
schedule: '*/15 * * * *',
|
|
32
|
+
consecutiveFailures: 4,
|
|
33
|
+
}),
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
const RUNS = [
|
|
37
|
+
taskRun(),
|
|
38
|
+
taskRun({
|
|
39
|
+
id: 'run-2',
|
|
40
|
+
scheduledFor: new Date('2026-11-01T03:00:00Z'),
|
|
41
|
+
status: runStatus('FAILED'),
|
|
42
|
+
responseCode: 500,
|
|
43
|
+
durationMs: 1204,
|
|
44
|
+
}),
|
|
45
|
+
taskRun({
|
|
46
|
+
id: 'run-3',
|
|
47
|
+
scheduledFor: new Date('2026-10-31T03:00:00Z'),
|
|
48
|
+
status: runStatus('TIMED_OUT'),
|
|
49
|
+
responseCode: null,
|
|
50
|
+
durationMs: 30000,
|
|
51
|
+
}),
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
export const ScheduledTasksPage = () => {
|
|
55
|
+
const { log } = useEventLog();
|
|
56
|
+
const base = (list: ScheduledTasksProps['list']): ScheduledTasksProps => ({
|
|
57
|
+
list,
|
|
58
|
+
create: async (body) => {
|
|
59
|
+
log(`créer ${body.name}`);
|
|
60
|
+
return {
|
|
61
|
+
scheduledTask: scheduledTask({ id: 'task-new', isEnabled: false }),
|
|
62
|
+
secret: 'cron_catalog_new_do-not-use',
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
update: async (id, body) => {
|
|
66
|
+
log(`modifier ${id}`);
|
|
67
|
+
return scheduledTask({ id, ...body });
|
|
68
|
+
},
|
|
69
|
+
remove: async (id) => log(`supprimer ${id}`),
|
|
70
|
+
regenerateSecret: async (id) => {
|
|
71
|
+
log(`secret ${id}`);
|
|
72
|
+
return {
|
|
73
|
+
scheduledTask: scheduledTask({ id }),
|
|
74
|
+
secret: 'cron_catalog_regenerated_do-not-use',
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
trigger: async (id) => log(`lancer ${id}`),
|
|
78
|
+
listRuns: async () => page(RUNS),
|
|
79
|
+
permissions: PERMISSIONS,
|
|
80
|
+
flowUrl: 'https://flow.abyss.example/scheduled-tasks',
|
|
81
|
+
});
|
|
82
|
+
return (
|
|
83
|
+
<Showcase
|
|
84
|
+
family="Métier"
|
|
85
|
+
name="ScheduledTasks"
|
|
86
|
+
description="Les tâches planifiées d'un périmètre : liste, création et édition en panneau, « lancer maintenant », secret affiché une seule fois et historique des exécutions."
|
|
87
|
+
>
|
|
88
|
+
<Example title="Peuplé" maxWidth={1100}>
|
|
89
|
+
<ScheduledTasks {...base(async () => page(POPULATED))} />
|
|
90
|
+
</Example>
|
|
91
|
+
<Example title="Vide" maxWidth={1100}>
|
|
92
|
+
<ScheduledTasks {...base(async () => page([]))} />
|
|
93
|
+
</Example>
|
|
94
|
+
<Example title="En cours de chargement" maxWidth={1100}>
|
|
95
|
+
<ScheduledTasks {...base(() => new Promise(() => undefined))} />
|
|
96
|
+
</Example>
|
|
97
|
+
<Example title="Le chargement a échoué" maxWidth={1100}>
|
|
98
|
+
<ScheduledTasks
|
|
99
|
+
{...base(() => Promise.reject(new Error('Flow indisponible')))}
|
|
100
|
+
/>
|
|
101
|
+
</Example>
|
|
102
|
+
<Example title="Lecture seule" maxWidth={1100}>
|
|
103
|
+
<ScheduledTasks
|
|
104
|
+
{...base(async () => page(POPULATED))}
|
|
105
|
+
permissions={{
|
|
106
|
+
canCreate: false,
|
|
107
|
+
canUpdate: false,
|
|
108
|
+
canDelete: false,
|
|
109
|
+
canRegenerateSecret: false,
|
|
110
|
+
canTrigger: false,
|
|
111
|
+
}}
|
|
112
|
+
/>
|
|
113
|
+
</Example>
|
|
114
|
+
<LastEvent />
|
|
115
|
+
</Showcase>
|
|
116
|
+
);
|
|
117
|
+
};
|