@abyss-project/commons-front-core 20.3.0 → 20.4.0
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 +15 -0
- package/catalog/captures-plan.ts +10 -2
- package/catalog/pages/DeliveryHistory.tsx +142 -142
- package/catalog/pages/DeliverySubscriptions.tsx +50 -2
- package/catalog/pages/ScheduledTasks.tsx +116 -2
- package/catalog/specs/captures.spec.ts +156 -145
- package/catalog/specs/write-capture-index.ts +82 -81
- package/dist/{CookieConsentSettings-BPBNaNNI.js → CookieConsentSettings-JQqB3ZoC.js} +1 -1
- package/dist/{Surface-DmHRzUtQ.js → Surface-rKrLIx9x.js} +170 -44
- package/dist/{Tabs-CxBeR0D-.js → Tabs-C3ZY5xT8.js} +1 -1
- package/dist/components/business/Deliveries/DeliverySubscriptionForm.d.ts +7 -2
- package/dist/components/business/Deliveries/ScheduledTaskForm.d.ts +8 -2
- package/dist/components/business/Deliveries/ScheduledTaskPanel.d.ts +30 -0
- package/dist/components/business/Deliveries/ScheduledTasks.component.d.ts +3 -2
- package/dist/components/business/Deliveries/deliveries.logic.d.ts +36 -1
- package/dist/components/business/Deliveries/deliveries.types.d.ts +68 -3
- package/dist/components/business/Deliveries/test-support/deliveries.fixtures.d.ts +2 -1
- package/dist/cookie-consent.js +2 -2
- package/dist/{design-theme-HWymeGb7.js → design-theme-CeGUipuM.js} +877 -872
- package/dist/{editors-BmRsTu0H.js → editors-DNQ00p6Y.js} +27 -27
- package/dist/editors.js +1 -1
- package/dist/hooks/use-rich-intl.hook.d.ts +134 -16
- package/dist/{index-ChCpWPzk.js → index-2mUgohFa.js} +4 -4
- package/dist/{index-DnweGlM_.js → index-7lQ_E_am.js} +2 -2
- package/dist/{index-Dco3zEwV.js → index-8lBj2Ffk.js} +2 -2
- package/dist/{index-BAH9H4GE.js → index-BQUxvLoP.js} +3 -3
- package/dist/{index-DLIvsZA_.js → index-BQlO5Fp0.js} +2 -2
- package/dist/{index-CsZJyqSF.js → index-BXfdxGL2.js} +2 -2
- package/dist/{index-Cv8TWKKk.js → index-CHy_RxpP.js} +2 -2
- package/dist/{index-DVyE9B4I.js → index-CIpdjZHz.js} +2 -2
- package/dist/{index-BTwuilx5.js → index-CJnZcgwL.js} +3 -3
- package/dist/{index-CJjWI7qL.js → index-CQ9U6YlK.js} +3 -3
- package/dist/{index-RjzeFVe-.js → index-CzCDSQiD.js} +2 -2
- package/dist/{index-ClEFydIA.js → index-DAVJlVe-.js} +2 -2
- package/dist/{index-DsxBk5OJ.js → index-DQtcZD9Y.js} +1 -1
- package/dist/{index-DYdLhNjl.js → index-DWnlMFqj.js} +3 -3
- package/dist/{index-BwugEq4x.js → index-DgiI-dK3.js} +2 -2
- package/dist/{index-Buo7Iim6.js → index-DpR-QTUA.js} +4 -4
- package/dist/{index-DuLb3GSj.js → index-GvBY_FDT.js} +4 -4
- package/dist/{index-CSl9Kc0V.js → index-On5L36UF.js} +2 -2
- package/dist/{index-CI0SMeOa.js → index-a47WpMOx.js} +2 -2
- package/dist/{index-ZL-d1iKb.js → index-ehhIl57c.js} +2 -2
- package/dist/{index-BGAmhhJZ.js → index-qGV3av53.js} +2 -2
- package/dist/index.js +9809 -9486
- package/dist/legacy.js +745 -750
- package/dist/translations/en.d.ts +63 -0
- package/dist/translations/fr.d.ts +63 -0
- package/package.json +5 -5
- package/test-results/catalog/.last-run.json +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog — @abyss-project/commons-front-core
|
|
2
2
|
|
|
3
|
+
## 20.4.0
|
|
4
|
+
|
|
5
|
+
Card #792 (P5 L3c: Monitor's webhooks and cron tasks on the common components). Peer and dev dependency `@abyss-project/flow` ^1.7.0 (run `requestId`, `startedAt`, `responseHeaders`, task `retryBackoff`, run filters `from`, `to`, `requestId`).
|
|
6
|
+
|
|
7
|
+
- `ScheduledTasks`: `flowUrl` is optional (no link without it). New required action `get(id)` (one task, for a deep link; no host mounts the component yet). New optional props: `initialTaskId` opens the panel of that task on arrival (loading, failure with a retry, « Tâche introuvable » on a 404), `onCloseTask()` says the panel closed, `runLogsHref(run)` draws a link to the host's logs of a run's request in the run detail, `renderTaskState(task)` draws the host's state card at the head of the task panel, `renderIncidentPolicy({ value, onChange, task })` draws the host's incident-policy editor in the form (with it, `incidentPolicy` is sent; without it, never).
|
|
8
|
+
- `ScheduledTasks` panel of a task: run filters (period of whole days sent as `from`/`to`, a whole request id sent as `requestId`, an outcome that narrows the page loaded and says so), « Effacer les filtres », and a run detail in place of the list (status, `x-request-id`, scheduled and started dates, attempt, duration, code, error, response headers and body; « Détail archivé » past 30 days).
|
|
9
|
+
- `ScheduledTasks` form: `retryBackoff` (« Croissante » `LINEAR`, Flow's default, or « Fixe » `FIXED`), always sent.
|
|
10
|
+
- `DeliverySubscriptions`: new optional `renderFilters({ source, eventTypes, value, onChange, subscription })`, the host's filters editor in the form; with it, the creation and the update send `filters` (`null` for none; a change of source empties them); without it, never.
|
|
11
|
+
- Translations: `deliveries.event.MONITOR_FEEDBACK_RESPONDED`, and the keys of the task panel, the run detail, the run filters and the backoff (FR and EN).
|
|
12
|
+
- New exported types: `DeliverySubscriptionFilters`, `DeliveryFiltersSlotProps`, `ScheduledTaskIncidentPolicySlotProps`.
|
|
13
|
+
|
|
14
|
+
Also card #798, merged on develop before this release:
|
|
15
|
+
|
|
16
|
+
- `InvoiceDetailView`: the unit printed next to a line quantity is read from the host's `billing.unit.*` entry with the quantity as `count`, so a host whose entries are ICU plural messages shows « 1 invocation » / « 1 250 invocations » instead of the raw message. A host whose entries are plain strings is unaffected: the extra value is ignored.
|
|
17
|
+
|
|
3
18
|
## 20.3.0
|
|
4
19
|
|
|
5
20
|
Card #788 (toasts above the fixed bottom bars).
|
package/catalog/captures-plan.ts
CHANGED
|
@@ -45,7 +45,8 @@ export type CaptureState =
|
|
|
45
45
|
| 'secret-shown'
|
|
46
46
|
| 'delete-confirm'
|
|
47
47
|
| 'detail-open'
|
|
48
|
-
| 'runs-open'
|
|
48
|
+
| 'runs-open'
|
|
49
|
+
| 'run-detail-open';
|
|
49
50
|
|
|
50
51
|
/** File name suffix of each state. */
|
|
51
52
|
const STATE_SUFFIX: Record<CaptureState, string> = {
|
|
@@ -61,6 +62,7 @@ const STATE_SUFFIX: Record<CaptureState, string> = {
|
|
|
61
62
|
'delete-confirm': '-suppression',
|
|
62
63
|
'detail-open': '-detail',
|
|
63
64
|
'runs-open': '-executions',
|
|
65
|
+
'run-detail-open': '-execution-detail',
|
|
64
66
|
};
|
|
65
67
|
|
|
66
68
|
/** The states shown beyond arrival: what a closed control hides (options, calendar, sheet). */
|
|
@@ -77,7 +79,13 @@ const EXTRA_STATES: Record<string, CaptureState[]> = {
|
|
|
77
79
|
// The panels of the delivery components: forms, secret shown once, confirms, detail, run history.
|
|
78
80
|
DeliverySubscriptions: ['form-open', 'secret-shown', 'delete-confirm'],
|
|
79
81
|
DeliveryHistory: ['detail-open'],
|
|
80
|
-
ScheduledTasks: [
|
|
82
|
+
ScheduledTasks: [
|
|
83
|
+
'form-open',
|
|
84
|
+
'secret-shown',
|
|
85
|
+
'delete-confirm',
|
|
86
|
+
'runs-open',
|
|
87
|
+
'run-detail-open',
|
|
88
|
+
],
|
|
81
89
|
};
|
|
82
90
|
|
|
83
91
|
export interface Capture {
|
|
@@ -1,142 +1,142 @@
|
|
|
1
|
-
import { DeliveryHistory } from '../../src/components/business/Deliveries/DeliveryHistory.component';
|
|
2
|
-
import type {
|
|
3
|
-
DeliveryArchiveActions,
|
|
4
|
-
DeliveryHistoryProps,
|
|
5
|
-
} from '../../src/components/business/Deliveries/deliveries.types';
|
|
6
|
-
import {
|
|
7
|
-
archivedDay,
|
|
8
|
-
archivedDelivery,
|
|
9
|
-
daysAgo,
|
|
10
|
-
delivery,
|
|
11
|
-
deliveryStatus,
|
|
12
|
-
failedDelivery,
|
|
13
|
-
page,
|
|
14
|
-
rehydratedDelivery,
|
|
15
|
-
rehydrationJob,
|
|
16
|
-
subscription,
|
|
17
|
-
} from '../../src/components/business/Deliveries/test-support/deliveries.fixtures';
|
|
18
|
-
import { Example, LastEvent, Showcase, useEventLog } from '../frame';
|
|
19
|
-
|
|
20
|
-
const POPULATED = [
|
|
21
|
-
delivery(),
|
|
22
|
-
failedDelivery(),
|
|
23
|
-
delivery({
|
|
24
|
-
id: 'delivery-3',
|
|
25
|
-
eventKey: 'event-3',
|
|
26
|
-
deliveryId: 'sub-1:event-3',
|
|
27
|
-
status: deliveryStatus('RETRYING'),
|
|
28
|
-
attemptCount: 2,
|
|
29
|
-
lastResponseCode: 502,
|
|
30
|
-
lastResponseBody: null,
|
|
31
|
-
lastError: 'HTTP 502',
|
|
32
|
-
deliveredAt: null,
|
|
33
|
-
nextAttemptAt: new Date('2026-11-03T10:15:00Z'),
|
|
34
|
-
}),
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
/** Past 30 days: one row archived, one brought back online. */
|
|
38
|
-
const WITH_ARCHIVE = [...POPULATED, archivedDelivery(), rehydratedDelivery()];
|
|
39
|
-
|
|
40
|
-
const ARCHIVE_JOB = rehydrationJob({
|
|
41
|
-
rangeStart: daysAgo(41),
|
|
42
|
-
rangeEnd: daysAgo(39),
|
|
43
|
-
effectiveExpiresAt: new Date(Date.now() + 5 * 24 * 60 * 60 * 1000),
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
export const DeliveryHistoryPage = () => {
|
|
47
|
-
const { log } = useEventLog();
|
|
48
|
-
const archive: DeliveryArchiveActions = {
|
|
49
|
-
listDays: async () => [
|
|
50
|
-
archivedDay({ dayValue: '2026-09-20' }),
|
|
51
|
-
archivedDay({ dayValue: '2026-09-21', rowCount: 42 }),
|
|
52
|
-
],
|
|
53
|
-
listRehydrations: async () => ({ jobs: [ARCHIVE_JOB], truncated: false }),
|
|
54
|
-
estimate: async () => ({
|
|
55
|
-
admittedDays: ['2026-09-20'],
|
|
56
|
-
archiveBytes: 3 * 1024 * 1024,
|
|
57
|
-
expectedRows: 128,
|
|
58
|
-
skippedDays: [],
|
|
59
|
-
maxLeaseDays: 30,
|
|
60
|
-
}),
|
|
61
|
-
rehydrate: async (body) => {
|
|
62
|
-
log(`remettre en ligne ${body.rangeStart} - ${body.rangeEnd}`);
|
|
63
|
-
return { job: ARCHIVE_JOB, skippedDays: [] };
|
|
64
|
-
},
|
|
65
|
-
extend: async (jobId) => {
|
|
66
|
-
log(`prolonger ${jobId}`);
|
|
67
|
-
return ARCHIVE_JOB;
|
|
68
|
-
},
|
|
69
|
-
release: async (jobId) => {
|
|
70
|
-
log(`libérer ${jobId}`);
|
|
71
|
-
return ARCHIVE_JOB;
|
|
72
|
-
},
|
|
73
|
-
purge: async (body) => {
|
|
74
|
-
log(`supprimer de l'archive ${body.from} - ${body.to}`);
|
|
75
|
-
return { purgedDays: [body.from], deletedRows: 0, releasedJobs: 0 };
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
const base = (list: DeliveryHistoryProps['list']): DeliveryHistoryProps => ({
|
|
79
|
-
list,
|
|
80
|
-
get: async (id) => WITH_ARCHIVE.find((row) => row.id === id) ?? delivery(),
|
|
81
|
-
replayDelivery: async (id) => log(`rejouer ${id}`),
|
|
82
|
-
canReplay: true,
|
|
83
|
-
archive,
|
|
84
|
-
canManageArchive: true,
|
|
85
|
-
canPurgeArchive: true,
|
|
86
|
-
getSubscription: async () =>
|
|
87
|
-
subscription({
|
|
88
|
-
url: 'https://ops.example.com/webhooks/abyss/monitor-events/production',
|
|
89
|
-
eventTypes: ['MONITOR_EVENT', 'MONITOR_SENTINEL'],
|
|
90
|
-
}),
|
|
91
|
-
flowUrl: 'https://flow.abyss.example/deliveries',
|
|
92
|
-
});
|
|
93
|
-
return (
|
|
94
|
-
<Showcase
|
|
95
|
-
family="Métier"
|
|
96
|
-
name="DeliveryHistory"
|
|
97
|
-
description="L'historique des livraisons d'un abonnement (URL et événements sous le titre) : filtre de statut, détail en panneau (données de l'événement, en-têtes envoyés, réponse, déroulé), rejeu d'une livraison terminée (refusé au-delà de 30 jours) et section Archive : jours archivés, remises en ligne, suppression."
|
|
98
|
-
>
|
|
99
|
-
<Example title="Peuplé" maxWidth={1100}>
|
|
100
|
-
<DeliveryHistory {...base(async () => page(POPULATED))} />
|
|
101
|
-
</Example>
|
|
102
|
-
<Example
|
|
103
|
-
title="Avec une livraison archivée et une remise en ligne"
|
|
104
|
-
maxWidth={1100}
|
|
105
|
-
>
|
|
106
|
-
<DeliveryHistory {...base(async () => page(WITH_ARCHIVE))} />
|
|
107
|
-
</Example>
|
|
108
|
-
<Example title="Archive en lecture seule" maxWidth={1100}>
|
|
109
|
-
<DeliveryHistory
|
|
110
|
-
{...base(async () => page(WITH_ARCHIVE))}
|
|
111
|
-
canManageArchive={false}
|
|
112
|
-
canPurgeArchive={false}
|
|
113
|
-
/>
|
|
114
|
-
</Example>
|
|
115
|
-
<Example title="Vide" maxWidth={1100}>
|
|
116
|
-
<DeliveryHistory {...base(async () => page([]))} />
|
|
117
|
-
</Example>
|
|
118
|
-
<Example title="En cours de chargement" maxWidth={1100}>
|
|
119
|
-
<DeliveryHistory {...base(() => new Promise(() => undefined))} />
|
|
120
|
-
</Example>
|
|
121
|
-
<Example title="Le chargement a échoué" maxWidth={1100}>
|
|
122
|
-
<DeliveryHistory
|
|
123
|
-
{...base(() => Promise.reject(new Error('Flow indisponible')))}
|
|
124
|
-
/>
|
|
125
|
-
</Example>
|
|
126
|
-
<Example title="Sans abonnement ni lien vers Flow" maxWidth={1100}>
|
|
127
|
-
<DeliveryHistory
|
|
128
|
-
{...base(async () => page(POPULATED))}
|
|
129
|
-
getSubscription={undefined}
|
|
130
|
-
flowUrl={undefined}
|
|
131
|
-
/>
|
|
132
|
-
</Example>
|
|
133
|
-
<Example title="Sans droit de rejeu" maxWidth={1100}>
|
|
134
|
-
<DeliveryHistory
|
|
135
|
-
{...base(async () => page(POPULATED))}
|
|
136
|
-
canReplay={false}
|
|
137
|
-
/>
|
|
138
|
-
</Example>
|
|
139
|
-
<LastEvent />
|
|
140
|
-
</Showcase>
|
|
141
|
-
);
|
|
142
|
-
};
|
|
1
|
+
import { DeliveryHistory } from '../../src/components/business/Deliveries/DeliveryHistory.component';
|
|
2
|
+
import type {
|
|
3
|
+
DeliveryArchiveActions,
|
|
4
|
+
DeliveryHistoryProps,
|
|
5
|
+
} from '../../src/components/business/Deliveries/deliveries.types';
|
|
6
|
+
import {
|
|
7
|
+
archivedDay,
|
|
8
|
+
archivedDelivery,
|
|
9
|
+
daysAgo,
|
|
10
|
+
delivery,
|
|
11
|
+
deliveryStatus,
|
|
12
|
+
failedDelivery,
|
|
13
|
+
page,
|
|
14
|
+
rehydratedDelivery,
|
|
15
|
+
rehydrationJob,
|
|
16
|
+
subscription,
|
|
17
|
+
} from '../../src/components/business/Deliveries/test-support/deliveries.fixtures';
|
|
18
|
+
import { Example, LastEvent, Showcase, useEventLog } from '../frame';
|
|
19
|
+
|
|
20
|
+
const POPULATED = [
|
|
21
|
+
delivery(),
|
|
22
|
+
failedDelivery(),
|
|
23
|
+
delivery({
|
|
24
|
+
id: 'delivery-3',
|
|
25
|
+
eventKey: 'event-3',
|
|
26
|
+
deliveryId: 'sub-1:event-3',
|
|
27
|
+
status: deliveryStatus('RETRYING'),
|
|
28
|
+
attemptCount: 2,
|
|
29
|
+
lastResponseCode: 502,
|
|
30
|
+
lastResponseBody: null,
|
|
31
|
+
lastError: 'HTTP 502',
|
|
32
|
+
deliveredAt: null,
|
|
33
|
+
nextAttemptAt: new Date('2026-11-03T10:15:00Z'),
|
|
34
|
+
}),
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
/** Past 30 days: one row archived, one brought back online. */
|
|
38
|
+
const WITH_ARCHIVE = [...POPULATED, archivedDelivery(), rehydratedDelivery()];
|
|
39
|
+
|
|
40
|
+
const ARCHIVE_JOB = rehydrationJob({
|
|
41
|
+
rangeStart: daysAgo(41),
|
|
42
|
+
rangeEnd: daysAgo(39),
|
|
43
|
+
effectiveExpiresAt: new Date(Date.now() + 5 * 24 * 60 * 60 * 1000),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const DeliveryHistoryPage = () => {
|
|
47
|
+
const { log } = useEventLog();
|
|
48
|
+
const archive: DeliveryArchiveActions = {
|
|
49
|
+
listDays: async () => [
|
|
50
|
+
archivedDay({ dayValue: '2026-09-20' }),
|
|
51
|
+
archivedDay({ dayValue: '2026-09-21', rowCount: 42 }),
|
|
52
|
+
],
|
|
53
|
+
listRehydrations: async () => ({ jobs: [ARCHIVE_JOB], truncated: false }),
|
|
54
|
+
estimate: async () => ({
|
|
55
|
+
admittedDays: ['2026-09-20'],
|
|
56
|
+
archiveBytes: 3 * 1024 * 1024,
|
|
57
|
+
expectedRows: 128,
|
|
58
|
+
skippedDays: [],
|
|
59
|
+
maxLeaseDays: 30,
|
|
60
|
+
}),
|
|
61
|
+
rehydrate: async (body) => {
|
|
62
|
+
log(`remettre en ligne ${body.rangeStart} - ${body.rangeEnd}`);
|
|
63
|
+
return { job: ARCHIVE_JOB, skippedDays: [] };
|
|
64
|
+
},
|
|
65
|
+
extend: async (jobId) => {
|
|
66
|
+
log(`prolonger ${jobId}`);
|
|
67
|
+
return ARCHIVE_JOB;
|
|
68
|
+
},
|
|
69
|
+
release: async (jobId) => {
|
|
70
|
+
log(`libérer ${jobId}`);
|
|
71
|
+
return ARCHIVE_JOB;
|
|
72
|
+
},
|
|
73
|
+
purge: async (body) => {
|
|
74
|
+
log(`supprimer de l'archive ${body.from} - ${body.to}`);
|
|
75
|
+
return { purgedDays: [body.from], deletedRows: 0, releasedJobs: 0 };
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
const base = (list: DeliveryHistoryProps['list']): DeliveryHistoryProps => ({
|
|
79
|
+
list,
|
|
80
|
+
get: async (id) => WITH_ARCHIVE.find((row) => row.id === id) ?? delivery(),
|
|
81
|
+
replayDelivery: async (id) => log(`rejouer ${id}`),
|
|
82
|
+
canReplay: true,
|
|
83
|
+
archive,
|
|
84
|
+
canManageArchive: true,
|
|
85
|
+
canPurgeArchive: true,
|
|
86
|
+
getSubscription: async () =>
|
|
87
|
+
subscription({
|
|
88
|
+
url: 'https://ops.example.com/webhooks/abyss/monitor-events/production',
|
|
89
|
+
eventTypes: ['MONITOR_EVENT', 'MONITOR_SENTINEL'],
|
|
90
|
+
}),
|
|
91
|
+
flowUrl: 'https://flow.abyss.example/deliveries',
|
|
92
|
+
});
|
|
93
|
+
return (
|
|
94
|
+
<Showcase
|
|
95
|
+
family="Métier"
|
|
96
|
+
name="DeliveryHistory"
|
|
97
|
+
description="L'historique des livraisons d'un abonnement (URL et événements sous le titre) : filtre de statut, détail en panneau (données de l'événement, en-têtes envoyés, réponse, déroulé), rejeu d'une livraison terminée (refusé au-delà de 30 jours) et section Archive : jours archivés, remises en ligne, suppression."
|
|
98
|
+
>
|
|
99
|
+
<Example title="Peuplé" maxWidth={1100}>
|
|
100
|
+
<DeliveryHistory {...base(async () => page(POPULATED))} />
|
|
101
|
+
</Example>
|
|
102
|
+
<Example
|
|
103
|
+
title="Avec une livraison archivée et une remise en ligne"
|
|
104
|
+
maxWidth={1100}
|
|
105
|
+
>
|
|
106
|
+
<DeliveryHistory {...base(async () => page(WITH_ARCHIVE))} />
|
|
107
|
+
</Example>
|
|
108
|
+
<Example title="Archive en lecture seule" maxWidth={1100}>
|
|
109
|
+
<DeliveryHistory
|
|
110
|
+
{...base(async () => page(WITH_ARCHIVE))}
|
|
111
|
+
canManageArchive={false}
|
|
112
|
+
canPurgeArchive={false}
|
|
113
|
+
/>
|
|
114
|
+
</Example>
|
|
115
|
+
<Example title="Vide" maxWidth={1100}>
|
|
116
|
+
<DeliveryHistory {...base(async () => page([]))} />
|
|
117
|
+
</Example>
|
|
118
|
+
<Example title="En cours de chargement" maxWidth={1100}>
|
|
119
|
+
<DeliveryHistory {...base(() => new Promise(() => undefined))} />
|
|
120
|
+
</Example>
|
|
121
|
+
<Example title="Le chargement a échoué" maxWidth={1100}>
|
|
122
|
+
<DeliveryHistory
|
|
123
|
+
{...base(() => Promise.reject(new Error('Flow indisponible')))}
|
|
124
|
+
/>
|
|
125
|
+
</Example>
|
|
126
|
+
<Example title="Sans abonnement ni lien vers Flow" maxWidth={1100}>
|
|
127
|
+
<DeliveryHistory
|
|
128
|
+
{...base(async () => page(POPULATED))}
|
|
129
|
+
getSubscription={undefined}
|
|
130
|
+
flowUrl={undefined}
|
|
131
|
+
/>
|
|
132
|
+
</Example>
|
|
133
|
+
<Example title="Sans droit de rejeu" maxWidth={1100}>
|
|
134
|
+
<DeliveryHistory
|
|
135
|
+
{...base(async () => page(POPULATED))}
|
|
136
|
+
canReplay={false}
|
|
137
|
+
/>
|
|
138
|
+
</Example>
|
|
139
|
+
<LastEvent />
|
|
140
|
+
</Showcase>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
2
|
+
import Switch from '@mui/material/Switch';
|
|
1
3
|
import { DeliverySubscriptions } from '../../src/components/business/Deliveries/DeliverySubscriptions.component';
|
|
2
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
DeliveryFiltersSlotProps,
|
|
6
|
+
DeliverySubscriptionsProps,
|
|
7
|
+
} from '../../src/components/business/Deliveries/deliveries.types';
|
|
3
8
|
import {
|
|
4
9
|
EVENT_TYPES_BY_SOURCE,
|
|
5
10
|
SOURCES,
|
|
6
11
|
deliveryFormat,
|
|
12
|
+
eventType,
|
|
7
13
|
page,
|
|
8
14
|
source,
|
|
9
15
|
subscription,
|
|
@@ -41,6 +47,33 @@ const POPULATED = [
|
|
|
41
47
|
|
|
42
48
|
const secretFor = (id: string) => `whsec_catalog_${id}_do-not-use`;
|
|
43
49
|
|
|
50
|
+
const FAILURES_ONLY = {
|
|
51
|
+
SENTINEL: { notifyOnSuccess: false, notifyOnFailure: true },
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A filters editor as a host draws it: here, one switch that keeps the failures of the probes
|
|
56
|
+
* only, offered once the probe events are ticked.
|
|
57
|
+
*/
|
|
58
|
+
const renderFilters = ({
|
|
59
|
+
eventTypes,
|
|
60
|
+
value,
|
|
61
|
+
onChange,
|
|
62
|
+
}: DeliveryFiltersSlotProps) => (
|
|
63
|
+
<FormControlLabel
|
|
64
|
+
label="Seulement les échecs des sondes"
|
|
65
|
+
disabled={!eventTypes.includes(eventType('MONITOR_SENTINEL'))}
|
|
66
|
+
control={
|
|
67
|
+
<Switch
|
|
68
|
+
checked={value !== null && 'SENTINEL' in value}
|
|
69
|
+
onChange={(event) =>
|
|
70
|
+
onChange(event.target.checked ? FAILURES_ONLY : null)
|
|
71
|
+
}
|
|
72
|
+
/>
|
|
73
|
+
}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
|
|
44
77
|
export const DeliverySubscriptionsPage = () => {
|
|
45
78
|
const { log } = useEventLog();
|
|
46
79
|
const base = (
|
|
@@ -76,7 +109,7 @@ export const DeliverySubscriptionsPage = () => {
|
|
|
76
109
|
<Showcase
|
|
77
110
|
family="Métier"
|
|
78
111
|
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."
|
|
112
|
+
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 ; un hôte peut glisser son éditeur de filtres dans le formulaire."
|
|
80
113
|
>
|
|
81
114
|
<Example title="Peuplé" maxWidth={1100}>
|
|
82
115
|
<DeliverySubscriptions {...base(async () => page(POPULATED))} />
|
|
@@ -98,6 +131,21 @@ export const DeliverySubscriptionsPage = () => {
|
|
|
98
131
|
flowUrl={undefined}
|
|
99
132
|
/>
|
|
100
133
|
</Example>
|
|
134
|
+
<Example title="Avec l'éditeur de filtres de l'hôte" maxWidth={1100}>
|
|
135
|
+
<DeliverySubscriptions
|
|
136
|
+
{...base(async () =>
|
|
137
|
+
page([
|
|
138
|
+
subscription({
|
|
139
|
+
eventTypes: ['MONITOR_SENTINEL'],
|
|
140
|
+
filters: FAILURES_ONLY,
|
|
141
|
+
url: 'https://ops.example.com/webhooks/abyss/probe-failures',
|
|
142
|
+
}),
|
|
143
|
+
]),
|
|
144
|
+
)}
|
|
145
|
+
sources={[source('MONITOR')]}
|
|
146
|
+
renderFilters={renderFilters}
|
|
147
|
+
/>
|
|
148
|
+
</Example>
|
|
101
149
|
<Example title="Vide" maxWidth={1100}>
|
|
102
150
|
<DeliverySubscriptions {...base(async () => page([]))} />
|
|
103
151
|
</Example>
|
|
@@ -1,11 +1,23 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import type { IncidentSeverity, IScheduledTask } from '@abyss-project/flow';
|
|
1
3
|
import { ScheduledTasks } from '../../src/components/business/Deliveries/ScheduledTasks.component';
|
|
2
|
-
import
|
|
4
|
+
import { ActionButton } from '../../src/components/business/Deliveries/DeliveryParts';
|
|
5
|
+
import type {
|
|
6
|
+
ScheduledTaskIncidentPolicySlotProps,
|
|
7
|
+
ScheduledTasksProps,
|
|
8
|
+
} from '../../src/components/business/Deliveries/deliveries.types';
|
|
3
9
|
import {
|
|
10
|
+
apiError,
|
|
4
11
|
page,
|
|
5
12
|
runStatus,
|
|
6
13
|
scheduledTask,
|
|
7
14
|
taskRun,
|
|
8
15
|
} from '../../src/components/business/Deliveries/test-support/deliveries.fixtures';
|
|
16
|
+
import { NumberField } from '../../src/components/inputs/NumberField/NumberField';
|
|
17
|
+
import {
|
|
18
|
+
Callout,
|
|
19
|
+
CalloutSeverity,
|
|
20
|
+
} from '../../src/components/states/Callout/Callout';
|
|
9
21
|
import { Example, LastEvent, Showcase, useEventLog } from '../frame';
|
|
10
22
|
|
|
11
23
|
const PERMISSIONS = {
|
|
@@ -37,20 +49,99 @@ const RUNS = [
|
|
|
37
49
|
taskRun(),
|
|
38
50
|
taskRun({
|
|
39
51
|
id: 'run-2',
|
|
52
|
+
requestId: '8d1e4b7a-2c3f-4a5b-8c9d-0e1f2a3b4c5d',
|
|
40
53
|
scheduledFor: new Date('2026-11-01T03:00:00Z'),
|
|
54
|
+
startedAt: new Date('2026-11-01T03:00:02Z'),
|
|
41
55
|
status: runStatus('FAILED'),
|
|
56
|
+
attempt: 3,
|
|
42
57
|
responseCode: 500,
|
|
58
|
+
responseBody: '{"error":"database unavailable"}',
|
|
59
|
+
error: 'HTTP 500',
|
|
43
60
|
durationMs: 1204,
|
|
44
61
|
}),
|
|
45
62
|
taskRun({
|
|
46
63
|
id: 'run-3',
|
|
64
|
+
requestId: '5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d',
|
|
47
65
|
scheduledFor: new Date('2026-10-31T03:00:00Z'),
|
|
66
|
+
startedAt: new Date('2026-10-31T03:00:00Z'),
|
|
48
67
|
status: runStatus('TIMED_OUT'),
|
|
49
68
|
responseCode: null,
|
|
69
|
+
responseBody: null,
|
|
70
|
+
responseHeaders: null,
|
|
71
|
+
error: 'Timeout after 30000 ms',
|
|
50
72
|
durationMs: 30000,
|
|
51
73
|
}),
|
|
74
|
+
taskRun({
|
|
75
|
+
id: 'run-4',
|
|
76
|
+
requestId: '1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e',
|
|
77
|
+
scheduledFor: new Date('2026-09-20T03:00:00Z'),
|
|
78
|
+
startedAt: new Date('2026-09-20T03:00:01Z'),
|
|
79
|
+
responseBody: null,
|
|
80
|
+
responseHeaders: null,
|
|
81
|
+
detailArchivedAt: new Date('2026-10-21T03:00:00Z'),
|
|
82
|
+
}),
|
|
52
83
|
];
|
|
53
84
|
|
|
85
|
+
/** A state card as a host draws it: the failure streak, and the incident it tracks. */
|
|
86
|
+
const renderTaskState = (task: IScheduledTask) =>
|
|
87
|
+
task.consecutiveFailures > 0 ? (
|
|
88
|
+
<Callout
|
|
89
|
+
severity={CalloutSeverity.Warning}
|
|
90
|
+
title={`${task.consecutiveFailures} échecs consécutifs`}
|
|
91
|
+
>
|
|
92
|
+
Incident ouvert, suivi dans #128.
|
|
93
|
+
</Callout>
|
|
94
|
+
) : (
|
|
95
|
+
<Callout severity={CalloutSeverity.Success} title="Aucun échec en cours">
|
|
96
|
+
Aucun incident ouvert pour cette tâche.
|
|
97
|
+
</Callout>
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
/** An incident-policy editor as a host draws it: here, the failures that open an incident. */
|
|
101
|
+
const renderIncidentPolicy = ({
|
|
102
|
+
value,
|
|
103
|
+
onChange,
|
|
104
|
+
}: ScheduledTaskIncidentPolicySlotProps) => (
|
|
105
|
+
<NumberField
|
|
106
|
+
label="Ouvrir un incident après (échecs consécutifs)"
|
|
107
|
+
value={value?.openAfter ?? null}
|
|
108
|
+
min={1}
|
|
109
|
+
onChange={(openAfter) =>
|
|
110
|
+
onChange(
|
|
111
|
+
openAfter === null
|
|
112
|
+
? null
|
|
113
|
+
: {
|
|
114
|
+
openAfter,
|
|
115
|
+
escalateAfter: null,
|
|
116
|
+
resolveAfter: 1,
|
|
117
|
+
severity: 'WARNING' as IncidentSeverity,
|
|
118
|
+
disableAfter: null,
|
|
119
|
+
},
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
/** A host on the route of one task: the buttons stand for the links that lead to it. */
|
|
126
|
+
function LinkedTasks({ base }: { base: ScheduledTasksProps }) {
|
|
127
|
+
const [taskId, setTaskId] = useState<string | undefined>(undefined);
|
|
128
|
+
return (
|
|
129
|
+
<>
|
|
130
|
+
<ActionButton variant="outlined" onClick={() => setTaskId('task-3')}>
|
|
131
|
+
Lien vers une tâche
|
|
132
|
+
</ActionButton>
|
|
133
|
+
<ActionButton variant="outlined" onClick={() => setTaskId('task-gone')}>
|
|
134
|
+
Lien vers une tâche supprimée
|
|
135
|
+
</ActionButton>
|
|
136
|
+
<ScheduledTasks
|
|
137
|
+
{...base}
|
|
138
|
+
initialTaskId={taskId}
|
|
139
|
+
onCloseTask={() => setTaskId(undefined)}
|
|
140
|
+
/>
|
|
141
|
+
</>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
54
145
|
export const ScheduledTasksPage = () => {
|
|
55
146
|
const { log } = useEventLog();
|
|
56
147
|
const base = (list: ScheduledTasksProps['list']): ScheduledTasksProps => ({
|
|
@@ -76,18 +167,41 @@ export const ScheduledTasksPage = () => {
|
|
|
76
167
|
},
|
|
77
168
|
trigger: async (id) => log(`lancer ${id}`),
|
|
78
169
|
listRuns: async () => page(RUNS),
|
|
170
|
+
get: async (id) => {
|
|
171
|
+
const task = POPULATED.find((candidate) => candidate.id === id);
|
|
172
|
+
if (task === undefined) {
|
|
173
|
+
throw apiError(404, { code: 'scheduled_task_not_found' });
|
|
174
|
+
}
|
|
175
|
+
return task;
|
|
176
|
+
},
|
|
79
177
|
permissions: PERMISSIONS,
|
|
80
178
|
flowUrl: 'https://flow.abyss.example/scheduled-tasks',
|
|
179
|
+
runLogsHref: (run) =>
|
|
180
|
+
`https://app.abyss.example/monitor/logs?q=requestId:"${run.requestId}"`,
|
|
181
|
+
renderTaskState,
|
|
182
|
+
renderIncidentPolicy,
|
|
81
183
|
});
|
|
82
184
|
return (
|
|
83
185
|
<Showcase
|
|
84
186
|
family="Métier"
|
|
85
187
|
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
|
|
188
|
+
description="Les tâches planifiées d'un périmètre : liste, création et édition en panneau (progression du délai, politique d'incident de l'hôte), « lancer maintenant », secret affiché une seule fois, et le panneau d'une tâche : carte d'état de l'hôte, exécutions filtrées (période, identifiant de requête, résultat) et détail d'une exécution avec le lien vers ses journaux. Un lien vers une tâche ouvre son panneau à l'arrivée."
|
|
87
189
|
>
|
|
88
190
|
<Example title="Peuplé" maxWidth={1100}>
|
|
89
191
|
<ScheduledTasks {...base(async () => page(POPULATED))} />
|
|
90
192
|
</Example>
|
|
193
|
+
<Example title="Sans lien vers Flow ni emplacements" maxWidth={1100}>
|
|
194
|
+
<ScheduledTasks
|
|
195
|
+
{...base(async () => page(POPULATED))}
|
|
196
|
+
flowUrl={undefined}
|
|
197
|
+
runLogsHref={undefined}
|
|
198
|
+
renderTaskState={undefined}
|
|
199
|
+
renderIncidentPolicy={undefined}
|
|
200
|
+
/>
|
|
201
|
+
</Example>
|
|
202
|
+
<Example title="Lien vers une tâche" maxWidth={1100}>
|
|
203
|
+
<LinkedTasks base={base(async () => page(POPULATED))} />
|
|
204
|
+
</Example>
|
|
91
205
|
<Example title="Vide" maxWidth={1100}>
|
|
92
206
|
<ScheduledTasks {...base(async () => page([]))} />
|
|
93
207
|
</Example>
|