@abyss-project/commons-front-core 18.0.0 → 18.1.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 +12 -1
- package/catalog/pages/DeliveryHistory.tsx +79 -66
- package/catalog/pages/DeliverySubscriptions.tsx +127 -110
- package/catalog/pages/ScheduledTasks.tsx +117 -117
- package/catalog/specs/captures.spec.ts +145 -145
- package/catalog/specs/write-capture-index.ts +81 -81
- package/dist/{CookieConsentSettings-B7HIIzyI.js → CookieConsentSettings-DUoKKRMZ.js} +1 -1
- package/dist/{Surface-dziv23sf.js → Surface-z5TuQzlh.js} +50 -40
- package/dist/{Tabs-_onUZBA-.js → Tabs-C4K0mLME.js} +1 -1
- package/dist/components/business/Deliveries/DeliveryHistory.component.d.ts +4 -3
- package/dist/components/business/Deliveries/DeliverySubscriptionForm.d.ts +3 -2
- package/dist/components/business/Deliveries/deliveries.logic.d.ts +11 -0
- package/dist/components/business/Deliveries/deliveries.types.d.ts +12 -4
- package/dist/cookie-consent.js +2 -2
- package/dist/{design-theme-B3C3z1gE.js → design-theme-BFkCN7Nz.js} +1 -1
- package/dist/{editors-BhQlONOy.js → editors-Eb3PHnxn.js} +27 -27
- package/dist/editors.js +1 -1
- package/dist/hooks/use-rich-intl.hook.d.ts +12 -2
- package/dist/{index-yFJTDKIX.js → index-2lNOK7eK.js} +2 -2
- package/dist/{index-BGAZK8Vk.js → index-B76nCWpd.js} +2 -2
- package/dist/{index-BcjlG5TB.js → index-BKRudpMw.js} +2 -2
- package/dist/{index-CJI1dJrw.js → index-BaL2x2GW.js} +3 -3
- package/dist/{index-BeMiREqf.js → index-BcO-JFrs.js} +2 -2
- package/dist/{index-D1mQgWN3.js → index-BlOP01yA.js} +2 -2
- package/dist/{index-V4F4Sk7y.js → index-Bw4XnSa0.js} +2 -2
- package/dist/{index-BGJobvxw.js → index-CFDEfvCD.js} +1 -1
- package/dist/{index-DprTO7yi.js → index-CQ7z2zKY.js} +4 -4
- package/dist/{index-y-TnfE6Z.js → index-CRFGogWn.js} +2 -2
- package/dist/{index-B6w5_TeJ.js → index-CUhMNEUo.js} +3 -3
- package/dist/{index-ByN6DcaL.js → index-CWD0waD8.js} +2 -2
- package/dist/{index-B6LMTOKG.js → index-CYBvIQsH.js} +3 -3
- package/dist/{index-DNd8NZnu.js → index-Ckzcg8qD.js} +4 -4
- package/dist/{index-Dakpr4C1.js → index-Ckzmgx9X.js} +3 -3
- package/dist/{index-DkZAsKob.js → index-CrZZo4r1.js} +2 -2
- package/dist/{index-N4BwXTyk.js → index-CtVoDSIn.js} +2 -2
- package/dist/{index-BTDlbjWW.js → index-CtkfWhK1.js} +2 -2
- package/dist/{index-ytgNPz5f.js → index-DRtBc440.js} +2 -2
- package/dist/{index-BBF-FvT6.js → index-Dqm1dC1j.js} +2 -2
- package/dist/{index-DLlWMDxB.js → index-z5ZOXlY8.js} +4 -4
- package/dist/index.js +5880 -5790
- package/dist/legacy.js +6 -6
- package/dist/translations/en.d.ts +6 -1
- package/dist/translations/fr.d.ts +6 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
# Changelog — @abyss-project/commons-front-core
|
|
2
2
|
|
|
3
|
+
## 18.1.0
|
|
4
|
+
|
|
5
|
+
Fixes of the P5 #792 L1 review. No export removed; two props become optional, one is added.
|
|
6
|
+
|
|
7
|
+
- `DeliverySubscriptions` and `DeliveryHistory`: `flowUrl` is optional. Without it, no « Ouvrir dans Flow » link is drawn (`ScheduledTasks` still requires it).
|
|
8
|
+
- `DeliveryHistory`: new optional `getSubscription()`. The full URL and the events of the subscription are shown under the title, with a message when it cannot be loaded.
|
|
9
|
+
- `DeliverySubscriptions`: a URL is cut in the middle, not at its end. The end of the path stays visible, so two URLs of one host can be told apart, and the full URL is shown in a tooltip and read by assistive technologies. This applies to the table and to the mobile list. The URL column gets 200 px at minimum. The failures column narrows to 96 px, and its header becomes « Échecs » / « Failures ».
|
|
10
|
+
- `DeliverySubscriptions`: when `sources` holds one source, the source filter, the « Source » column and the source choice of the form are not drawn.
|
|
11
|
+
- `DeliveryHistory`: the detail section showing `payload` is titled « Données de l’événement » / « Event data » (key `deliveries.history.detail.event-data`, replacing `request-body`). Flow stores the event data, not the envelope that was sent.
|
|
12
|
+
- Theme: the `Switch` thumb is ringed in `border.control`, so a light thumb shows on a light surface and a dark one on a dark surface.
|
|
13
|
+
|
|
3
14
|
## 18.0.0
|
|
4
15
|
|
|
5
|
-
|
|
16
|
+
Cards #753 and #747 (ADR-0261), plus the #286 admin additions. One export removed, `VALIDITY_DAYS` (replaced below, no consumer outside the core); no signature narrowed.
|
|
6
17
|
|
|
7
18
|
- **Validity of the choice: six months instead of 365 days.** `CONSENT_VALIDITY_DAYS` (183), `CONSENT_VALIDITY_MS` and `COOKIE_MAX_AGE_SECONDS` replace `VALIDITY_DAYS`: one constant for the cookie's `Max-Age` and for the validity check. Every stored choice older than six months asks again.
|
|
8
19
|
- **`cookie-consent-contract`** (leaf file, no import) exports what a reader or writer of the apex cookie must agree on: `COOKIE_NAME`, `COOKIE_PATH`, `COOKIE_SAME_SITE`, the validity constants, `StoredConsent`, `encodeStoredConsent`, `decodeStoredConsent`, `isStoredConsentValid`. `COOKIE_NAME` and `StoredConsent` moved there from `cookie-storage.utils` (still exported by the root and by `./cookie-consent`).
|
|
@@ -1,66 +1,79 @@
|
|
|
1
|
-
import { DeliveryHistory } from '../../src/components/business/Deliveries/DeliveryHistory.component';
|
|
2
|
-
import type { DeliveryHistoryProps } from '../../src/components/business/Deliveries/deliveries.types';
|
|
3
|
-
import {
|
|
4
|
-
delivery,
|
|
5
|
-
deliveryStatus,
|
|
6
|
-
failedDelivery,
|
|
7
|
-
page,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<Example title="
|
|
50
|
-
<DeliveryHistory {...base(() =>
|
|
51
|
-
</Example>
|
|
52
|
-
<Example title="
|
|
53
|
-
<DeliveryHistory
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/>
|
|
62
|
-
</Example>
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
1
|
+
import { DeliveryHistory } from '../../src/components/business/Deliveries/DeliveryHistory.component';
|
|
2
|
+
import type { DeliveryHistoryProps } from '../../src/components/business/Deliveries/deliveries.types';
|
|
3
|
+
import {
|
|
4
|
+
delivery,
|
|
5
|
+
deliveryStatus,
|
|
6
|
+
failedDelivery,
|
|
7
|
+
page,
|
|
8
|
+
subscription,
|
|
9
|
+
} from '../../src/components/business/Deliveries/test-support/deliveries.fixtures';
|
|
10
|
+
import { Example, LastEvent, Showcase, useEventLog } from '../frame';
|
|
11
|
+
|
|
12
|
+
const POPULATED = [
|
|
13
|
+
delivery(),
|
|
14
|
+
failedDelivery(),
|
|
15
|
+
delivery({
|
|
16
|
+
id: 'delivery-3',
|
|
17
|
+
eventKey: 'event-3',
|
|
18
|
+
deliveryId: 'sub-1:event-3',
|
|
19
|
+
status: deliveryStatus('RETRYING'),
|
|
20
|
+
attemptCount: 2,
|
|
21
|
+
lastResponseCode: 502,
|
|
22
|
+
lastResponseBody: null,
|
|
23
|
+
lastError: 'HTTP 502',
|
|
24
|
+
deliveredAt: null,
|
|
25
|
+
nextAttemptAt: new Date('2026-11-03T10:15:00Z'),
|
|
26
|
+
}),
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
export const DeliveryHistoryPage = () => {
|
|
30
|
+
const { log } = useEventLog();
|
|
31
|
+
const base = (list: DeliveryHistoryProps['list']): DeliveryHistoryProps => ({
|
|
32
|
+
list,
|
|
33
|
+
get: async (id) => POPULATED.find((row) => row.id === id) ?? delivery(),
|
|
34
|
+
replayDelivery: async (id) => log(`rejouer ${id}`),
|
|
35
|
+
canReplay: true,
|
|
36
|
+
getSubscription: async () =>
|
|
37
|
+
subscription({
|
|
38
|
+
url: 'https://ops.example.com/webhooks/abyss/monitor-events/production',
|
|
39
|
+
eventTypes: ['MONITOR_EVENT', 'MONITOR_SENTINEL'],
|
|
40
|
+
}),
|
|
41
|
+
flowUrl: 'https://flow.abyss.example/deliveries',
|
|
42
|
+
});
|
|
43
|
+
return (
|
|
44
|
+
<Showcase
|
|
45
|
+
family="Métier"
|
|
46
|
+
name="DeliveryHistory"
|
|
47
|
+
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é) et rejeu d'une livraison terminée."
|
|
48
|
+
>
|
|
49
|
+
<Example title="Peuplé" maxWidth={1100}>
|
|
50
|
+
<DeliveryHistory {...base(async () => page(POPULATED))} />
|
|
51
|
+
</Example>
|
|
52
|
+
<Example title="Vide" maxWidth={1100}>
|
|
53
|
+
<DeliveryHistory {...base(async () => page([]))} />
|
|
54
|
+
</Example>
|
|
55
|
+
<Example title="En cours de chargement" maxWidth={1100}>
|
|
56
|
+
<DeliveryHistory {...base(() => new Promise(() => undefined))} />
|
|
57
|
+
</Example>
|
|
58
|
+
<Example title="Le chargement a échoué" maxWidth={1100}>
|
|
59
|
+
<DeliveryHistory
|
|
60
|
+
{...base(() => Promise.reject(new Error('Flow indisponible')))}
|
|
61
|
+
/>
|
|
62
|
+
</Example>
|
|
63
|
+
<Example title="Sans abonnement ni lien vers Flow" maxWidth={1100}>
|
|
64
|
+
<DeliveryHistory
|
|
65
|
+
{...base(async () => page(POPULATED))}
|
|
66
|
+
getSubscription={undefined}
|
|
67
|
+
flowUrl={undefined}
|
|
68
|
+
/>
|
|
69
|
+
</Example>
|
|
70
|
+
<Example title="Sans droit de rejeu" maxWidth={1100}>
|
|
71
|
+
<DeliveryHistory
|
|
72
|
+
{...base(async () => page(POPULATED))}
|
|
73
|
+
canReplay={false}
|
|
74
|
+
/>
|
|
75
|
+
</Example>
|
|
76
|
+
<LastEvent />
|
|
77
|
+
</Showcase>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
@@ -1,110 +1,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="
|
|
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
|
-
|
|
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="Une seule source, sans lien vers Flow" maxWidth={1100}>
|
|
85
|
+
<DeliverySubscriptions
|
|
86
|
+
{...base(async () =>
|
|
87
|
+
page([
|
|
88
|
+
subscription({
|
|
89
|
+
url: 'https://ops.example.com/webhooks/abyss/monitor-events/production',
|
|
90
|
+
}),
|
|
91
|
+
subscription({
|
|
92
|
+
id: 'sub-4',
|
|
93
|
+
url: 'https://ops.example.com/webhooks/abyss/monitor-events/staging',
|
|
94
|
+
}),
|
|
95
|
+
]),
|
|
96
|
+
)}
|
|
97
|
+
sources={[source('MONITOR')]}
|
|
98
|
+
flowUrl={undefined}
|
|
99
|
+
/>
|
|
100
|
+
</Example>
|
|
101
|
+
<Example title="Vide" maxWidth={1100}>
|
|
102
|
+
<DeliverySubscriptions {...base(async () => page([]))} />
|
|
103
|
+
</Example>
|
|
104
|
+
<Example title="En cours de chargement" maxWidth={1100}>
|
|
105
|
+
<DeliverySubscriptions {...base(() => new Promise(() => undefined))} />
|
|
106
|
+
</Example>
|
|
107
|
+
<Example title="Le chargement a échoué" maxWidth={1100}>
|
|
108
|
+
<DeliverySubscriptions
|
|
109
|
+
{...base(() => Promise.reject(new Error('Flow indisponible')))}
|
|
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,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
|
+
};
|