@panneau/actions 5.0.0-alpha.25 → 5.0.0-alpha.27
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/dist/ActionRunnerProvider.d.ts +7 -1
- package/dist/ActionRunnerProvider.d.ts.map +1 -1
- package/dist/ActionRunnerProvider.js +95 -90
- package/dist/ActionRunnerProvider.js.map +1 -1
- package/dist/describe.d.ts +9 -0
- package/dist/describe.d.ts.map +1 -1
- package/dist/describe.js +21 -1
- package/dist/describe.js.map +1 -1
- package/package.json +8 -8
|
@@ -16,6 +16,12 @@ export interface ActionRunnerProviderProps {
|
|
|
16
16
|
* `window.location.assign()` for URLs; routes need it.
|
|
17
17
|
*/
|
|
18
18
|
onNavigate?: (to: string | RouteReference) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Opens the list of a resource filtered on the items a run changed (`filter[ids]`, decision
|
|
21
|
+
* 0069). With it, the toast of a run offers "Show" when it has nothing more to say: no "Undo",
|
|
22
|
+
* "Details" or "Download". Without it, there is no "Show".
|
|
23
|
+
*/
|
|
24
|
+
onShowItems?: (resource: string, ids: readonly string[]) => void;
|
|
19
25
|
/** Opens the `download` of a result. Defaults to a link to its URL, clicked. */
|
|
20
26
|
onDownload?: (download: ActionDownload) => void;
|
|
21
27
|
/** Handlers of `client` actions by their `component`, over those of the plugins. */
|
|
@@ -32,5 +38,5 @@ export interface ActionRunnerProviderProps {
|
|
|
32
38
|
* redirects and opens downloads. Put it inside `PanneauRoot`, and above the router of an app, so
|
|
33
39
|
* that runs are followed from page to page. `useActionRunner(resource)` runs an action.
|
|
34
40
|
*/
|
|
35
|
-
export declare function ActionRunnerProvider({ adapter, children, onResult, onNavigate, onDownload, clientActions, pollInterval, locales, }: ActionRunnerProviderProps): import("react").JSX.Element;
|
|
41
|
+
export declare function ActionRunnerProvider({ adapter, children, onResult, onNavigate, onDownload, onShowItems, clientActions, pollInterval, locales, }: ActionRunnerProviderProps): import("react").JSX.Element;
|
|
36
42
|
//# sourceMappingURL=ActionRunnerProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionRunnerProvider.d.ts","sourceRoot":"","sources":["../src/ActionRunnerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA+C,MAAM,OAAO,CAAC;AAIpF,OAAO,KAAK,EAAE,YAAY,EAAa,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ActionRunnerProvider.d.ts","sourceRoot":"","sources":["../src/ActionRunnerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA+C,MAAM,OAAO,CAAC;AAIpF,OAAO,KAAK,EAAE,YAAY,EAAa,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAejF,OAAO,KAAK,EACR,aAAa,EACb,cAAc,EAEd,mBAAmB,EAEnB,mBAAmB,EAEtB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,yBAAyB;IACtC,gFAAgF;IAChF,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC;IAC3E;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,KAAK,IAAI,CAAC;IACnD;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,CAAC;IACjE,gFAAgF;IAChF,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;IAChD,oFAAoF;IACpF,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAC9D,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B;AAmCD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EACjC,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,UAAuB,EACvB,UAAyB,EACzB,WAAW,EACX,aAAa,EACb,YAAmB,EACnB,OAAO,GACV,EAAE,yBAAyB,+BAga3B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { messages } from "./messages.js";
|
|
2
2
|
import { ParametersDialog } from "./ParametersDialog.js";
|
|
3
3
|
import { buildActionRequest, getLinkTarget, getResultCounts, isFinished } from "./request.js";
|
|
4
|
-
import { describeResult, describeSubject, getItemTitle, isInUse } from "./describe.js";
|
|
4
|
+
import { describeResult, describeSubject, getChangedItems, getItemTitle, isInUse } from "./describe.js";
|
|
5
5
|
import { ResultsDialog } from "./ResultsDialog.js";
|
|
6
6
|
import { ActionRunnerContext } from "./context.js";
|
|
7
7
|
import { c } from "react/compiler-runtime";
|
|
@@ -33,8 +33,8 @@ function openDownload(download) {
|
|
|
33
33
|
* that runs are followed from page to page. `useActionRunner(resource)` runs an action.
|
|
34
34
|
*/
|
|
35
35
|
function ActionRunnerProvider(t0) {
|
|
36
|
-
const $ = c(
|
|
37
|
-
const { adapter, children, onResult, onNavigate: t1, onDownload: t2, clientActions, pollInterval: t3, locales } = t0;
|
|
36
|
+
const $ = c(72);
|
|
37
|
+
const { adapter, children, onResult, onNavigate: t1, onDownload: t2, onShowItems, clientActions, pollInterval: t3, locales } = t0;
|
|
38
38
|
const onNavigate = t1 === void 0 ? navigateTo : t1;
|
|
39
39
|
const onDownload = t2 === void 0 ? openDownload : t2;
|
|
40
40
|
const pollInterval = t3 === void 0 ? 2e3 : t3;
|
|
@@ -83,7 +83,7 @@ function ActionRunnerProvider(t0) {
|
|
|
83
83
|
const toastKey = _temp;
|
|
84
84
|
let finish;
|
|
85
85
|
let follow;
|
|
86
|
-
if ($[8] !== adapter || $[9] !== definition?.resources || $[10] !== intl || $[11] !== itemTitleOf || $[12] !== onDownload || $[13] !== onNavigate || $[14] !== onResult || $[15] !==
|
|
86
|
+
if ($[8] !== adapter || $[9] !== definition?.resources || $[10] !== intl || $[11] !== itemTitleOf || $[12] !== onDownload || $[13] !== onNavigate || $[14] !== onResult || $[15] !== onShowItems || $[16] !== subjectOf || $[17] !== toasts) {
|
|
87
87
|
finish = async (resource_2, target_2, result, t8) => {
|
|
88
88
|
const { queued: t9 } = t8 === void 0 ? {} : t8;
|
|
89
89
|
const queued = t9 === void 0 ? false : t9;
|
|
@@ -105,6 +105,7 @@ function ActionRunnerProvider(t0) {
|
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
const undo = !queued ? result.undo ?? null : null;
|
|
108
|
+
const changed = onShowItems !== void 0 && redirect === null ? getChangedItems(target_2, result) : null;
|
|
108
109
|
toasts.show({
|
|
109
110
|
...content,
|
|
110
111
|
...undo !== null ? { action: {
|
|
@@ -119,6 +120,9 @@ function ActionRunnerProvider(t0) {
|
|
|
119
120
|
} } : download !== null ? { action: {
|
|
120
121
|
label: intl.formatMessage(messages.download),
|
|
121
122
|
onAction: () => onDownload(download)
|
|
123
|
+
} } : changed !== null ? { action: {
|
|
124
|
+
label: intl.formatMessage(messages.showChanged),
|
|
125
|
+
onAction: () => onShowItems?.(resource_2, changed)
|
|
122
126
|
} } : {}
|
|
123
127
|
}, { key: toastKey(resource_2, target_2) });
|
|
124
128
|
if (redirect !== null) onNavigate(redirect);
|
|
@@ -175,16 +179,17 @@ function ActionRunnerProvider(t0) {
|
|
|
175
179
|
$[12] = onDownload;
|
|
176
180
|
$[13] = onNavigate;
|
|
177
181
|
$[14] = onResult;
|
|
178
|
-
$[15] =
|
|
179
|
-
$[16] =
|
|
180
|
-
$[17] =
|
|
181
|
-
$[18] =
|
|
182
|
+
$[15] = onShowItems;
|
|
183
|
+
$[16] = subjectOf;
|
|
184
|
+
$[17] = toasts;
|
|
185
|
+
$[18] = finish;
|
|
186
|
+
$[19] = follow;
|
|
182
187
|
} else {
|
|
183
|
-
finish = $[
|
|
184
|
-
follow = $[
|
|
188
|
+
finish = $[18];
|
|
189
|
+
follow = $[19];
|
|
185
190
|
}
|
|
186
191
|
let t8;
|
|
187
|
-
if ($[
|
|
192
|
+
if ($[20] !== finish || $[21] !== intl || $[22] !== subjectOf || $[23] !== toasts) {
|
|
188
193
|
t8 = async (entry_0) => {
|
|
189
194
|
const { run: run_0, resource: resource_5, target: target_5 } = entry_0;
|
|
190
195
|
if (notified.current.has(run_0.id)) return;
|
|
@@ -215,15 +220,15 @@ function ActionRunnerProvider(t0) {
|
|
|
215
220
|
tone: "success"
|
|
216
221
|
}, key_0);
|
|
217
222
|
};
|
|
218
|
-
$[
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
} else t8 = $[
|
|
223
|
+
$[20] = finish;
|
|
224
|
+
$[21] = intl;
|
|
225
|
+
$[22] = subjectOf;
|
|
226
|
+
$[23] = toasts;
|
|
227
|
+
$[24] = t8;
|
|
228
|
+
} else t8 = $[24];
|
|
224
229
|
const ended = t8;
|
|
225
230
|
let t9;
|
|
226
|
-
if ($[
|
|
231
|
+
if ($[25] !== adapter || $[26] !== finish || $[27] !== follow) {
|
|
227
232
|
t9 = async (resource_6, target_6, t10) => {
|
|
228
233
|
const values = t10 === void 0 ? {} : t10;
|
|
229
234
|
const response_0 = await adapter.runAction(resource_6, target_6.action.id, buildActionRequest(target_6, values));
|
|
@@ -240,14 +245,14 @@ function ActionRunnerProvider(t0) {
|
|
|
240
245
|
result: response_0.result
|
|
241
246
|
};
|
|
242
247
|
};
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
} else t9 = $[
|
|
248
|
+
$[25] = adapter;
|
|
249
|
+
$[26] = finish;
|
|
250
|
+
$[27] = follow;
|
|
251
|
+
$[28] = t9;
|
|
252
|
+
} else t9 = $[28];
|
|
248
253
|
const execute = t9;
|
|
249
254
|
let t10;
|
|
250
|
-
if ($[
|
|
255
|
+
if ($[29] !== clientActions || $[30] !== execute || $[31] !== onNavigate || $[32] !== plugins) {
|
|
251
256
|
t10 = (resource_7, target_7) => {
|
|
252
257
|
const { action: action_1 } = target_7;
|
|
253
258
|
if (action_1.kind === "link") {
|
|
@@ -277,15 +282,15 @@ function ActionRunnerProvider(t0) {
|
|
|
277
282
|
}));
|
|
278
283
|
return execute(resource_7, target_7);
|
|
279
284
|
};
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
} else t10 = $[
|
|
285
|
+
$[29] = clientActions;
|
|
286
|
+
$[30] = execute;
|
|
287
|
+
$[31] = onNavigate;
|
|
288
|
+
$[32] = plugins;
|
|
289
|
+
$[33] = t10;
|
|
290
|
+
} else t10 = $[33];
|
|
286
291
|
const run_1 = t10;
|
|
287
292
|
let t11;
|
|
288
|
-
if ($[
|
|
293
|
+
if ($[34] !== adapter || $[35] !== ended || $[36] !== runs) {
|
|
289
294
|
t11 = async (id) => {
|
|
290
295
|
if (adapter.cancelActionRun === void 0) throw new Error("The adapter cannot cancel runs.");
|
|
291
296
|
await adapter.cancelActionRun(id);
|
|
@@ -300,27 +305,27 @@ function ActionRunnerProvider(t0) {
|
|
|
300
305
|
run: updated
|
|
301
306
|
});
|
|
302
307
|
};
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
307
|
-
} else t11 = $[
|
|
308
|
+
$[34] = adapter;
|
|
309
|
+
$[35] = ended;
|
|
310
|
+
$[36] = runs;
|
|
311
|
+
$[37] = t11;
|
|
312
|
+
} else t11 = $[37];
|
|
308
313
|
const cancelRun = t11;
|
|
309
314
|
let t12;
|
|
310
|
-
if ($[
|
|
315
|
+
if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
|
|
311
316
|
t12 = (id_0) => setRuns((current_1) => current_1.filter((entry_3) => entry_3.run.id !== id_0));
|
|
312
|
-
$[
|
|
313
|
-
} else t12 = $[
|
|
317
|
+
$[38] = t12;
|
|
318
|
+
} else t12 = $[38];
|
|
314
319
|
const dismissRun = t12;
|
|
315
320
|
let t13;
|
|
316
|
-
if ($[
|
|
321
|
+
if ($[39] !== ended) {
|
|
317
322
|
t13 = (entry_4) => ended(entry_4);
|
|
318
|
-
$[
|
|
319
|
-
$[
|
|
320
|
-
} else t13 = $[
|
|
323
|
+
$[39] = ended;
|
|
324
|
+
$[40] = t13;
|
|
325
|
+
} else t13 = $[40];
|
|
321
326
|
const onRunEnded = useEffectEvent(t13);
|
|
322
327
|
let t14;
|
|
323
|
-
if ($[
|
|
328
|
+
if ($[41] !== adapter || $[42] !== onRunEnded || $[43] !== pollInterval || $[44] !== runs) {
|
|
324
329
|
t14 = () => {
|
|
325
330
|
const active = runs.filter(_temp2);
|
|
326
331
|
if (active.length === 0) return;
|
|
@@ -348,38 +353,38 @@ function ActionRunnerProvider(t0) {
|
|
|
348
353
|
clearTimeout(timer);
|
|
349
354
|
};
|
|
350
355
|
};
|
|
351
|
-
$[
|
|
352
|
-
$[
|
|
353
|
-
$[
|
|
354
|
-
$[
|
|
355
|
-
$[
|
|
356
|
-
} else t14 = $[
|
|
356
|
+
$[41] = adapter;
|
|
357
|
+
$[42] = onRunEnded;
|
|
358
|
+
$[43] = pollInterval;
|
|
359
|
+
$[44] = runs;
|
|
360
|
+
$[45] = t14;
|
|
361
|
+
} else t14 = $[45];
|
|
357
362
|
let t15;
|
|
358
|
-
if ($[
|
|
363
|
+
if ($[46] !== adapter || $[47] !== pollInterval || $[48] !== runs) {
|
|
359
364
|
t15 = [
|
|
360
365
|
runs,
|
|
361
366
|
adapter,
|
|
362
367
|
pollInterval
|
|
363
368
|
];
|
|
364
|
-
$[
|
|
365
|
-
$[
|
|
366
|
-
$[
|
|
367
|
-
$[
|
|
368
|
-
} else t15 = $[
|
|
369
|
+
$[46] = adapter;
|
|
370
|
+
$[47] = pollInterval;
|
|
371
|
+
$[48] = runs;
|
|
372
|
+
$[49] = t15;
|
|
373
|
+
} else t15 = $[49];
|
|
369
374
|
useEffect(t14, t15);
|
|
370
375
|
let t16;
|
|
371
|
-
if ($[
|
|
376
|
+
if ($[50] === Symbol.for("react.memo_cache_sentinel")) {
|
|
372
377
|
t16 = () => {
|
|
373
378
|
watchers.current = watchers.current + 1;
|
|
374
379
|
return () => {
|
|
375
380
|
watchers.current = watchers.current - 1;
|
|
376
381
|
};
|
|
377
382
|
};
|
|
378
|
-
$[
|
|
379
|
-
} else t16 = $[
|
|
383
|
+
$[50] = t16;
|
|
384
|
+
} else t16 = $[50];
|
|
380
385
|
const watchRuns = t16;
|
|
381
386
|
let t17;
|
|
382
|
-
if ($[
|
|
387
|
+
if ($[51] !== adapter || $[52] !== cancelRun || $[53] !== run_1 || $[54] !== runs) {
|
|
383
388
|
t17 = {
|
|
384
389
|
adapter,
|
|
385
390
|
run: run_1,
|
|
@@ -388,16 +393,16 @@ function ActionRunnerProvider(t0) {
|
|
|
388
393
|
dismissRun,
|
|
389
394
|
watchRuns
|
|
390
395
|
};
|
|
391
|
-
$[
|
|
392
|
-
$[
|
|
393
|
-
$[
|
|
394
|
-
$[
|
|
395
|
-
$[
|
|
396
|
-
} else t17 = $[
|
|
396
|
+
$[51] = adapter;
|
|
397
|
+
$[52] = cancelRun;
|
|
398
|
+
$[53] = run_1;
|
|
399
|
+
$[54] = runs;
|
|
400
|
+
$[55] = t17;
|
|
401
|
+
} else t17 = $[55];
|
|
397
402
|
const value = t17;
|
|
398
403
|
const ClientHandler = client?.Handler;
|
|
399
404
|
let t18;
|
|
400
|
-
if ($[
|
|
405
|
+
if ($[56] !== execute || $[57] !== locales || $[58] !== parameters) {
|
|
401
406
|
t18 = parameters !== null ? /* @__PURE__ */ jsx(ParametersDialog, {
|
|
402
407
|
action: parameters.target.action,
|
|
403
408
|
count: parameters.target.count,
|
|
@@ -412,13 +417,13 @@ function ActionRunnerProvider(t0) {
|
|
|
412
417
|
parameters.resolve(false);
|
|
413
418
|
}
|
|
414
419
|
}) : null;
|
|
415
|
-
$[
|
|
416
|
-
$[
|
|
417
|
-
$[
|
|
418
|
-
$[
|
|
419
|
-
} else t18 = $[
|
|
420
|
+
$[56] = execute;
|
|
421
|
+
$[57] = locales;
|
|
422
|
+
$[58] = parameters;
|
|
423
|
+
$[59] = t18;
|
|
424
|
+
} else t18 = $[59];
|
|
420
425
|
let t19;
|
|
421
|
-
if ($[
|
|
426
|
+
if ($[60] !== ClientHandler || $[61] !== client || $[62] !== finish) {
|
|
422
427
|
t19 = client !== null && ClientHandler !== void 0 ? /* @__PURE__ */ jsx(ClientHandler, {
|
|
423
428
|
action: client.target.action,
|
|
424
429
|
resource: client.resource,
|
|
@@ -442,23 +447,23 @@ function ActionRunnerProvider(t0) {
|
|
|
442
447
|
client.resolve(false);
|
|
443
448
|
}
|
|
444
449
|
}) : null;
|
|
445
|
-
$[
|
|
446
|
-
$[
|
|
447
|
-
$[
|
|
448
|
-
$[
|
|
449
|
-
} else t19 = $[
|
|
450
|
+
$[60] = ClientHandler;
|
|
451
|
+
$[61] = client;
|
|
452
|
+
$[62] = finish;
|
|
453
|
+
$[63] = t19;
|
|
454
|
+
} else t19 = $[63];
|
|
450
455
|
let t20;
|
|
451
|
-
if ($[
|
|
456
|
+
if ($[64] !== details) {
|
|
452
457
|
t20 = details !== null ? /* @__PURE__ */ jsx(ResultsDialog, {
|
|
453
458
|
label: details.label,
|
|
454
459
|
result: details.result,
|
|
455
460
|
onClose: () => setDetails(null)
|
|
456
461
|
}) : null;
|
|
457
|
-
$[
|
|
458
|
-
$[
|
|
459
|
-
} else t20 = $[
|
|
462
|
+
$[64] = details;
|
|
463
|
+
$[65] = t20;
|
|
464
|
+
} else t20 = $[65];
|
|
460
465
|
let t21;
|
|
461
|
-
if ($[
|
|
466
|
+
if ($[66] !== children || $[67] !== t18 || $[68] !== t19 || $[69] !== t20 || $[70] !== value) {
|
|
462
467
|
t21 = /* @__PURE__ */ jsxs(ActionRunnerContext, {
|
|
463
468
|
value,
|
|
464
469
|
children: [
|
|
@@ -468,13 +473,13 @@ function ActionRunnerProvider(t0) {
|
|
|
468
473
|
t20
|
|
469
474
|
]
|
|
470
475
|
});
|
|
471
|
-
$[
|
|
472
|
-
$[
|
|
473
|
-
$[
|
|
474
|
-
$[
|
|
475
|
-
$[
|
|
476
|
-
$[
|
|
477
|
-
} else t21 = $[
|
|
476
|
+
$[66] = children;
|
|
477
|
+
$[67] = t18;
|
|
478
|
+
$[68] = t19;
|
|
479
|
+
$[69] = t20;
|
|
480
|
+
$[70] = value;
|
|
481
|
+
$[71] = t21;
|
|
482
|
+
} else t21 = $[71];
|
|
478
483
|
return t21;
|
|
479
484
|
}
|
|
480
485
|
function _temp3(current_2) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionRunnerProvider.js","names":["ReactNode","useEffect","useEffectEvent","useRef","useState","usePanneau","getActionLabel","ActionResult","ActionRun","RouteReference","usePanneauIntl","useToast","ParametersDialog","ResultsDialog","ActionRunnerContext","ActionRunnerContextValue","describeResult","describeSubject","getItemTitle","isInUse","messages","buildActionRequest","getLinkTarget","getResultCounts","isFinished","ActionAdapter","ActionDownload","ActionOutcome","ActionResultContext","ActionTarget","ClientActionHandler","FollowedRun","ActionRunnerProviderProps","adapter","children","onResult","result","context","onNavigate","to","onDownload","download","clientActions","Readonly","Record","pollInterval","locales","Pending","resource","target","resolve","outcome","ClientPending","Handler","navigateTo","window","location","assign","console","warn","route","openDownload","link","document","createElement","href","url","filename","undefined","rel","hidden","body","append","click","remove","ActionRunnerProvider","t0","$","_c","t1","t2","t3","intl","toasts","definition","plugins","parameters","setParameters","client","setClient","details","setDetails","t4","Symbol","for","runs","setRuns","t5","Set","notified","watchers","t6","resources","t7","count","find","candidate","id","subjectOf","resource_0","target_0","item","itemTitle","candidate_0","locale","itemTitleOf","toastKey","_temp","finish","follow","resource_2","target_2","t8","queued","t9","counts","itemTitle_0","content","action","succeeded","entries","results","hasDetails","length","redirect","saysMore","message","current","undo","show","label","formatMessage","onAction","runUndo","key","resource_3","target_3","undo_0","declared","candidate_1","actions","undoTarget","kind","scope","selection","ids","items","runAction","values","params","then","response","run","subject","title","undoneFor","undone","catch","error","undoFailed","Error","description","tone","resource_4","target_4","filter","entry","entry_0","run_0","resource_5","target_5","has","add","action_0","subject_0","key_0","status","cancelledFor","cancelled","failedFor","failed","doneFor","done","ended","resource_6","target_6","t10","response_0","execute","resource_7","target_7","action_1","Promise","reject","name","component","Object","hasOwn","get","fields","resolve_0","run_1","t11","cancelActionRun","updated","getActionRun","current_0","map","entry_1","entry_2","candidate_2","cancelRun","t12","id_0","current_1","entry_3","dismissRun","t13","entry_4","onRunEnded","t14","active","_temp2","stopped","timer","setTimeout","all","entry_6","next","current_3","candidate_3","_temp3","clearTimeout","t15","t16","watchRuns","t17","value","ClientHandler","t18","values_0","t19","result_0","t20","t21","current_2","entry_5","resource_1","target_1","_c"],"sources":["../src/ActionRunnerProvider.tsx"],"sourcesContent":["import { type ReactNode, useEffect, useEffectEvent, useRef, useState } from 'react';\n\nimport { usePanneau } from '@panneau/core';\nimport { getActionLabel } from '@panneau/intl';\nimport type { ActionResult, ActionRun, RouteReference } from '@panneau/protocol';\nimport { usePanneauIntl, useToast } from '@panneau/ui';\n\nimport { ParametersDialog } from './ParametersDialog';\nimport { ResultsDialog } from './ResultsDialog';\nimport { ActionRunnerContext, type ActionRunnerContextValue } from './context';\nimport { describeResult, describeSubject, getItemTitle, isInUse } from './describe';\nimport { messages } from './messages';\nimport { buildActionRequest, getLinkTarget, getResultCounts, isFinished } from './request';\nimport type {\n ActionAdapter,\n ActionDownload,\n ActionOutcome,\n ActionResultContext,\n ActionTarget,\n ClientActionHandler,\n FollowedRun,\n} from './types';\n\nexport interface ActionRunnerProviderProps {\n /** Runs the actions: a `DataAdapter`, or any object with its action methods. */\n adapter: ActionAdapter;\n children?: ReactNode;\n /**\n * Called with every result: of an action that finished at once, and of a queued run when it\n * finishes. Refresh what it changed here. With `@panneau/data/query`:\n * `invalidateActionResult(client, resource, result, target.selection)`.\n */\n onResult?: (result: ActionResult, context: ActionResultContext) => unknown;\n /**\n * Goes to the `redirect` of a result, or to the URL or route of a `link` action. Defaults to\n * `window.location.assign()` for URLs; routes need it.\n */\n onNavigate?: (to: string | RouteReference) => void;\n /** Opens the `download` of a result. Defaults to a link to its URL, clicked. */\n onDownload?: (download: ActionDownload) => void;\n /** Handlers of `client` actions by their `component`, over those of the plugins. */\n clientActions?: Readonly<Record<string, ClientActionHandler>>;\n /** Milliseconds between two checks of a queued run. Defaults to 2000. */\n pollInterval?: number;\n /** Locales of localized parameters. Defaults to the definition's. */\n locales?: readonly string[];\n}\n\ninterface Pending {\n resource: string;\n target: ActionTarget;\n resolve: (outcome: ActionOutcome | false) => void;\n}\n\ninterface ClientPending extends Pending {\n Handler: ClientActionHandler;\n}\n\nfunction navigateTo(to: string | RouteReference) {\n if (typeof to === 'string') {\n window.location.assign(to);\n } else {\n console.warn(\n `[panneau] An action goes to the route \"${to.route}\": give ActionRunnerProvider an onNavigate.`,\n );\n }\n}\n\nfunction openDownload(download: ActionDownload) {\n const link = document.createElement('a');\n link.href = download.url;\n if (download.filename !== undefined) {\n link.download = download.filename;\n }\n link.rel = 'noopener';\n link.hidden = true;\n document.body.append(link);\n link.click();\n link.remove();\n}\n\n/**\n * Runs the actions that lists and forms hand over ([decision 0023]): it asks for their parameters\n * in a dialog, runs them through the adapter, shows their result (a toast, and the items that\n * didn't succeed), follows queued runs until they end, refreshes through `onResult`, follows\n * redirects and opens downloads. Put it inside `PanneauRoot`, and above the router of an app, so\n * that runs are followed from page to page. `useActionRunner(resource)` runs an action.\n */\nexport function ActionRunnerProvider({\n adapter,\n children,\n onResult,\n onNavigate = navigateTo,\n onDownload = openDownload,\n clientActions,\n pollInterval = 2000,\n locales,\n}: ActionRunnerProviderProps) {\n const intl = usePanneauIntl();\n const toasts = useToast();\n const { definition, plugins } = usePanneau();\n const [parameters, setParameters] = useState<Pending | null>(null);\n const [client, setClient] = useState<ClientPending | null>(null);\n const [details, setDetails] = useState<{ label: string; result: ActionResult } | null>(null);\n const [runs, setRuns] = useState<readonly FollowedRun[]>([]);\n // Runs whose end was already shown, so that a late poll doesn't show it twice.\n const notified = useRef(new Set<string>());\n // How many lists of runs are on screen (the popover of the runs): their user sees a run end.\n const watchers = useRef(0);\n\n /** What the action applied to, by the item's title or the count of items. */\n const subjectOf = (resource: string, target: ActionTarget, count: number | null = null) =>\n describeSubject(\n target,\n definition?.resources.find((candidate) => candidate.id === resource),\n intl,\n count,\n );\n\n /** The title of the item of an `item` action, to name it. */\n const itemTitleOf = (resource: string, target: ActionTarget) => {\n if (target.item === undefined) {\n return null;\n }\n const itemTitle = definition?.resources.find(\n (candidate) => candidate.id === resource,\n )?.itemTitle;\n return getItemTitle(target.item, itemTitle, intl.locale);\n };\n\n /** One toast per action and target: running it again replaces it. */\n const toastKey = (resource: string, target: ActionTarget) =>\n `panneau-action:${resource}:${target.action.id}:${target.item?.id ?? 'selection'}`;\n\n const finish = async (\n resource: string,\n target: ActionTarget,\n result: ActionResult,\n { queued = false }: { queued?: boolean } = {},\n ) => {\n await onResult?.(result, { resource, target });\n const counts = getResultCounts(result);\n const itemTitle = itemTitleOf(resource, target);\n const content = describeResult(\n result,\n getActionLabel(target.action, intl),\n intl,\n subjectOf(resource, target, counts.succeeded),\n itemTitle,\n );\n const entries = result.results ?? [];\n // The toast already names an item that is in use: its details would only repeat it.\n const hasDetails =\n entries.length > 0 &&\n !(\n entries.length === 1 &&\n entries[0] !== undefined &&\n isInUse(entries[0]) &&\n itemTitle !== null\n );\n const download = result.download ?? null;\n if (download !== null) {\n onDownload(download);\n }\n const redirect = result.redirect ?? null;\n // A queued run that ends in the open list of runs is seen there, unless its result says\n // more than its status: a message, items that didn't succeed, a download.\n const saysMore = (result.message ?? '') !== '' || hasDetails || download !== null;\n if (queued && watchers.current > 0 && !saysMore) {\n if (redirect !== null) {\n onNavigate(redirect);\n }\n return;\n }\n // \"Undo\" lives in the toast only (decision 0063): a queued run, which finished later, isn't\n // undone.\n const undo = !queued ? (result.undo ?? null) : null;\n toasts.show(\n {\n ...content,\n ...(undo !== null\n ? {\n action: {\n label: intl.formatMessage(messages.undo),\n onAction: () => void runUndo(resource, target, undo),\n },\n }\n : hasDetails\n ? {\n action: {\n label: intl.formatMessage(messages.details),\n onAction: () =>\n setDetails({\n label: getActionLabel(target.action, intl),\n result,\n }),\n },\n }\n : download !== null\n ? {\n action: {\n label: intl.formatMessage(messages.download),\n onAction: () => onDownload(download),\n },\n }\n : {}),\n },\n { key: toastKey(resource, target) },\n );\n if (redirect !== null) {\n onNavigate(redirect);\n }\n };\n\n /**\n * Runs the undo of a result: an action of the same resource, on the items it lists, as any\n * action. A short toast then says it was undone, in place of the first one.\n */\n const runUndo = async (\n resource: string,\n target: ActionTarget,\n undo: NonNullable<ActionResult['undo']>,\n ) => {\n const label = getActionLabel(target.action, intl);\n const key = { key: toastKey(resource, target) };\n const declared = definition?.resources\n .find((candidate) => candidate.id === resource)\n ?.actions?.find((action) => action.id === undo.action);\n const undoTarget: ActionTarget = {\n action: declared ?? { id: undo.action, kind: 'server', scope: ['selection'] },\n scope: 'selection',\n selection: { ids: undo.items },\n count: undo.items.length,\n };\n await adapter\n .runAction(resource, undo.action, {\n selection: { ids: undo.items },\n values: undo.params ?? {},\n })\n .then(async (response) => {\n if (response.run !== undefined) {\n follow(resource, undoTarget, response.run);\n return;\n }\n await onResult?.(response.result, { resource, target: undoTarget });\n const subject = subjectOf(resource, target, undo.items.length);\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.undoneFor, {\n action: label,\n subject,\n })\n : intl.formatMessage(messages.undone, { action: label }),\n },\n key,\n );\n })\n .catch((error: unknown) => {\n toasts.show(\n {\n title: intl.formatMessage(messages.undoFailed, { action: label }),\n ...(error instanceof Error && error.message !== ''\n ? { description: error.message }\n : {}),\n tone: 'danger',\n },\n key,\n );\n });\n };\n\n // No toast when a run starts: the runs button of the shell shows it, and its popover follows\n // it. The toast comes when the run ends.\n const follow = (resource: string, target: ActionTarget, run: ActionRun) => {\n setRuns((current) => [\n ...current.filter((entry) => entry.run.id !== run.id),\n { run, resource, target },\n ]);\n };\n\n const ended = async (entry: FollowedRun) => {\n const { run, resource, target } = entry;\n if (notified.current.has(run.id)) {\n return;\n }\n notified.current.add(run.id);\n if (run.result !== undefined) {\n await finish(resource, target, run.result, { queued: true });\n return;\n }\n const action = getActionLabel(target.action, intl);\n const subject = subjectOf(resource, target);\n const key = { key: toastKey(resource, target) };\n if (run.status === 'cancelled') {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.cancelledFor, { action, subject })\n : intl.formatMessage(messages.cancelled, { action }),\n },\n key,\n );\n } else if (run.status === 'failed') {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.failedFor, { action, subject })\n : intl.formatMessage(messages.failed, { action }),\n tone: 'danger',\n },\n key,\n );\n } else if (watchers.current === 0) {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.doneFor, { action, subject })\n : intl.formatMessage(messages.done, { action }),\n tone: 'success',\n },\n key,\n );\n }\n };\n\n const execute = async (\n resource: string,\n target: ActionTarget,\n values: Record<string, unknown> = {},\n ): Promise<ActionOutcome> => {\n const response = await adapter.runAction(\n resource,\n target.action.id,\n buildActionRequest(target, values),\n );\n if (response.run !== undefined) {\n follow(resource, target, response.run);\n return { status: 'queued', run: response.run };\n }\n await finish(resource, target, response.result);\n return { status: 'done', result: response.result };\n };\n\n const run = (resource: string, target: ActionTarget): Promise<ActionOutcome | false> => {\n const { action } = target;\n if (action.kind === 'link') {\n const to = getLinkTarget(target);\n if (to === null) {\n return Promise.reject(new Error(`The action \"${action.id}\" has no URL or route.`));\n }\n onNavigate(to);\n return Promise.resolve({ status: 'navigated', to });\n }\n if (action.kind === 'client') {\n const name = action.component ?? '';\n const Handler =\n (clientActions !== undefined && Object.hasOwn(clientActions, name)\n ? clientActions[name]\n : undefined) ?? (plugins.actions.get(name) as ClientActionHandler | undefined);\n if (Handler === undefined) {\n return Promise.reject(\n new Error(`No handler for the client action \"${action.id}\" (${name}).`),\n );\n }\n return new Promise((resolve) => setClient({ resource, target, resolve, Handler }));\n }\n if ((action.fields ?? []).length > 0) {\n return new Promise((resolve) => setParameters({ resource, target, resolve }));\n }\n return execute(resource, target);\n };\n\n const cancelRun = async (id: string) => {\n if (adapter.cancelActionRun === undefined) {\n throw new Error('The adapter cannot cancel runs.');\n }\n await adapter.cancelActionRun(id);\n const updated = await adapter.getActionRun(id);\n setRuns((current) =>\n current.map((entry) => (entry.run.id === id ? { ...entry, run: updated } : entry)),\n );\n const entry = runs.find((candidate) => candidate.run.id === id);\n if (entry !== undefined && isFinished(updated.status)) {\n await ended({ ...entry, run: updated });\n }\n };\n\n const dismissRun = (id: string) =>\n setRuns((current) => current.filter((entry) => entry.run.id !== id));\n\n const onRunEnded = useEffectEvent((entry: FollowedRun) => ended(entry));\n\n // Checks the unfinished runs, one interval after the last change of the runs.\n useEffect(() => {\n const active = runs.filter((entry) => !isFinished(entry.run.status));\n if (active.length === 0) {\n return undefined;\n }\n let stopped = false;\n const timer = setTimeout(() => {\n void Promise.all(\n active.map(async (entry) => {\n try {\n const next = await adapter.getActionRun(entry.run.id);\n if (stopped) {\n return;\n }\n setRuns((current) =>\n current.map((candidate) =>\n candidate.run.id === next.id\n ? { ...candidate, run: next }\n : candidate,\n ),\n );\n if (isFinished(next.status)) {\n await onRunEnded({ ...entry, run: next });\n }\n } catch {\n // Checked again at the next interval.\n if (!stopped) {\n setRuns((current) => [...current]);\n }\n }\n }),\n );\n }, pollInterval);\n return () => {\n stopped = true;\n clearTimeout(timer);\n };\n }, [runs, adapter, pollInterval]);\n\n const watchRuns = () => {\n watchers.current += 1;\n return () => {\n watchers.current -= 1;\n };\n };\n\n const value: ActionRunnerContextValue = {\n adapter,\n run,\n runs,\n cancelRun,\n dismissRun,\n watchRuns,\n };\n\n const ClientHandler = client?.Handler;\n return (\n <ActionRunnerContext value={value}>\n {children}\n {parameters !== null ? (\n <ParametersDialog\n action={parameters.target.action}\n count={parameters.target.count}\n locales={locales}\n onSubmit={(values) => execute(parameters.resource, parameters.target, values)}\n onDone={(outcome) => {\n setParameters(null);\n parameters.resolve(outcome);\n }}\n onCancel={() => {\n setParameters(null);\n parameters.resolve(false);\n }}\n />\n ) : null}\n {client !== null && ClientHandler !== undefined ? (\n <ClientHandler\n action={client.target.action}\n resource={client.resource}\n target={client.target}\n onDone={(result) => {\n setClient(null);\n if (result === undefined) {\n client.resolve({ status: 'done', result: {} });\n return;\n }\n void finish(client.resource, client.target, result).then(() =>\n client.resolve({ status: 'done', result }),\n );\n }}\n onCancel={() => {\n setClient(null);\n client.resolve(false);\n }}\n />\n ) : null}\n {details !== null ? (\n <ResultsDialog\n label={details.label}\n result={details.result}\n onClose={() => setDetails(null)}\n />\n ) : null}\n </ActionRunnerContext>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA0DA,SAASsD,WAAWf,IAA6B;CAC7C,IAAI,OAAOA,OAAO,UACdgB,OAAOC,SAASC,OAAOlB,EAAE;MAEzBmB,QAAQC,KACJ,0CAA0CpB,GAAGqB,MAAK,4CACtD;AAER;AAEA,SAASC,aAAapB,UAA0B;CAC5C,MAAMqB,OAAOC,SAASC,cAAc,GAAG;CACvCF,KAAKG,OAAOxB,SAASyB;CACrB,IAAIzB,SAAS0B,aAAaC,KAAAA,GACtBN,KAAKrB,WAAWA,SAAS0B;CAE7BL,KAAKO,MAAM;CACXP,KAAKQ,SAAS;CACdP,SAASQ,KAAKC,OAAOV,IAAI;CACzBA,KAAKW,MAAM;CACXX,KAAKY,OAAO;AAChB;;;;;;;;AASA,SAAOC,qBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAA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CAAA,IAAAgL;CAAA,IAAAhL,EAAA,QAAAa,SAAA;EACPmK,MAAAnK,YAAY,OACT,oBAAC,eAAD;GACW,OAAAA,QAAOkD;GACN,QAAAlD,QAAOtD;GACN,eAAMuD,WAAW,IAAI;EAAC,CAAA,IAJtC;EAMOd,EAAA,MAAAa;EAAAb,EAAA,MAAAgL;CAAA,OAAAA,MAAAhL,EAAA;CAAA,IAAAiL;CAAA,IAAAjL,EAAA,QAAA3C,YAAA2C,EAAA,QAAA4K,OAAA5K,EAAA,QAAA8K,OAAA9K,EAAA,QAAAgL,OAAAhL,EAAA,QAAA0K,OAAA;EA7CZO,MAAA,qBAAC,qBAAD;GAA4BP;GAA5B,UAAA;IACKrN;IACAuN;IAgBAE;IAqBAE;GAvCe;;EA8CEhL,EAAA,MAAA3C;EAAA2C,EAAA,MAAA4K;EAAA5K,EAAA,MAAA8K;EAAA9K,EAAA,MAAAgL;EAAAhL,EAAA,MAAA0K;EAAA1K,EAAA,MAAAiL;CAAA,OAAAA,MAAAjL,EAAA;CAAA,OA9CtBiL;AA8CsB;AA7ZvB,SAAAb,OAAAc,WAAA;CAAA,OAiV0C,CAAA,GAAItH,SAAO;AAAC;AAjVtD,SAAA+F,OAAAwB,SAAA;CAAA,OAuTuC,CAACxO,WAAWwJ,QAAKd,IAAIwB,MAAO;AAAC;AAvTpE,SAAArE,MAAA4I,YAAAC,UAAA;CAAA,OA4CC,kBAAkBlN,WAAQ,GAAIC,SAAM+E,OAAOrB,GAAG,GAAI1D,SAAM8D,MAASJ,MAAf;AAAgC"}
|
|
1
|
+
{"version":3,"file":"ActionRunnerProvider.js","names":["ReactNode","useEffect","useEffectEvent","useRef","useState","usePanneau","getActionLabel","ActionResult","ActionRun","RouteReference","usePanneauIntl","useToast","ParametersDialog","ResultsDialog","ActionRunnerContext","ActionRunnerContextValue","describeResult","describeSubject","getChangedItems","getItemTitle","isInUse","messages","buildActionRequest","getLinkTarget","getResultCounts","isFinished","ActionAdapter","ActionDownload","ActionOutcome","ActionResultContext","ActionTarget","ClientActionHandler","FollowedRun","ActionRunnerProviderProps","adapter","children","onResult","result","context","onNavigate","to","onShowItems","resource","ids","onDownload","download","clientActions","Readonly","Record","pollInterval","locales","Pending","target","resolve","outcome","ClientPending","Handler","navigateTo","window","location","assign","console","warn","route","openDownload","link","document","createElement","href","url","filename","undefined","rel","hidden","body","append","click","remove","ActionRunnerProvider","t0","$","_c","t1","t2","t3","intl","toasts","definition","plugins","parameters","setParameters","client","setClient","details","setDetails","t4","Symbol","for","runs","setRuns","t5","Set","notified","watchers","t6","resources","t7","count","find","candidate","id","subjectOf","resource_0","target_0","item","itemTitle","candidate_0","locale","itemTitleOf","toastKey","_temp","finish","follow","resource_2","target_2","t8","queued","t9","counts","itemTitle_0","content","action","succeeded","entries","results","hasDetails","length","redirect","saysMore","message","current","undo","changed","show","label","formatMessage","onAction","runUndo","showChanged","key","resource_3","target_3","undo_0","declared","candidate_1","actions","undoTarget","kind","scope","selection","items","runAction","values","params","then","response","run","subject","title","undoneFor","undone","catch","error","undoFailed","Error","description","tone","resource_4","target_4","filter","entry","entry_0","run_0","resource_5","target_5","has","add","action_0","subject_0","key_0","status","cancelledFor","cancelled","failedFor","failed","doneFor","done","ended","resource_6","target_6","t10","response_0","execute","resource_7","target_7","action_1","Promise","reject","name","component","Object","hasOwn","get","fields","resolve_0","run_1","t11","cancelActionRun","updated","getActionRun","current_0","map","entry_1","entry_2","candidate_2","cancelRun","t12","id_0","current_1","entry_3","dismissRun","t13","entry_4","onRunEnded","t14","active","_temp2","stopped","timer","setTimeout","all","entry_6","next","current_3","candidate_3","_temp3","clearTimeout","t15","t16","watchRuns","t17","value","ClientHandler","t18","values_0","t19","result_0","t20","t21","current_2","entry_5","resource_1","target_1","_c"],"sources":["../src/ActionRunnerProvider.tsx"],"sourcesContent":["import { type ReactNode, useEffect, useEffectEvent, useRef, useState } from 'react';\n\nimport { usePanneau } from '@panneau/core';\nimport { getActionLabel } from '@panneau/intl';\nimport type { ActionResult, ActionRun, RouteReference } from '@panneau/protocol';\nimport { usePanneauIntl, useToast } from '@panneau/ui';\n\nimport { ParametersDialog } from './ParametersDialog';\nimport { ResultsDialog } from './ResultsDialog';\nimport { ActionRunnerContext, type ActionRunnerContextValue } from './context';\nimport {\n describeResult,\n describeSubject,\n getChangedItems,\n getItemTitle,\n isInUse,\n} from './describe';\nimport { messages } from './messages';\nimport { buildActionRequest, getLinkTarget, getResultCounts, isFinished } from './request';\nimport type {\n ActionAdapter,\n ActionDownload,\n ActionOutcome,\n ActionResultContext,\n ActionTarget,\n ClientActionHandler,\n FollowedRun,\n} from './types';\n\nexport interface ActionRunnerProviderProps {\n /** Runs the actions: a `DataAdapter`, or any object with its action methods. */\n adapter: ActionAdapter;\n children?: ReactNode;\n /**\n * Called with every result: of an action that finished at once, and of a queued run when it\n * finishes. Refresh what it changed here. With `@panneau/data/query`:\n * `invalidateActionResult(client, resource, result, target.selection)`.\n */\n onResult?: (result: ActionResult, context: ActionResultContext) => unknown;\n /**\n * Goes to the `redirect` of a result, or to the URL or route of a `link` action. Defaults to\n * `window.location.assign()` for URLs; routes need it.\n */\n onNavigate?: (to: string | RouteReference) => void;\n /**\n * Opens the list of a resource filtered on the items a run changed (`filter[ids]`, decision\n * 0069). With it, the toast of a run offers \"Show\" when it has nothing more to say: no \"Undo\",\n * \"Details\" or \"Download\". Without it, there is no \"Show\".\n */\n onShowItems?: (resource: string, ids: readonly string[]) => void;\n /** Opens the `download` of a result. Defaults to a link to its URL, clicked. */\n onDownload?: (download: ActionDownload) => void;\n /** Handlers of `client` actions by their `component`, over those of the plugins. */\n clientActions?: Readonly<Record<string, ClientActionHandler>>;\n /** Milliseconds between two checks of a queued run. Defaults to 2000. */\n pollInterval?: number;\n /** Locales of localized parameters. Defaults to the definition's. */\n locales?: readonly string[];\n}\n\ninterface Pending {\n resource: string;\n target: ActionTarget;\n resolve: (outcome: ActionOutcome | false) => void;\n}\n\ninterface ClientPending extends Pending {\n Handler: ClientActionHandler;\n}\n\nfunction navigateTo(to: string | RouteReference) {\n if (typeof to === 'string') {\n window.location.assign(to);\n } else {\n console.warn(\n `[panneau] An action goes to the route \"${to.route}\": give ActionRunnerProvider an onNavigate.`,\n );\n }\n}\n\nfunction openDownload(download: ActionDownload) {\n const link = document.createElement('a');\n link.href = download.url;\n if (download.filename !== undefined) {\n link.download = download.filename;\n }\n link.rel = 'noopener';\n link.hidden = true;\n document.body.append(link);\n link.click();\n link.remove();\n}\n\n/**\n * Runs the actions that lists and forms hand over ([decision 0023]): it asks for their parameters\n * in a dialog, runs them through the adapter, shows their result (a toast, and the items that\n * didn't succeed), follows queued runs until they end, refreshes through `onResult`, follows\n * redirects and opens downloads. Put it inside `PanneauRoot`, and above the router of an app, so\n * that runs are followed from page to page. `useActionRunner(resource)` runs an action.\n */\nexport function ActionRunnerProvider({\n adapter,\n children,\n onResult,\n onNavigate = navigateTo,\n onDownload = openDownload,\n onShowItems,\n clientActions,\n pollInterval = 2000,\n locales,\n}: ActionRunnerProviderProps) {\n const intl = usePanneauIntl();\n const toasts = useToast();\n const { definition, plugins } = usePanneau();\n const [parameters, setParameters] = useState<Pending | null>(null);\n const [client, setClient] = useState<ClientPending | null>(null);\n const [details, setDetails] = useState<{ label: string; result: ActionResult } | null>(null);\n const [runs, setRuns] = useState<readonly FollowedRun[]>([]);\n // Runs whose end was already shown, so that a late poll doesn't show it twice.\n const notified = useRef(new Set<string>());\n // How many lists of runs are on screen (the popover of the runs): their user sees a run end.\n const watchers = useRef(0);\n\n /** What the action applied to, by the item's title or the count of items. */\n const subjectOf = (resource: string, target: ActionTarget, count: number | null = null) =>\n describeSubject(\n target,\n definition?.resources.find((candidate) => candidate.id === resource),\n intl,\n count,\n );\n\n /** The title of the item of an `item` action, to name it. */\n const itemTitleOf = (resource: string, target: ActionTarget) => {\n if (target.item === undefined) {\n return null;\n }\n const itemTitle = definition?.resources.find(\n (candidate) => candidate.id === resource,\n )?.itemTitle;\n return getItemTitle(target.item, itemTitle, intl.locale);\n };\n\n /** One toast per action and target: running it again replaces it. */\n const toastKey = (resource: string, target: ActionTarget) =>\n `panneau-action:${resource}:${target.action.id}:${target.item?.id ?? 'selection'}`;\n\n const finish = async (\n resource: string,\n target: ActionTarget,\n result: ActionResult,\n { queued = false }: { queued?: boolean } = {},\n ) => {\n await onResult?.(result, { resource, target });\n const counts = getResultCounts(result);\n const itemTitle = itemTitleOf(resource, target);\n const content = describeResult(\n result,\n getActionLabel(target.action, intl),\n intl,\n subjectOf(resource, target, counts.succeeded),\n itemTitle,\n );\n const entries = result.results ?? [];\n // The toast already names an item that is in use: its details would only repeat it.\n const hasDetails =\n entries.length > 0 &&\n !(\n entries.length === 1 &&\n entries[0] !== undefined &&\n isInUse(entries[0]) &&\n itemTitle !== null\n );\n const download = result.download ?? null;\n if (download !== null) {\n onDownload(download);\n }\n const redirect = result.redirect ?? null;\n // A queued run that ends in the open list of runs is seen there, unless its result says\n // more than its status: a message, items that didn't succeed, a download.\n const saysMore = (result.message ?? '') !== '' || hasDetails || download !== null;\n if (queued && watchers.current > 0 && !saysMore) {\n if (redirect !== null) {\n onNavigate(redirect);\n }\n return;\n }\n // \"Undo\" lives in the toast only (decision 0063): a queued run, which finished later, isn't\n // undone.\n const undo = !queued ? (result.undo ?? null) : null;\n // \"Show\" comes after what says more, and not when the run goes somewhere else.\n const changed =\n onShowItems !== undefined && redirect === null ? getChangedItems(target, result) : null;\n toasts.show(\n {\n ...content,\n ...(undo !== null\n ? {\n action: {\n label: intl.formatMessage(messages.undo),\n onAction: () => void runUndo(resource, target, undo),\n },\n }\n : hasDetails\n ? {\n action: {\n label: intl.formatMessage(messages.details),\n onAction: () =>\n setDetails({\n label: getActionLabel(target.action, intl),\n result,\n }),\n },\n }\n : download !== null\n ? {\n action: {\n label: intl.formatMessage(messages.download),\n onAction: () => onDownload(download),\n },\n }\n : changed !== null\n ? {\n action: {\n label: intl.formatMessage(messages.showChanged),\n onAction: () => onShowItems?.(resource, changed),\n },\n }\n : {}),\n },\n { key: toastKey(resource, target) },\n );\n if (redirect !== null) {\n onNavigate(redirect);\n }\n };\n\n /**\n * Runs the undo of a result: an action of the same resource, on the items it lists, as any\n * action. A short toast then says it was undone, in place of the first one.\n */\n const runUndo = async (\n resource: string,\n target: ActionTarget,\n undo: NonNullable<ActionResult['undo']>,\n ) => {\n const label = getActionLabel(target.action, intl);\n const key = { key: toastKey(resource, target) };\n const declared = definition?.resources\n .find((candidate) => candidate.id === resource)\n ?.actions?.find((action) => action.id === undo.action);\n const undoTarget: ActionTarget = {\n action: declared ?? { id: undo.action, kind: 'server', scope: ['selection'] },\n scope: 'selection',\n selection: { ids: undo.items },\n count: undo.items.length,\n };\n await adapter\n .runAction(resource, undo.action, {\n selection: { ids: undo.items },\n values: undo.params ?? {},\n })\n .then(async (response) => {\n if (response.run !== undefined) {\n follow(resource, undoTarget, response.run);\n return;\n }\n await onResult?.(response.result, { resource, target: undoTarget });\n const subject = subjectOf(resource, target, undo.items.length);\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.undoneFor, {\n action: label,\n subject,\n })\n : intl.formatMessage(messages.undone, { action: label }),\n },\n key,\n );\n })\n .catch((error: unknown) => {\n toasts.show(\n {\n title: intl.formatMessage(messages.undoFailed, { action: label }),\n ...(error instanceof Error && error.message !== ''\n ? { description: error.message }\n : {}),\n tone: 'danger',\n },\n key,\n );\n });\n };\n\n // No toast when a run starts: the runs button of the shell shows it, and its popover follows\n // it. The toast comes when the run ends.\n const follow = (resource: string, target: ActionTarget, run: ActionRun) => {\n setRuns((current) => [\n ...current.filter((entry) => entry.run.id !== run.id),\n { run, resource, target },\n ]);\n };\n\n const ended = async (entry: FollowedRun) => {\n const { run, resource, target } = entry;\n if (notified.current.has(run.id)) {\n return;\n }\n notified.current.add(run.id);\n if (run.result !== undefined) {\n await finish(resource, target, run.result, { queued: true });\n return;\n }\n const action = getActionLabel(target.action, intl);\n const subject = subjectOf(resource, target);\n const key = { key: toastKey(resource, target) };\n if (run.status === 'cancelled') {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.cancelledFor, { action, subject })\n : intl.formatMessage(messages.cancelled, { action }),\n },\n key,\n );\n } else if (run.status === 'failed') {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.failedFor, { action, subject })\n : intl.formatMessage(messages.failed, { action }),\n tone: 'danger',\n },\n key,\n );\n } else if (watchers.current === 0) {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.doneFor, { action, subject })\n : intl.formatMessage(messages.done, { action }),\n tone: 'success',\n },\n key,\n );\n }\n };\n\n const execute = async (\n resource: string,\n target: ActionTarget,\n values: Record<string, unknown> = {},\n ): Promise<ActionOutcome> => {\n const response = await adapter.runAction(\n resource,\n target.action.id,\n buildActionRequest(target, values),\n );\n if (response.run !== undefined) {\n follow(resource, target, response.run);\n return { status: 'queued', run: response.run };\n }\n await finish(resource, target, response.result);\n return { status: 'done', result: response.result };\n };\n\n const run = (resource: string, target: ActionTarget): Promise<ActionOutcome | false> => {\n const { action } = target;\n if (action.kind === 'link') {\n const to = getLinkTarget(target);\n if (to === null) {\n return Promise.reject(new Error(`The action \"${action.id}\" has no URL or route.`));\n }\n onNavigate(to);\n return Promise.resolve({ status: 'navigated', to });\n }\n if (action.kind === 'client') {\n const name = action.component ?? '';\n const Handler =\n (clientActions !== undefined && Object.hasOwn(clientActions, name)\n ? clientActions[name]\n : undefined) ?? (plugins.actions.get(name) as ClientActionHandler | undefined);\n if (Handler === undefined) {\n return Promise.reject(\n new Error(`No handler for the client action \"${action.id}\" (${name}).`),\n );\n }\n return new Promise((resolve) => setClient({ resource, target, resolve, Handler }));\n }\n if ((action.fields ?? []).length > 0) {\n return new Promise((resolve) => setParameters({ resource, target, resolve }));\n }\n return execute(resource, target);\n };\n\n const cancelRun = async (id: string) => {\n if (adapter.cancelActionRun === undefined) {\n throw new Error('The adapter cannot cancel runs.');\n }\n await adapter.cancelActionRun(id);\n const updated = await adapter.getActionRun(id);\n setRuns((current) =>\n current.map((entry) => (entry.run.id === id ? { ...entry, run: updated } : entry)),\n );\n const entry = runs.find((candidate) => candidate.run.id === id);\n if (entry !== undefined && isFinished(updated.status)) {\n await ended({ ...entry, run: updated });\n }\n };\n\n const dismissRun = (id: string) =>\n setRuns((current) => current.filter((entry) => entry.run.id !== id));\n\n const onRunEnded = useEffectEvent((entry: FollowedRun) => ended(entry));\n\n // Checks the unfinished runs, one interval after the last change of the runs.\n useEffect(() => {\n const active = runs.filter((entry) => !isFinished(entry.run.status));\n if (active.length === 0) {\n return undefined;\n }\n let stopped = false;\n const timer = setTimeout(() => {\n void Promise.all(\n active.map(async (entry) => {\n try {\n const next = await adapter.getActionRun(entry.run.id);\n if (stopped) {\n return;\n }\n setRuns((current) =>\n current.map((candidate) =>\n candidate.run.id === next.id\n ? { ...candidate, run: next }\n : candidate,\n ),\n );\n if (isFinished(next.status)) {\n await onRunEnded({ ...entry, run: next });\n }\n } catch {\n // Checked again at the next interval.\n if (!stopped) {\n setRuns((current) => [...current]);\n }\n }\n }),\n );\n }, pollInterval);\n return () => {\n stopped = true;\n clearTimeout(timer);\n };\n }, [runs, adapter, pollInterval]);\n\n const watchRuns = () => {\n watchers.current += 1;\n return () => {\n watchers.current -= 1;\n };\n };\n\n const value: ActionRunnerContextValue = {\n adapter,\n run,\n runs,\n cancelRun,\n dismissRun,\n watchRuns,\n };\n\n const ClientHandler = client?.Handler;\n return (\n <ActionRunnerContext value={value}>\n {children}\n {parameters !== null ? (\n <ParametersDialog\n action={parameters.target.action}\n count={parameters.target.count}\n locales={locales}\n onSubmit={(values) => execute(parameters.resource, parameters.target, values)}\n onDone={(outcome) => {\n setParameters(null);\n parameters.resolve(outcome);\n }}\n onCancel={() => {\n setParameters(null);\n parameters.resolve(false);\n }}\n />\n ) : null}\n {client !== null && ClientHandler !== undefined ? (\n <ClientHandler\n action={client.target.action}\n resource={client.resource}\n target={client.target}\n onDone={(result) => {\n setClient(null);\n if (result === undefined) {\n client.resolve({ status: 'done', result: {} });\n return;\n }\n void finish(client.resource, client.target, result).then(() =>\n client.resolve({ status: 'done', result }),\n );\n }}\n onCancel={() => {\n setClient(null);\n client.resolve(false);\n }}\n />\n ) : null}\n {details !== null ? (\n <ResultsDialog\n label={details.label}\n result={details.result}\n onClose={() => setDetails(null)}\n />\n ) : null}\n </ActionRunnerContext>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAsEA,SAASyD,WAAWjB,IAA6B;CAC7C,IAAI,OAAOA,OAAO,UACdkB,OAAOC,SAASC,OAAOpB,EAAE;MAEzBqB,QAAQC,KACJ,0CAA0CtB,GAAGuB,MAAK,4CACtD;AAER;AAEA,SAASC,aAAanB,UAA0B;CAC5C,MAAMoB,OAAOC,SAASC,cAAc,GAAG;CACvCF,KAAKG,OAAOvB,SAASwB;CACrB,IAAIxB,SAASyB,aAAaC,KAAAA,GACtBN,KAAKpB,WAAWA,SAASyB;CAE7BL,KAAKO,MAAM;CACXP,KAAKQ,SAAS;CACdP,SAASQ,KAAKC,OAAOV,IAAI;CACzBA,KAAKW,MAAM;CACXX,KAAKY,OAAO;AAChB;;;;;;;;AASA,SAAOC,qBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAA8B,MAAA,EAAA/C,SAAAC,UAAAC,UAAAG,YAAA2C,IAAAtC,YAAAuC,IAAA1C,aAAAK,eAAAG,cAAAmC,IAAAlC,YAAA6B;CAIjC,MAAAxC,aAAA2C,OAAAX,KAAAA,IAAAd,aAAAyB;CACA,MAAAtC,aAAAuC,OAAAZ,KAAAA,IAAAP,eAAAmB;CAGA,MAAAlC,eAAAmC,OAAAb,KAAAA,IAAA,MAAAa;CAGA,MAAAC,OAAa3E,eAAe;CAC5B,MAAA4E,SAAe3E,SAAS;CACxB,MAAA,EAAA4E,YAAAC,YAAgCnF,WAAW;CAC3C,MAAA,CAAAoF,YAAAC,iBAAoCtF,SAAyB,IAAI;CACjE,MAAA,CAAAuF,QAAAC,aAA4Bx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,EAAA,MAAAa;EAAAb,EAAA,MAAAiL;CAAA,OAAAA,MAAAjL,EAAA;CAAA,IAAAkL;CAAA,IAAAlL,EAAA,QAAA7C,YAAA6C,EAAA,QAAA6K,OAAA7K,EAAA,QAAA+K,OAAA/K,EAAA,QAAAiL,OAAAjL,EAAA,QAAA2K,OAAA;EA7CZO,MAAA,qBAAC,qBAAD;GAA4BP;GAA5B,UAAA;IACKxN;IACA0N;IAgBAE;IAqBAE;GAvCe;;EA8CEjL,EAAA,MAAA7C;EAAA6C,EAAA,MAAA6K;EAAA7K,EAAA,MAAA+K;EAAA/K,EAAA,MAAAiL;EAAAjL,EAAA,MAAA2K;EAAA3K,EAAA,MAAAkL;CAAA,OAAAA,MAAAlL,EAAA;CAAA,OA9CtBkL;AA8CsB;AAxavB,SAAAb,OAAAc,WAAA;CAAA,OA4V0C,CAAA,GAAIvH,SAAO;AAAC;AA5VtD,SAAAgG,OAAAwB,SAAA;CAAA,OAkUuC,CAAC3O,WAAW2J,QAAKd,IAAIwB,MAAO;AAAC;AAlUpE,SAAAtE,MAAA6I,YAAAC,UAAA;CAAA,OA6CC,kBAAkB5N,WAAQ,GAAIU,SAAM+E,OAAOrB,GAAG,GAAI1D,SAAM8D,MAASJ,MAAf;AAAgC"}
|
package/dist/describe.d.ts
CHANGED
|
@@ -27,4 +27,13 @@ export declare function describeResult(result: ActionResult, actionLabel: string
|
|
|
27
27
|
* `in_use`).
|
|
28
28
|
*/
|
|
29
29
|
export declare function describeItemResult(entry: ActionItemResult, intl: IntlShape): string;
|
|
30
|
+
/**
|
|
31
|
+
* The items a run changed, for "Show" in its toast (decision 0069): those of a selection by ids,
|
|
32
|
+
* without those its `results` list (they failed or were skipped), or the `items` of its `undo`.
|
|
33
|
+
* `null` for an item action, whose toast names the item, for a `delete`, whose items are gone, for
|
|
34
|
+
* a query selection without `undo`,
|
|
35
|
+
* whose items the client doesn't know, and when the run changed none or more than
|
|
36
|
+
* `IDS_FILTER_LIMIT`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getChangedItems(target: ActionTarget, result: ActionResult): string[] | null;
|
|
30
39
|
//# sourceMappingURL=describe.d.ts.map
|
package/dist/describe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../src/describe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../src/describe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAExF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;GAGG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,EAC/B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,MAAM,GACf,MAAM,GAAG,IAAI,CAWf;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC3B,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,WAAW,CAAC,GAAG,SAAS,EAC3D,IAAI,EAAE,SAAS,EACf,KAAK,GAAE,MAAM,GAAG,IAAW,GAC5B,MAAM,GAAG,IAAI,CAoBf;AAED,yFAAyF;AACzF,wBAAgB,OAAO,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAExD;AAeD;;;;GAIG;AACH,wBAAgB,cAAc,CAC1B,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,SAAS,EACf,OAAO,GAAE,MAAM,GAAG,IAAW,EAC7B,SAAS,GAAE,MAAM,GAAG,IAAW,GAChC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAiC9B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM,CAkBnF;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,EAAE,GAAG,IAAI,CAc3F"}
|
package/dist/describe.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { messages } from "./messages.js";
|
|
2
2
|
import { getResultCounts } from "./request.js";
|
|
3
|
+
import { IDS_FILTER_LIMIT } from "@panneau/protocol/runtime";
|
|
3
4
|
//#region src/describe.ts
|
|
4
5
|
/**
|
|
5
6
|
* The title of an item: the value of the resource's `itemTitle` field, in the locale when it is
|
|
@@ -88,7 +89,26 @@ function describeItemResult(entry, intl) {
|
|
|
88
89
|
default: return intl.formatMessage(entry.status === "failed" ? messages.statusFailed : messages.statusSkipped);
|
|
89
90
|
}
|
|
90
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* The items a run changed, for "Show" in its toast (decision 0069): those of a selection by ids,
|
|
94
|
+
* without those its `results` list (they failed or were skipped), or the `items` of its `undo`.
|
|
95
|
+
* `null` for an item action, whose toast names the item, for a `delete`, whose items are gone, for
|
|
96
|
+
* a query selection without `undo`,
|
|
97
|
+
* whose items the client doesn't know, and when the run changed none or more than
|
|
98
|
+
* `IDS_FILTER_LIMIT`.
|
|
99
|
+
*/
|
|
100
|
+
function getChangedItems(target, result) {
|
|
101
|
+
if (target.scope === "item" || target.action.id === "delete") return null;
|
|
102
|
+
const selection = target.selection;
|
|
103
|
+
let ids = null;
|
|
104
|
+
if (result.undo !== void 0) ids = [...result.undo.items];
|
|
105
|
+
else if (selection !== void 0 && "ids" in selection) {
|
|
106
|
+
const left = new Set((result.results ?? []).map((entry) => entry.id));
|
|
107
|
+
ids = selection.ids.filter((id) => !left.has(id));
|
|
108
|
+
}
|
|
109
|
+
return ids !== null && ids.length > 0 && ids.length <= IDS_FILTER_LIMIT ? ids : null;
|
|
110
|
+
}
|
|
91
111
|
//#endregion
|
|
92
|
-
export { describeItemResult, describeResult, describeSubject, getItemTitle, isInUse };
|
|
112
|
+
export { describeItemResult, describeResult, describeSubject, getChangedItems, getItemTitle, isInUse };
|
|
93
113
|
|
|
94
114
|
//# sourceMappingURL=describe.js.map
|
package/dist/describe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","names":["IntlShape","ActionItemResult","ActionResult","Item","Resource","ToastContent","messages","getResultCounts","ActionTarget","getItemTitle","item","Partial","itemTitle","locale","value","undefined","localized","Record","first","Object","values","describeSubject","target","resource","Pick","intl","count","scope","title","formatMessage","subjectItem","total","subjectCount","singular","label","plural","isInUse","entry","status","reason","describeInUse","inUseItem","inUseCount","describeResult","result","actionLabel","subject","Omit","succeeded","failed","skipped","inUse","Math","min","results","filter","length","inUseText","tone","parts","succeededCount","failedCount","skippedCount","description","formatList","type","join","message","doneFor","action","done","describeItemResult","reasonForbidden","reasonNotFound","reasonUnchanged","reasonInUse","statusFailed","statusSkipped"],"sources":["../src/describe.ts"],"sourcesContent":["import type { IntlShape } from 'react-intl';\n\nimport type { ActionItemResult, ActionResult, Item, Resource } from '@panneau/protocol';\nimport type { ToastContent } from '@panneau/ui';\n\nimport { messages } from './messages';\nimport { getResultCounts } from './request';\nimport type { ActionTarget } from './types';\n\n/**\n * The title of an item: the value of the resource's `itemTitle` field, in the locale when it is\n * localized. `null` without one.\n */\nexport function getItemTitle(\n item: Partial<Item> | undefined,\n itemTitle: string | undefined,\n locale: string,\n): string | null {\n const value = itemTitle !== undefined ? item?.[itemTitle] : undefined;\n if (typeof value === 'string') {\n return value;\n }\n if (value !== null && typeof value === 'object') {\n const localized = (value as Record<string, unknown>)[locale];\n const first = localized ?? Object.values(value)[0];\n return typeof first === 'string' ? first : null;\n }\n return null;\n}\n\n/**\n * What an action applied to, for its toast: the item by its title (\"“Spring contest”\"), or the\n * count of items with the resource's labels (\"3 entries\"). `null` when there is nothing to name:\n * an item without a title, a selection without a count, or a resource the definition doesn't\n * have.\n */\nexport function describeSubject(\n target: ActionTarget,\n resource: Pick<Resource, 'label' | 'itemTitle'> | undefined,\n intl: IntlShape,\n count: number | null = null,\n): string | null {\n if (target.scope === 'item' || target.item !== undefined) {\n const title = getItemTitle(\n target.item as Partial<Item> | undefined,\n resource?.itemTitle,\n intl.locale,\n );\n return title !== null && title !== ''\n ? intl.formatMessage(messages.subjectItem, { title })\n : null;\n }\n const total = count ?? target.count ?? null;\n if (resource === undefined || total === null) {\n return null;\n }\n return intl.formatMessage(messages.subjectCount, {\n count: total,\n singular: resource.label.singular,\n plural: resource.label.plural,\n });\n}\n\n/** Whether an item of a result was skipped because something else uses it (`in_use`). */\nexport function isInUse(entry: ActionItemResult): boolean {\n return entry.status === 'skipped' && entry.reason === 'in_use';\n}\n\n/**\n * What the toast says of the items skipped as `in_use`: the item by its title when it is the only\n * one and `itemTitle` is known, or their count. `null` when there are none.\n */\nfunction describeInUse(count: number, intl: IntlShape, itemTitle: string | null): string | null {\n if (count === 0) {\n return null;\n }\n return count === 1 && itemTitle !== null && itemTitle !== ''\n ? intl.formatMessage(messages.inUseItem, { title: itemTitle })\n : intl.formatMessage(messages.inUseCount, { count });\n}\n\n/**\n * The toast of a result: its message, or \"done\" with what it was done to (`subject`), the counts,\n * and a tone that says how it went. Items skipped as `in_use` are explained, by the title of the\n * item (`itemTitle`) when it is the only one: when every item is, that is the title of the toast.\n */\nexport function describeResult(\n result: ActionResult,\n actionLabel: string,\n intl: IntlShape,\n subject: string | null = null,\n itemTitle: string | null = null,\n): Omit<ToastContent, 'action'> {\n const { succeeded, failed, skipped } = getResultCounts(result);\n const inUse = Math.min(skipped, (result.results ?? []).filter(isInUse).length);\n const inUseText = describeInUse(inUse, intl, itemTitle);\n if (inUseText !== null && (succeeded ?? 0) === 0 && failed === 0 && skipped === inUse) {\n // Nothing was done: the toast says why.\n return { title: inUseText, tone: 'warning' };\n }\n const parts = [\n ...(succeeded !== null && (failed > 0 || skipped > 0)\n ? [intl.formatMessage(messages.succeededCount, { count: succeeded })]\n : []),\n ...(failed > 0 ? [intl.formatMessage(messages.failedCount, { count: failed })] : []),\n ...(skipped > inUse\n ? [intl.formatMessage(messages.skippedCount, { count: skipped - inUse })]\n : []),\n ];\n const description = [\n ...(parts.length > 0 ? [intl.formatList(parts, { type: 'unit' })] : []),\n ...(inUseText !== null ? [inUseText] : []),\n ].join('. ');\n const tone: ToastContent['tone'] =\n failed > 0 ? (succeeded === 0 ? 'danger' : 'warning') : skipped > 0 ? 'warning' : 'success';\n return {\n title:\n result.message !== undefined && result.message !== ''\n ? result.message\n : subject !== null\n ? intl.formatMessage(messages.doneFor, { action: actionLabel, subject })\n : intl.formatMessage(messages.done, { action: actionLabel }),\n ...(description !== '' ? { description } : {}),\n tone,\n };\n}\n\n/**\n * Why an item didn't succeed: its message, or its reason (`forbidden`, `not_found`, `unchanged`,\n * `in_use`).\n */\nexport function describeItemResult(entry: ActionItemResult, intl: IntlShape): string {\n if (entry.message !== undefined && entry.message !== '') {\n return entry.message;\n }\n switch (entry.reason) {\n case 'forbidden':\n return intl.formatMessage(messages.reasonForbidden);\n case 'not_found':\n return intl.formatMessage(messages.reasonNotFound);\n case 'unchanged':\n return intl.formatMessage(messages.reasonUnchanged);\n case 'in_use':\n return intl.formatMessage(messages.reasonInUse);\n default:\n return intl.formatMessage(\n entry.status === 'failed' ? messages.statusFailed : messages.statusSkipped,\n );\n }\n}\n"],"mappings":";;;;;;;AAaA,SAAgBS,aACZC,MACAE,WACAC,QACa;CACb,MAAMC,QAAQF,cAAcG,KA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AI,CAAC;EAC5CL;CACJ;AACJ;;;;;AAMA,SAAgBa,mBAAmBlC,OAAyBZ,MAAyB;CACjF,IAAIY,MAAM8B,YAAYpD,KAAAA,KAAasB,MAAM8B,YAAY,IACjD,OAAO9B,MAAM8B;CAEjB,QAAQ9B,MAAME,QAAd;EACI,KAAK,aACD,OAAOd,KAAKI,cAAcvB,SAASkE,eAAe;EACtD,KAAK,aACD,OAAO/C,KAAKI,cAAcvB,SAASmE,cAAc;EACrD,KAAK,aACD,OAAOhD,KAAKI,cAAcvB,SAASoE,eAAe;EACtD,KAAK,UACD,OAAOjD,KAAKI,cAAcvB,SAASqE,WAAW;EAClD,SACI,OAAOlD,KAAKI,cACRQ,MAAMC,WAAW,WAAWhC,SAASsE,eAAetE,SAASuE,aACjE;CACR;AACJ"}
|
|
1
|
+
{"version":3,"file":"describe.js","names":["IntlShape","ActionItemResult","ActionResult","Item","Resource","IDS_FILTER_LIMIT","ToastContent","messages","getResultCounts","ActionTarget","getItemTitle","item","Partial","itemTitle","locale","value","undefined","localized","Record","first","Object","values","describeSubject","target","resource","Pick","intl","count","scope","title","formatMessage","subjectItem","total","subjectCount","singular","label","plural","isInUse","entry","status","reason","describeInUse","inUseItem","inUseCount","describeResult","result","actionLabel","subject","Omit","succeeded","failed","skipped","inUse","Math","min","results","filter","length","inUseText","tone","parts","succeededCount","failedCount","skippedCount","description","formatList","type","join","message","doneFor","action","done","describeItemResult","reasonForbidden","reasonNotFound","reasonUnchanged","reasonInUse","statusFailed","statusSkipped","getChangedItems","id","selection","ids","undo","items","left","Set","map","has"],"sources":["../src/describe.ts"],"sourcesContent":["import type { IntlShape } from 'react-intl';\n\nimport type { ActionItemResult, ActionResult, Item, Resource } from '@panneau/protocol';\nimport { IDS_FILTER_LIMIT } from '@panneau/protocol/runtime';\nimport type { ToastContent } from '@panneau/ui';\n\nimport { messages } from './messages';\nimport { getResultCounts } from './request';\nimport type { ActionTarget } from './types';\n\n/**\n * The title of an item: the value of the resource's `itemTitle` field, in the locale when it is\n * localized. `null` without one.\n */\nexport function getItemTitle(\n item: Partial<Item> | undefined,\n itemTitle: string | undefined,\n locale: string,\n): string | null {\n const value = itemTitle !== undefined ? item?.[itemTitle] : undefined;\n if (typeof value === 'string') {\n return value;\n }\n if (value !== null && typeof value === 'object') {\n const localized = (value as Record<string, unknown>)[locale];\n const first = localized ?? Object.values(value)[0];\n return typeof first === 'string' ? first : null;\n }\n return null;\n}\n\n/**\n * What an action applied to, for its toast: the item by its title (\"“Spring contest”\"), or the\n * count of items with the resource's labels (\"3 entries\"). `null` when there is nothing to name:\n * an item without a title, a selection without a count, or a resource the definition doesn't\n * have.\n */\nexport function describeSubject(\n target: ActionTarget,\n resource: Pick<Resource, 'label' | 'itemTitle'> | undefined,\n intl: IntlShape,\n count: number | null = null,\n): string | null {\n if (target.scope === 'item' || target.item !== undefined) {\n const title = getItemTitle(\n target.item as Partial<Item> | undefined,\n resource?.itemTitle,\n intl.locale,\n );\n return title !== null && title !== ''\n ? intl.formatMessage(messages.subjectItem, { title })\n : null;\n }\n const total = count ?? target.count ?? null;\n if (resource === undefined || total === null) {\n return null;\n }\n return intl.formatMessage(messages.subjectCount, {\n count: total,\n singular: resource.label.singular,\n plural: resource.label.plural,\n });\n}\n\n/** Whether an item of a result was skipped because something else uses it (`in_use`). */\nexport function isInUse(entry: ActionItemResult): boolean {\n return entry.status === 'skipped' && entry.reason === 'in_use';\n}\n\n/**\n * What the toast says of the items skipped as `in_use`: the item by its title when it is the only\n * one and `itemTitle` is known, or their count. `null` when there are none.\n */\nfunction describeInUse(count: number, intl: IntlShape, itemTitle: string | null): string | null {\n if (count === 0) {\n return null;\n }\n return count === 1 && itemTitle !== null && itemTitle !== ''\n ? intl.formatMessage(messages.inUseItem, { title: itemTitle })\n : intl.formatMessage(messages.inUseCount, { count });\n}\n\n/**\n * The toast of a result: its message, or \"done\" with what it was done to (`subject`), the counts,\n * and a tone that says how it went. Items skipped as `in_use` are explained, by the title of the\n * item (`itemTitle`) when it is the only one: when every item is, that is the title of the toast.\n */\nexport function describeResult(\n result: ActionResult,\n actionLabel: string,\n intl: IntlShape,\n subject: string | null = null,\n itemTitle: string | null = null,\n): Omit<ToastContent, 'action'> {\n const { succeeded, failed, skipped } = getResultCounts(result);\n const inUse = Math.min(skipped, (result.results ?? []).filter(isInUse).length);\n const inUseText = describeInUse(inUse, intl, itemTitle);\n if (inUseText !== null && (succeeded ?? 0) === 0 && failed === 0 && skipped === inUse) {\n // Nothing was done: the toast says why.\n return { title: inUseText, tone: 'warning' };\n }\n const parts = [\n ...(succeeded !== null && (failed > 0 || skipped > 0)\n ? [intl.formatMessage(messages.succeededCount, { count: succeeded })]\n : []),\n ...(failed > 0 ? [intl.formatMessage(messages.failedCount, { count: failed })] : []),\n ...(skipped > inUse\n ? [intl.formatMessage(messages.skippedCount, { count: skipped - inUse })]\n : []),\n ];\n const description = [\n ...(parts.length > 0 ? [intl.formatList(parts, { type: 'unit' })] : []),\n ...(inUseText !== null ? [inUseText] : []),\n ].join('. ');\n const tone: ToastContent['tone'] =\n failed > 0 ? (succeeded === 0 ? 'danger' : 'warning') : skipped > 0 ? 'warning' : 'success';\n return {\n title:\n result.message !== undefined && result.message !== ''\n ? result.message\n : subject !== null\n ? intl.formatMessage(messages.doneFor, { action: actionLabel, subject })\n : intl.formatMessage(messages.done, { action: actionLabel }),\n ...(description !== '' ? { description } : {}),\n tone,\n };\n}\n\n/**\n * Why an item didn't succeed: its message, or its reason (`forbidden`, `not_found`, `unchanged`,\n * `in_use`).\n */\nexport function describeItemResult(entry: ActionItemResult, intl: IntlShape): string {\n if (entry.message !== undefined && entry.message !== '') {\n return entry.message;\n }\n switch (entry.reason) {\n case 'forbidden':\n return intl.formatMessage(messages.reasonForbidden);\n case 'not_found':\n return intl.formatMessage(messages.reasonNotFound);\n case 'unchanged':\n return intl.formatMessage(messages.reasonUnchanged);\n case 'in_use':\n return intl.formatMessage(messages.reasonInUse);\n default:\n return intl.formatMessage(\n entry.status === 'failed' ? messages.statusFailed : messages.statusSkipped,\n );\n }\n}\n\n/**\n * The items a run changed, for \"Show\" in its toast (decision 0069): those of a selection by ids,\n * without those its `results` list (they failed or were skipped), or the `items` of its `undo`.\n * `null` for an item action, whose toast names the item, for a `delete`, whose items are gone, for\n * a query selection without `undo`,\n * whose items the client doesn't know, and when the run changed none or more than\n * `IDS_FILTER_LIMIT`.\n */\nexport function getChangedItems(target: ActionTarget, result: ActionResult): string[] | null {\n // A deleted item isn't in its list any more: its \"Undo\" brings it back, when there is one.\n if (target.scope === 'item' || target.action.id === 'delete') {\n return null;\n }\n const selection = target.selection;\n let ids: string[] | null = null;\n if (result.undo !== undefined) {\n ids = [...result.undo.items];\n } else if (selection !== undefined && 'ids' in selection) {\n const left = new Set((result.results ?? []).map((entry) => entry.id));\n ids = (selection.ids as string[]).filter((id) => !left.has(id));\n }\n return ids !== null && ids.length > 0 && ids.length <= IDS_FILTER_LIMIT ? ids : null;\n}\n"],"mappings":";;;;;;;;AAcA,SAAgBU,aACZC,MACAE,WACAC,QACa;CACb,MAAMC,QAAQF,cAAcG,KAAAA,IAAYL,OAAOE,aAAaG,KAAAA;CAC5D,IAAI,OAAOD,UAAU,UACjB,OAAOA;CAEX,IAAIA,UAAU,QAAQ,OAAOA,UAAU,UAAU;EAE7C,MAAMI,QADaJ,MAAkCD,WAC1BM,OAAOC,OAAON,KAAK,CAAC,CAAC;EAChD,OAAO,OAAOI,UAAU,WAAWA,QAAQ;CAC/C;CACA,OAAO;AACX;;;;;;;AAQA,SAAgBG,gBACZC,QACAC,UACAE,MACAC,QAAuB,MACV;CACb,IAAIJ,OAAOK,UAAU,UAAUL,OAAOZ,SAASK,KAAAA,GAAW;EACtD,MAAMa,QAAQnB,aACVa,OAAOZ,MACPa,UAAUX,WACVa,KAAKZ,MACT;EACA,OAAOe,UAAU,QAAQA,UAAU,KAC7BH,KAAKI,cAAcvB,SAASwB,aAAa,EAAEF,MAAM,CAAC,IAClD;CACV;CACA,MAAMG,QAA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IAAItB,OAAOK,UAAU,UAAUL,OAAO+C,OAAOU,OAAO,UAChD,OAAO;CAEX,MAAMC,YAAY1D,OAAO0D;CACzB,IAAIC,MAAuB;CAC3B,IAAIrC,OAAOsC,SAASnE,KAAAA,GAChBkE,MAAM,CAAC,GAAGrC,OAAOsC,KAAKC,KAAK;MACxB,IAAIH,cAAcjE,KAAAA,KAAa,SAASiE,WAAW;EACtD,MAAMI,OAAO,IAAIC,KAAKzC,OAAOU,WAAW,CAAA,EAAA,CAAIgC,KAAKjD,UAAUA,MAAM0C,EAAE,CAAC;EACpEE,MAAOD,UAAUC,IAAiB1B,QAAQwB,OAAO,CAACK,KAAKG,IAAIR,EAAE,CAAC;CAClE;CACA,OAAOE,QAAQ,QAAQA,IAAIzB,SAAS,KAAKyB,IAAIzB,UAAUpD,mBAAmB6E,MAAM;AACpF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/actions",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.27",
|
|
4
4
|
"description": "Runs the actions of lists and forms: parameters in a dialog, the action through a data adapter, its result, and queued runs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
"react-intl": "^12.0.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@panneau/core": "5.0.0-alpha.
|
|
41
|
-
"@panneau/data": "5.0.0-alpha.
|
|
42
|
-
"@panneau/forms": "5.0.0-alpha.
|
|
43
|
-
"@panneau/intl": "5.0.0-alpha.
|
|
44
|
-
"@panneau/protocol": "5.0.0-alpha.
|
|
45
|
-
"@panneau/ui": "5.0.0-alpha.
|
|
40
|
+
"@panneau/core": "5.0.0-alpha.27",
|
|
41
|
+
"@panneau/data": "5.0.0-alpha.27",
|
|
42
|
+
"@panneau/forms": "5.0.0-alpha.27",
|
|
43
|
+
"@panneau/intl": "5.0.0-alpha.27",
|
|
44
|
+
"@panneau/protocol": "5.0.0-alpha.27",
|
|
45
|
+
"@panneau/ui": "5.0.0-alpha.27",
|
|
46
46
|
"lucide-react": "^1.57.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@panneau/lists": "5.0.0-alpha.
|
|
49
|
+
"@panneau/lists": "5.0.0-alpha.27"
|
|
50
50
|
}
|
|
51
51
|
}
|