@appcorp/fusion-storybook 0.4.40 → 0.4.43
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/base-modules/bulk-operations/context.d.ts +6 -0
- package/base-modules/bulk-operations/context.js +1 -0
- package/base-modules/bulk-operations/page.d.ts +1 -0
- package/base-modules/bulk-operations/page.js +19 -7
- package/base-modules/bulk-operations/view.js +4 -3
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/bulk-operations.d.ts +2 -0
|
@@ -32,6 +32,7 @@ export declare const BULK_OPERATIONS_ACTION_TYPES: {
|
|
|
32
32
|
results: BulkJobRecord["results"];
|
|
33
33
|
status: string;
|
|
34
34
|
total: number;
|
|
35
|
+
ttlSeconds: number | null;
|
|
35
36
|
type: string;
|
|
36
37
|
updatedAt: string;
|
|
37
38
|
webhookUrl: string | null;
|
|
@@ -53,6 +54,7 @@ export declare const BULK_OPERATIONS_ACTION_TYPES: {
|
|
|
53
54
|
results: BulkJobRecord["results"];
|
|
54
55
|
status: string;
|
|
55
56
|
total: number;
|
|
57
|
+
ttlSeconds: number | null;
|
|
56
58
|
type: string;
|
|
57
59
|
updatedAt: string;
|
|
58
60
|
webhookUrl: string | null;
|
|
@@ -76,6 +78,7 @@ export declare const BULK_OPERATIONS_ACTION_TYPES: {
|
|
|
76
78
|
results: BulkJobRecord["results"];
|
|
77
79
|
status: string;
|
|
78
80
|
total: number;
|
|
81
|
+
ttlSeconds: number | null;
|
|
79
82
|
type: string;
|
|
80
83
|
updatedAt: string;
|
|
81
84
|
webhookUrl: string | null;
|
|
@@ -97,6 +100,7 @@ export declare const BULK_OPERATIONS_ACTION_TYPES: {
|
|
|
97
100
|
results: BulkJobRecord["results"];
|
|
98
101
|
status: string;
|
|
99
102
|
total: number;
|
|
103
|
+
ttlSeconds: number | null;
|
|
100
104
|
type: string;
|
|
101
105
|
updatedAt: string;
|
|
102
106
|
webhookUrl: string | null;
|
|
@@ -118,6 +122,7 @@ export declare const BULK_OPERATIONS_ACTION_TYPES: {
|
|
|
118
122
|
results: BulkJobRecord["results"];
|
|
119
123
|
status: string;
|
|
120
124
|
total: number;
|
|
125
|
+
ttlSeconds: number | null;
|
|
121
126
|
type: string;
|
|
122
127
|
updatedAt: string;
|
|
123
128
|
webhookUrl: string | null;
|
|
@@ -162,6 +167,7 @@ export declare const useBulkOperationsModule: () => {
|
|
|
162
167
|
results: BulkJobRecord["results"];
|
|
163
168
|
status: string;
|
|
164
169
|
total: number;
|
|
170
|
+
ttlSeconds: number | null;
|
|
165
171
|
type: string;
|
|
166
172
|
updatedAt: string;
|
|
167
173
|
webhookUrl: string | null;
|
|
@@ -14,7 +14,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
14
14
|
import { useMemo } from "react";
|
|
15
15
|
import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
|
|
16
16
|
import { createGenericModulePage, } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
17
|
-
import {
|
|
17
|
+
import { formatSecs } from "@react-pakistan/util-functions/general/format-secs";
|
|
18
|
+
import { useBulkOperationsModule, BulkOperationsProvider, BULK_OPERATIONS_ACTION_TYPES, } from "./context";
|
|
18
19
|
import { BulkOperationsFilter } from "./filter";
|
|
19
20
|
import { BulkOperationsView } from "./view";
|
|
20
21
|
import { resolveRbacPermissions } from "../../utils/resolve-rbac-permissions";
|
|
@@ -35,6 +36,14 @@ const tableBodyCols = [
|
|
|
35
36
|
return `${(_a = job.processed) !== null && _a !== void 0 ? _a : 0} / ${(_b = job.total) !== null && _b !== void 0 ? _b : 0}`;
|
|
36
37
|
},
|
|
37
38
|
},
|
|
39
|
+
{
|
|
40
|
+
componentType: COMPONENT_TYPE.TEXT,
|
|
41
|
+
key: "ttlSeconds",
|
|
42
|
+
textFormatter: (_value, row) => {
|
|
43
|
+
const job = row;
|
|
44
|
+
return job.ttlSeconds != null ? formatSecs(job.ttlSeconds) : "—";
|
|
45
|
+
},
|
|
46
|
+
},
|
|
38
47
|
{
|
|
39
48
|
componentType: COMPONENT_TYPE.CREATED_UPDATED_AT,
|
|
40
49
|
key: "createdAt",
|
|
@@ -48,16 +57,17 @@ const createComponentInstances = () => ({
|
|
|
48
57
|
filter: _jsx(BulkOperationsFilter, {}),
|
|
49
58
|
view: _jsx(BulkOperationsView, {}),
|
|
50
59
|
});
|
|
51
|
-
const createBulkOperationsConfig = ({ cancelLabel, dispatch, drawerFilterDescription, drawerFilterTitle, drawerViewDescription, drawerViewTitle, labelActions, labelId, labelProgress, labelState, labelStatus, labelType, saveLabel, searchPlaceholder, tableDescription, tableTitle, components, }) => {
|
|
60
|
+
const createBulkOperationsConfig = ({ cancelLabel, dispatch, drawerFilterDescription, drawerFilterTitle, drawerViewDescription, drawerViewTitle, labelActions, labelExpiresIn, labelId, labelProgress, labelState, labelStatus, labelType, saveLabel, searchPlaceholder, tableDescription, tableTitle, components, }) => {
|
|
52
61
|
return {
|
|
53
62
|
moduleName: "bulk-operations",
|
|
54
63
|
tableColumns: [
|
|
55
|
-
{ label: labelId, width: "
|
|
56
|
-
{ label: labelType, width: "
|
|
57
|
-
{ label: labelStatus, width: "
|
|
58
|
-
{ label: labelProgress, width: "
|
|
64
|
+
{ label: labelId, width: "5%" },
|
|
65
|
+
{ label: labelType, width: "40%" },
|
|
66
|
+
{ label: labelStatus, width: "10%" },
|
|
67
|
+
{ label: labelProgress, width: "10%" },
|
|
68
|
+
{ label: labelExpiresIn, width: "10%" },
|
|
59
69
|
{ label: labelState, width: "20%" },
|
|
60
|
-
{ label: labelActions, width: "
|
|
70
|
+
{ label: labelActions, width: "5%" },
|
|
61
71
|
],
|
|
62
72
|
cancelLabel,
|
|
63
73
|
drawerFilterDescription,
|
|
@@ -103,6 +113,7 @@ const BulkOperationsPageInner = (props) => {
|
|
|
103
113
|
drawerFilterTitle: props.drawerFilterTitle,
|
|
104
114
|
drawerFilterDescription: props.drawerFilterDescription,
|
|
105
115
|
labelActions: props.labelActions,
|
|
116
|
+
labelExpiresIn: props.labelExpiresIn,
|
|
106
117
|
labelId: props.labelId,
|
|
107
118
|
labelProgress: props.labelProgress,
|
|
108
119
|
labelState: props.labelState,
|
|
@@ -121,6 +132,7 @@ const BulkOperationsPageInner = (props) => {
|
|
|
121
132
|
props.drawerFilterTitle,
|
|
122
133
|
props.drawerFilterDescription,
|
|
123
134
|
props.labelActions,
|
|
135
|
+
props.labelExpiresIn,
|
|
124
136
|
props.labelId,
|
|
125
137
|
props.labelProgress,
|
|
126
138
|
props.labelState,
|
|
@@ -10,8 +10,9 @@ import { useTranslations } from "next-intl";
|
|
|
10
10
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@appcorp/shadcn/components/ui/card";
|
|
11
11
|
import { Badge } from "@appcorp/shadcn/components/ui/badge";
|
|
12
12
|
import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
13
|
-
import { CheckCircle2, ClipboardList, Clock, Layers, ListChecks, XCircle, } from "lucide-react";
|
|
13
|
+
import { CheckCircle2, ClipboardList, Clock, Layers, ListChecks, Timer, XCircle, } from "lucide-react";
|
|
14
14
|
import { DATE_FORMATS, formatDate, } from "@react-pakistan/util-functions/general/format-date";
|
|
15
|
+
import { formatSecs } from "@react-pakistan/util-functions/general/format-secs";
|
|
15
16
|
import { useBulkOperationsContext } from "./context";
|
|
16
17
|
const STATUS_VARIANT = {
|
|
17
18
|
completed: "default",
|
|
@@ -22,13 +23,13 @@ const STATUS_VARIANT = {
|
|
|
22
23
|
export const BulkOperationsView = () => {
|
|
23
24
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
24
25
|
const { state } = useBulkOperationsContext();
|
|
25
|
-
const { createdAt, jobId, processed, results, status, total, type, updatedAt, webhookUrl, } = state;
|
|
26
|
+
const { createdAt, jobId, processed, results, status, total, ttlSeconds, type, updatedAt, webhookUrl, } = state;
|
|
26
27
|
const t = useTranslations("bulkOperations");
|
|
27
28
|
if (!jobId)
|
|
28
29
|
return null;
|
|
29
30
|
const fmt = (v) => v ? formatDate(v, DATE_FORMATS.LOCALE_DATE) : "—";
|
|
30
31
|
const jobResults = (results !== null && results !== void 0 ? results : null);
|
|
31
|
-
return (_jsxs("div", { className: "space-y-4", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ClipboardList, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionJobDetails") })] }), _jsx(CardDescription, { children: t("viewSectionJobDescription") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldJobId") }), _jsx("p", { className: "font-mono text-right text-sm break-all", children: jobId })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldType") }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Layers, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-right text-sm", children: type })] })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: (_a = STATUS_VARIANT[status !== null && status !== void 0 ? status : "queued"]) !== null && _a !== void 0 ? _a : "secondary", children: status || "—" })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldProgress") }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ListChecks, { className: "text-muted-foreground h-4 w-4" }), _jsxs("p", { className: "text-right text-sm", children: [processed !== null && processed !== void 0 ? processed : 0, " / ", total !== null && total !== void 0 ? total : 0] })] })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCreated") }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Clock, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-right text-sm", children: fmt(createdAt) })] })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldUpdated") }), _jsx("p", { className: "text-right text-sm", children: fmt(updatedAt) })] }), webhookUrl ? (_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldWebhook") }), _jsx("p", { className: "text-right text-sm break-all", children: webhookUrl })] })) : null] }) })] }), jobResults ? (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ListChecks, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionResults") })] }), _jsx(CardDescription, { children: t("viewSectionResultsDescription") })] }), _jsx(Separator, {}), _jsxs(CardContent, { className: "pt-6", children: [_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldTotal") }), _jsx("p", { className: "text-right text-sm", children: (_b = jobResults.total) !== null && _b !== void 0 ? _b : 0 })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CheckCircle2, { className: "text-green-600 h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCreated") })] }), _jsx("p", { className: "text-right text-sm", children: (_c = jobResults.created) !== null && _c !== void 0 ? _c : 0 })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CheckCircle2, { className: "text-blue-600 h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldUpdated") })] }), _jsx("p", { className: "text-right text-sm", children: (_d = jobResults.updated) !== null && _d !== void 0 ? _d : 0 })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSkipped") }), _jsx("p", { className: "text-right text-sm", children: (_e = jobResults.skipped) !== null && _e !== void 0 ? _e : 0 })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(XCircle, { className: "text-red-600 h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldErrors") })] }), _jsx("p", { className: "text-right text-sm", children: (_g = (_f = jobResults.errors) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0 })] })] }), jobResults.errors && jobResults.errors.length > 0 ? (_jsxs("div", { className: "mt-4 space-y-2", children: [jobResults.errors.slice(0, 5).map((err, i) => {
|
|
32
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ClipboardList, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionJobDetails") })] }), _jsx(CardDescription, { children: t("viewSectionJobDescription") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldJobId") }), _jsx("p", { className: "font-mono text-right text-sm break-all", children: jobId })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldType") }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Layers, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-right text-sm", children: type })] })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: (_a = STATUS_VARIANT[status !== null && status !== void 0 ? status : "queued"]) !== null && _a !== void 0 ? _a : "secondary", children: status || "—" })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldExpiresIn") }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Timer, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-right text-sm", children: ttlSeconds != null ? formatSecs(ttlSeconds) : "—" })] })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldProgress") }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ListChecks, { className: "text-muted-foreground h-4 w-4" }), _jsxs("p", { className: "text-right text-sm", children: [processed !== null && processed !== void 0 ? processed : 0, " / ", total !== null && total !== void 0 ? total : 0] })] })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCreated") }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Clock, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-right text-sm", children: fmt(createdAt) })] })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldUpdated") }), _jsx("p", { className: "text-right text-sm", children: fmt(updatedAt) })] }), webhookUrl ? (_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldWebhook") }), _jsx("p", { className: "text-right text-sm break-all", children: webhookUrl })] })) : null] }) })] }), jobResults ? (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ListChecks, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionResults") })] }), _jsx(CardDescription, { children: t("viewSectionResultsDescription") })] }), _jsx(Separator, {}), _jsxs(CardContent, { className: "pt-6", children: [_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldTotal") }), _jsx("p", { className: "text-right text-sm", children: (_b = jobResults.total) !== null && _b !== void 0 ? _b : 0 })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CheckCircle2, { className: "text-green-600 h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCreated") })] }), _jsx("p", { className: "text-right text-sm", children: (_c = jobResults.created) !== null && _c !== void 0 ? _c : 0 })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CheckCircle2, { className: "text-blue-600 h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldUpdated") })] }), _jsx("p", { className: "text-right text-sm", children: (_d = jobResults.updated) !== null && _d !== void 0 ? _d : 0 })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSkipped") }), _jsx("p", { className: "text-right text-sm", children: (_e = jobResults.skipped) !== null && _e !== void 0 ? _e : 0 })] }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(XCircle, { className: "text-red-600 h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldErrors") })] }), _jsx("p", { className: "text-right text-sm", children: (_g = (_f = jobResults.errors) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0 })] })] }), jobResults.errors && jobResults.errors.length > 0 ? (_jsxs("div", { className: "mt-4 space-y-2", children: [jobResults.errors.slice(0, 5).map((err, i) => {
|
|
32
33
|
var _a;
|
|
33
34
|
return (_jsxs("div", { className: "bg-destructive/10 text-destructive rounded-md px-3 py-2 text-xs", children: [_jsxs("span", { className: "font-medium", children: ["Row ", (_a = err.row) !== null && _a !== void 0 ? _a : "?", err.studentProfileId ? ` • ${err.studentProfileId}` : "", ":"] }), " ", err.error] }, i));
|
|
34
35
|
}), jobResults.errors.length > 5 ? (_jsx("p", { className: "text-muted-foreground text-xs", children: t("viewErrorsMore", { count: jobResults.errors.length - 5 }) })) : null] })) : null] })] })) : null] }));
|