@elevasis/ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.d.ts +87 -0
- package/dist/api/index.js +3 -0
- package/dist/auth/context.d.ts +19 -0
- package/dist/auth/context.js +1 -0
- package/dist/auth/index.d.ts +85 -0
- package/dist/auth/index.js +3 -0
- package/dist/chunk-3KMDHCAR.js +52 -0
- package/dist/chunk-5UWFGBFM.js +129 -0
- package/dist/chunk-6BJOYF6E.js +8 -0
- package/dist/chunk-6M6OLGQY.js +36 -0
- package/dist/chunk-7AI5ZYJ4.js +202 -0
- package/dist/chunk-7PLEQFHO.js +18 -0
- package/dist/chunk-GDV44UWF.js +138 -0
- package/dist/chunk-GEFB5YIR.js +338 -0
- package/dist/chunk-HBRMWW6V.js +43 -0
- package/dist/chunk-HUWJXLLF.js +681 -0
- package/dist/chunk-J3FALDQE.js +176 -0
- package/dist/chunk-JKERRYVS.js +109 -0
- package/dist/chunk-KA7LO7U5.js +28 -0
- package/dist/chunk-LHQTTUL2.js +27 -0
- package/dist/chunk-MAAS6CGR.js +1299 -0
- package/dist/chunk-NE36BUGQ.js +146 -0
- package/dist/chunk-NGXCFBCS.js +398 -0
- package/dist/chunk-OEYU5O27.js +235 -0
- package/dist/chunk-OUHGHTE7.js +748 -0
- package/dist/chunk-OXVOHOP3.js +661 -0
- package/dist/chunk-PSLKGOBZ.js +58 -0
- package/dist/chunk-PYL4XW6H.js +107 -0
- package/dist/chunk-Q47SPRY7.js +1 -0
- package/dist/chunk-Q7DJKLEN.js +18 -0
- package/dist/chunk-RJCA5672.js +1664 -0
- package/dist/chunk-S66I2PYB.js +748 -0
- package/dist/chunk-W7ZBF5AA.js +1 -0
- package/dist/chunk-WNWKOCGJ.js +1067 -0
- package/dist/chunk-XCYKC6OZ.js +1 -0
- package/dist/chunk-YULUKCS6.js +56 -0
- package/dist/chunk-YZ6GTZXL.js +48 -0
- package/dist/chunk-ZGHDPDTF.js +379 -0
- package/dist/components/command-queue/index.css +53 -0
- package/dist/components/command-queue/index.d.ts +204 -0
- package/dist/components/command-queue/index.js +10 -0
- package/dist/components/forms/index.d.ts +56 -0
- package/dist/components/forms/index.js +2 -0
- package/dist/components/index.css +443 -0
- package/dist/components/index.d.ts +1354 -0
- package/dist/components/index.js +18 -0
- package/dist/components/monitoring/index.d.ts +66 -0
- package/dist/components/monitoring/index.js +2 -0
- package/dist/components/navigation/index.d.ts +54 -0
- package/dist/components/navigation/index.js +91 -0
- package/dist/components/notifications/index.d.ts +52 -0
- package/dist/components/notifications/index.js +4 -0
- package/dist/components/resource-definition/index.css +388 -0
- package/dist/components/resource-definition/index.d.ts +301 -0
- package/dist/components/resource-definition/index.js +3 -0
- package/dist/display/index.css +53 -0
- package/dist/display/index.d.ts +606 -0
- package/dist/display/index.js +6 -0
- package/dist/execution/index.css +388 -0
- package/dist/execution/index.d.ts +1090 -0
- package/dist/execution/index.js +4 -0
- package/dist/graph/index.css +388 -0
- package/dist/graph/index.d.ts +429 -0
- package/dist/graph/index.js +1 -0
- package/dist/hooks/index.d.ts +1927 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/published.d.ts +1653 -0
- package/dist/hooks/published.js +4 -0
- package/dist/index.css +505 -0
- package/dist/index.d.ts +7284 -0
- package/dist/index.js +31 -0
- package/dist/initialization/index.d.ts +2325 -0
- package/dist/initialization/index.js +4 -0
- package/dist/organization/index.d.ts +225 -0
- package/dist/organization/index.js +4 -0
- package/dist/profile/index.d.ts +2265 -0
- package/dist/profile/index.js +3 -0
- package/dist/provider/index.css +61 -0
- package/dist/provider/index.d.ts +291 -0
- package/dist/provider/index.js +7 -0
- package/dist/provider/published.d.ts +198 -0
- package/dist/provider/published.js +6 -0
- package/dist/router/context.d.ts +19 -0
- package/dist/router/context.js +1 -0
- package/dist/router/index.d.ts +31 -0
- package/dist/router/index.js +2 -0
- package/dist/sse/index.d.ts +83 -0
- package/dist/sse/index.js +185 -0
- package/dist/supabase/index.d.ts +4289 -0
- package/dist/supabase/index.js +47 -0
- package/dist/typeform/index.d.ts +458 -0
- package/dist/typeform/index.js +1976 -0
- package/dist/typeform/schemas.d.ts +67 -0
- package/dist/typeform/schemas.js +1 -0
- package/dist/utils/index.d.ts +177 -0
- package/dist/utils/index.js +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useUserProfile } from './chunk-5UWFGBFM.js';
|
|
2
|
+
import { useAuthContext } from './chunk-7PLEQFHO.js';
|
|
3
|
+
import { useMemo, useCallback } from 'react';
|
|
4
|
+
|
|
5
|
+
function createUseAppInitialization(useOrgInitialization) {
|
|
6
|
+
return function useAppInitialization() {
|
|
7
|
+
const { user, isLoading: authLoading } = useAuthContext();
|
|
8
|
+
const { profile, loading: profileLoading, error: profileError, refetch } = useUserProfile();
|
|
9
|
+
const {
|
|
10
|
+
isInitializing: orgInitializing,
|
|
11
|
+
isLoading: orgLoading,
|
|
12
|
+
error: orgErrorMsg,
|
|
13
|
+
currentOrganization,
|
|
14
|
+
memberships,
|
|
15
|
+
retry: orgRetry
|
|
16
|
+
} = useOrgInitialization();
|
|
17
|
+
const isInitializing = authLoading || profileLoading || orgInitializing || orgLoading;
|
|
18
|
+
const userReady = !authLoading && !profileLoading && !!user && !!profile && !profileError;
|
|
19
|
+
const organizationReady = userReady && !orgInitializing && !orgLoading && !!currentOrganization && !orgErrorMsg;
|
|
20
|
+
const allReady = organizationReady;
|
|
21
|
+
const error = useMemo(() => {
|
|
22
|
+
if (profileError) {
|
|
23
|
+
return {
|
|
24
|
+
layer: "profile",
|
|
25
|
+
message: "Failed to load user profile",
|
|
26
|
+
originalError: profileError
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (orgErrorMsg) {
|
|
30
|
+
return {
|
|
31
|
+
layer: "organization",
|
|
32
|
+
message: orgErrorMsg,
|
|
33
|
+
originalError: new Error(orgErrorMsg)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (userReady && !orgInitializing && !orgLoading && !currentOrganization && memberships.length > 0) {
|
|
37
|
+
return {
|
|
38
|
+
layer: "organization",
|
|
39
|
+
message: "No organization membership found. Please contact your administrator for an invitation."
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}, [profileError, orgErrorMsg, userReady, orgInitializing, orgLoading, currentOrganization, memberships]);
|
|
44
|
+
const retry = useCallback(() => {
|
|
45
|
+
if (profileError && refetch) {
|
|
46
|
+
refetch();
|
|
47
|
+
}
|
|
48
|
+
if (orgErrorMsg && orgRetry) {
|
|
49
|
+
orgRetry();
|
|
50
|
+
}
|
|
51
|
+
}, [profileError, refetch, orgErrorMsg, orgRetry]);
|
|
52
|
+
return { userReady, organizationReady, allReady, isInitializing, error, retry, profile };
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { createUseAppInitialization };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// ../core/src/execution/engine/workflow/logging.ts
|
|
2
|
+
function isStepStartedContext(ctx) {
|
|
3
|
+
return ctx.contextType === "step-started" || "stepStatus" in ctx && ctx.stepStatus === "started";
|
|
4
|
+
}
|
|
5
|
+
function isStepCompletedContext(ctx) {
|
|
6
|
+
return ctx.contextType === "step-completed" || "stepStatus" in ctx && ctx.stepStatus === "completed";
|
|
7
|
+
}
|
|
8
|
+
function isStepFailedContext(ctx) {
|
|
9
|
+
return ctx.contextType === "step-failed" || "stepStatus" in ctx && ctx.stepStatus === "failed";
|
|
10
|
+
}
|
|
11
|
+
function isConditionalRouteContext(ctx) {
|
|
12
|
+
return ctx.contextType === "conditional-route" || "target" in ctx && "stepId" in ctx && !("stepStatus" in ctx);
|
|
13
|
+
}
|
|
14
|
+
function toWorkflowLogMessage(log) {
|
|
15
|
+
if (log.context?.type === "workflow") {
|
|
16
|
+
return {
|
|
17
|
+
level: log.level,
|
|
18
|
+
message: log.message,
|
|
19
|
+
timestamp: log.timestamp,
|
|
20
|
+
context: log.context
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
level: log.level,
|
|
25
|
+
message: log.message,
|
|
26
|
+
timestamp: log.timestamp,
|
|
27
|
+
context: log.context
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// ../core/src/execution/engine/agent/observability/logging.ts
|
|
32
|
+
function isLifecycleEvent(ctx) {
|
|
33
|
+
return "stage" in ctx && ctx.stage !== void 0;
|
|
34
|
+
}
|
|
35
|
+
function isIterationEvent(ctx) {
|
|
36
|
+
return "eventType" in ctx && ctx.eventType !== void 0;
|
|
37
|
+
}
|
|
38
|
+
function isToolCallEvent(ctx) {
|
|
39
|
+
return "eventType" in ctx && ctx.eventType === "tool-call";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ../core/src/execution/engine/base/types.ts
|
|
43
|
+
var ResourceStatusColors = {
|
|
44
|
+
dev: "var(--color-primary)",
|
|
45
|
+
prod: "var(--color-success)"
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { ResourceStatusColors, isConditionalRouteContext, isIterationEvent, isLifecycleEvent, isStepCompletedContext, isStepFailedContext, isStepStartedContext, isToolCallEvent, toWorkflowLogMessage };
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import { useSubmitAction, useDeleteTask } from './chunk-J3FALDQE.js';
|
|
2
|
+
import { FormFieldRenderer } from './chunk-PSLKGOBZ.js';
|
|
3
|
+
import { ContextViewer, JsonViewer } from './chunk-OUHGHTE7.js';
|
|
4
|
+
import { getErrorInfo, formatErrorMessage } from './chunk-7AI5ZYJ4.js';
|
|
5
|
+
import { Modal, Stack, Title, Text, Textarea, Alert, Group, Button, Card, ThemeIcon, Badge, Loader, Menu, ActionIcon, Accordion } from '@mantine/core';
|
|
6
|
+
import { IconMail, IconSend, IconFileText, IconClock, IconArrowUp, IconMessageCircle, IconRocket, IconEye, IconEdit, IconAlertTriangle, IconRefresh, IconX, IconCheck, IconAlertCircle, IconRobot, IconGitBranch, IconDotsVertical, IconTrash, IconPlayerPlay, IconExternalLink } from '@tabler/icons-react';
|
|
7
|
+
import { useState } from 'react';
|
|
8
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
|
+
import { useForm } from '@mantine/form';
|
|
10
|
+
|
|
11
|
+
var CustomModal = ({ children, opened, onClose, loading, style, size }) => {
|
|
12
|
+
const canClose = loading === true ? false : true;
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
Modal,
|
|
15
|
+
{
|
|
16
|
+
opened,
|
|
17
|
+
onClose,
|
|
18
|
+
padding: "xs",
|
|
19
|
+
withCloseButton: false,
|
|
20
|
+
closeOnClickOutside: canClose,
|
|
21
|
+
closeOnEscape: canClose,
|
|
22
|
+
centered: true,
|
|
23
|
+
style,
|
|
24
|
+
size,
|
|
25
|
+
children
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
var iconMap = {
|
|
30
|
+
IconCheck,
|
|
31
|
+
IconX,
|
|
32
|
+
IconRefresh,
|
|
33
|
+
IconAlertTriangle,
|
|
34
|
+
IconEdit,
|
|
35
|
+
IconEye,
|
|
36
|
+
IconRocket,
|
|
37
|
+
IconMessageCircle,
|
|
38
|
+
IconArrowUp,
|
|
39
|
+
IconClock,
|
|
40
|
+
IconFileText,
|
|
41
|
+
IconSend,
|
|
42
|
+
IconMail
|
|
43
|
+
};
|
|
44
|
+
function getIcon(iconName) {
|
|
45
|
+
if (!iconName) return null;
|
|
46
|
+
const icon = iconMap[iconName];
|
|
47
|
+
if (!icon && process.env.NODE_ENV !== "production") {
|
|
48
|
+
console.warn(`[iconMap] Unknown icon "${iconName}". Allowed: ${Object.keys(iconMap).join(", ")}`);
|
|
49
|
+
}
|
|
50
|
+
return icon || null;
|
|
51
|
+
}
|
|
52
|
+
function resolveDefaultValue(context, path) {
|
|
53
|
+
if (!context || typeof context !== "object") return void 0;
|
|
54
|
+
return path.split(".").reduce((obj, key) => {
|
|
55
|
+
if (obj && typeof obj === "object" && key in obj) {
|
|
56
|
+
return obj[key];
|
|
57
|
+
}
|
|
58
|
+
return void 0;
|
|
59
|
+
}, context);
|
|
60
|
+
}
|
|
61
|
+
function ActionModal({
|
|
62
|
+
action,
|
|
63
|
+
task,
|
|
64
|
+
opened,
|
|
65
|
+
onClose,
|
|
66
|
+
onSubmit,
|
|
67
|
+
richTextRenderer,
|
|
68
|
+
error,
|
|
69
|
+
isPending
|
|
70
|
+
}) {
|
|
71
|
+
const getInitialValuesFromContext = () => {
|
|
72
|
+
if (!action.form?.fields) return {};
|
|
73
|
+
return action.form.fields.reduce(
|
|
74
|
+
(acc, field) => {
|
|
75
|
+
if (field.defaultValueFromContext && task?.context) {
|
|
76
|
+
const value = resolveDefaultValue(task.context, field.defaultValueFromContext);
|
|
77
|
+
if (value !== void 0) {
|
|
78
|
+
acc[field.name] = value;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return acc;
|
|
82
|
+
},
|
|
83
|
+
{}
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
const form = useForm({
|
|
87
|
+
initialValues: {
|
|
88
|
+
...getInitialValuesFromContext(),
|
|
89
|
+
...action.payloadTemplate || {},
|
|
90
|
+
notes: ""
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const handleSubmit = form.onSubmit((values) => {
|
|
94
|
+
const { notes, ...payload } = values;
|
|
95
|
+
onSubmit(payload, notes || void 0);
|
|
96
|
+
});
|
|
97
|
+
const Icon = getIcon(action.icon);
|
|
98
|
+
const errorMessage = error ? (() => {
|
|
99
|
+
const { message, fields, requestId } = getErrorInfo(error);
|
|
100
|
+
return formatErrorMessage(message, requestId, fields);
|
|
101
|
+
})() : null;
|
|
102
|
+
if (!action.form) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
return /* @__PURE__ */ jsx(CustomModal, { opened, onClose, size: "xl", children: /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs(Stack, { children: [
|
|
106
|
+
/* @__PURE__ */ jsx(Title, { order: 3, children: action.form.title || action.label }),
|
|
107
|
+
action.form.description && /* @__PURE__ */ jsx(Text, { c: "dimmed", children: action.form.description }),
|
|
108
|
+
action.form.fields.map((field) => /* @__PURE__ */ jsx(FormFieldRenderer, { field, form, richTextRenderer }, field.name)),
|
|
109
|
+
/* @__PURE__ */ jsx(
|
|
110
|
+
Textarea,
|
|
111
|
+
{
|
|
112
|
+
label: "Notes (optional)",
|
|
113
|
+
placeholder: "Add any notes or reasoning...",
|
|
114
|
+
...form.getInputProps("notes")
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
errorMessage && /* @__PURE__ */ jsx(Alert, { color: "red", variant: "light", icon: /* @__PURE__ */ jsx(IconAlertCircle, { size: 16 }), title: "Submission failed", children: /* @__PURE__ */ jsx(Text, { size: "sm", style: { whiteSpace: "pre-line" }, children: errorMessage }) }),
|
|
118
|
+
/* @__PURE__ */ jsxs(Group, { mt: "md", justify: "space-between", children: [
|
|
119
|
+
/* @__PURE__ */ jsx(Button, { variant: "light", onClick: onClose, children: "Cancel" }),
|
|
120
|
+
/* @__PURE__ */ jsx(
|
|
121
|
+
Button,
|
|
122
|
+
{
|
|
123
|
+
type: "submit",
|
|
124
|
+
color: action.color || "blue",
|
|
125
|
+
leftSection: Icon ? /* @__PURE__ */ jsx(Icon, { size: 16 }) : null,
|
|
126
|
+
loading: isPending,
|
|
127
|
+
children: action.label
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
] })
|
|
131
|
+
] }) }) });
|
|
132
|
+
}
|
|
133
|
+
function TaskCard({ task, onViewExecution, richTextRenderer }) {
|
|
134
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
135
|
+
const { mutate: submitAction, isPending } = useSubmitAction();
|
|
136
|
+
const { mutate: deleteTask, isPending: isDeleting } = useDeleteTask();
|
|
137
|
+
const [actionModalOpened, setActionModalOpened] = useState(false);
|
|
138
|
+
const [selectedAction, setSelectedAction] = useState(null);
|
|
139
|
+
const [confirmAction, setConfirmAction] = useState(null);
|
|
140
|
+
const [deleteConfirmOpened, setDeleteConfirmOpened] = useState(false);
|
|
141
|
+
const handleActionClick = (action) => {
|
|
142
|
+
if (action.requiresConfirmation) {
|
|
143
|
+
setConfirmAction(action);
|
|
144
|
+
} else if (action.form) {
|
|
145
|
+
setSelectedAction(action);
|
|
146
|
+
setActionModalOpened(true);
|
|
147
|
+
} else {
|
|
148
|
+
submitAction({
|
|
149
|
+
taskId: task.id,
|
|
150
|
+
actionId: action.id
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const handleConfirm = () => {
|
|
155
|
+
if (!confirmAction) return;
|
|
156
|
+
if (confirmAction.form) {
|
|
157
|
+
setSelectedAction(confirmAction);
|
|
158
|
+
setActionModalOpened(true);
|
|
159
|
+
} else {
|
|
160
|
+
submitAction({
|
|
161
|
+
taskId: task.id,
|
|
162
|
+
actionId: confirmAction.id
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
setConfirmAction(null);
|
|
166
|
+
};
|
|
167
|
+
const getPriorityColor = (priority) => {
|
|
168
|
+
if (priority >= 8) return "red";
|
|
169
|
+
if (priority >= 5) return "yellow";
|
|
170
|
+
return "gray";
|
|
171
|
+
};
|
|
172
|
+
const getStatusColor = (status) => {
|
|
173
|
+
switch (status) {
|
|
174
|
+
case "pending":
|
|
175
|
+
return "blue";
|
|
176
|
+
case "processing":
|
|
177
|
+
return "blue";
|
|
178
|
+
case "completed":
|
|
179
|
+
return "green";
|
|
180
|
+
case "failed":
|
|
181
|
+
return "red";
|
|
182
|
+
case "expired":
|
|
183
|
+
return "orange";
|
|
184
|
+
default:
|
|
185
|
+
return "gray";
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const handleRetry = () => {
|
|
189
|
+
if (task.selectedAction) {
|
|
190
|
+
submitAction({
|
|
191
|
+
taskId: task.id,
|
|
192
|
+
actionId: task.selectedAction,
|
|
193
|
+
payload: task.actionPayload
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const formatDate = (date) => {
|
|
198
|
+
const now = /* @__PURE__ */ new Date();
|
|
199
|
+
const diffMs = now.getTime() - date.getTime();
|
|
200
|
+
const diffMins = Math.floor(diffMs / 6e4);
|
|
201
|
+
const diffHours = Math.floor(diffMins / 60);
|
|
202
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
203
|
+
if (diffMins < 60) return `${diffMins}m ago`;
|
|
204
|
+
if (diffHours < 24) return `${diffHours}h ago`;
|
|
205
|
+
return `${diffDays}d ago`;
|
|
206
|
+
};
|
|
207
|
+
return /* @__PURE__ */ jsx(
|
|
208
|
+
Card,
|
|
209
|
+
{
|
|
210
|
+
withBorder: true,
|
|
211
|
+
style: { transition: "box-shadow var(--duration-fast) var(--easing)" },
|
|
212
|
+
onMouseEnter: (e) => {
|
|
213
|
+
e.currentTarget.style.boxShadow = "var(--standard-box-shadow)";
|
|
214
|
+
},
|
|
215
|
+
onMouseLeave: (e) => {
|
|
216
|
+
e.currentTarget.style.boxShadow = "";
|
|
217
|
+
},
|
|
218
|
+
children: /* @__PURE__ */ jsxs(Stack, { gap: "sm", children: [
|
|
219
|
+
/* @__PURE__ */ jsxs(Group, { justify: "space-between", wrap: "nowrap", children: [
|
|
220
|
+
/* @__PURE__ */ jsxs(Group, { gap: "sm", style: { flex: 1 }, children: [
|
|
221
|
+
/* @__PURE__ */ jsx(ThemeIcon, { size: "lg", variant: "light", color: task.originResourceType === "agent" ? "blue" : "grape", children: task.originResourceType === "agent" ? /* @__PURE__ */ jsx(IconRobot, { size: 20 }) : /* @__PURE__ */ jsx(IconGitBranch, { size: 20 }) }),
|
|
222
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
|
|
223
|
+
/* @__PURE__ */ jsxs(Group, { gap: "xs", mb: 4, children: [
|
|
224
|
+
/* @__PURE__ */ jsx(Text, { fw: 600, size: "sm", style: { fontFamily: "var(--mantine-font-family-headings)" }, children: task.description || "Task approval required" }),
|
|
225
|
+
/* @__PURE__ */ jsxs(Badge, { size: "xs", variant: "light", color: getPriorityColor(task.priority), radius: "sm", children: [
|
|
226
|
+
"P",
|
|
227
|
+
task.priority
|
|
228
|
+
] })
|
|
229
|
+
] }),
|
|
230
|
+
/* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
231
|
+
/* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
|
|
232
|
+
task.originResourceType === "agent" ? "Agent" : "Workflow",
|
|
233
|
+
": ",
|
|
234
|
+
task.originResourceId
|
|
235
|
+
] }),
|
|
236
|
+
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "\u2022" }),
|
|
237
|
+
/* @__PURE__ */ jsxs(Group, { gap: 4, children: [
|
|
238
|
+
/* @__PURE__ */ jsx(IconClock, { size: 12 }),
|
|
239
|
+
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: formatDate(task.createdAt) })
|
|
240
|
+
] })
|
|
241
|
+
] })
|
|
242
|
+
] })
|
|
243
|
+
] }),
|
|
244
|
+
/* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
245
|
+
/* @__PURE__ */ jsx(
|
|
246
|
+
Badge,
|
|
247
|
+
{
|
|
248
|
+
size: "sm",
|
|
249
|
+
variant: "light",
|
|
250
|
+
color: getStatusColor(task.status),
|
|
251
|
+
radius: "sm",
|
|
252
|
+
leftSection: task.status === "processing" ? /* @__PURE__ */ jsx(Loader, { size: 6 }) : void 0,
|
|
253
|
+
children: task.status.charAt(0).toUpperCase() + task.status.slice(1)
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
task.status === "failed" && /* @__PURE__ */ jsx(Button, { variant: "light", color: "red", size: "xs", loading: isPending, onClick: handleRetry, children: "Retry" }),
|
|
257
|
+
/* @__PURE__ */ jsxs(Menu, { shadow: "md", position: "bottom-end", offset: 8, children: [
|
|
258
|
+
/* @__PURE__ */ jsx(Menu.Target, { children: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", color: "gray", size: "sm", children: /* @__PURE__ */ jsx(IconDotsVertical, { size: 16 }) }) }),
|
|
259
|
+
/* @__PURE__ */ jsx(Menu.Dropdown, { children: /* @__PURE__ */ jsx(
|
|
260
|
+
Menu.Item,
|
|
261
|
+
{
|
|
262
|
+
leftSection: /* @__PURE__ */ jsx(IconTrash, { size: 14 }),
|
|
263
|
+
disabled: task.status === "processing",
|
|
264
|
+
onClick: () => setDeleteConfirmOpened(true),
|
|
265
|
+
children: "Delete"
|
|
266
|
+
}
|
|
267
|
+
) })
|
|
268
|
+
] })
|
|
269
|
+
] })
|
|
270
|
+
] }),
|
|
271
|
+
/* @__PURE__ */ jsx(Accordion, { value: isExpanded ? "details" : null, onChange: (value) => setIsExpanded(!!value), children: /* @__PURE__ */ jsxs(Accordion.Item, { value: "details", children: [
|
|
272
|
+
/* @__PURE__ */ jsx(Accordion.Control, { children: /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, children: "View Context" }) }),
|
|
273
|
+
/* @__PURE__ */ jsx(Accordion.Panel, { children: /* @__PURE__ */ jsx(ContextViewer, { data: task.context }) })
|
|
274
|
+
] }) }),
|
|
275
|
+
task.status === "pending" && /* @__PURE__ */ jsx(Group, { gap: "xs", children: task.actions.map((action) => {
|
|
276
|
+
const Icon = getIcon(action.icon);
|
|
277
|
+
const variant = "light";
|
|
278
|
+
return /* @__PURE__ */ jsx(
|
|
279
|
+
Button,
|
|
280
|
+
{
|
|
281
|
+
variant,
|
|
282
|
+
color: action.color || (action.type === "danger" ? "red" : "blue"),
|
|
283
|
+
leftSection: Icon ? /* @__PURE__ */ jsx(Icon, { size: 16 }) : null,
|
|
284
|
+
loading: isPending,
|
|
285
|
+
onClick: () => handleActionClick(action),
|
|
286
|
+
title: action.description,
|
|
287
|
+
size: "xs",
|
|
288
|
+
radius: "xs",
|
|
289
|
+
children: action.label
|
|
290
|
+
},
|
|
291
|
+
action.id
|
|
292
|
+
);
|
|
293
|
+
}) }),
|
|
294
|
+
task.selectedAction && /* @__PURE__ */ jsx(Accordion, { children: /* @__PURE__ */ jsxs(Accordion.Item, { value: "submitted", children: [
|
|
295
|
+
/* @__PURE__ */ jsx(Accordion.Control, { children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
296
|
+
/* @__PURE__ */ jsx(ThemeIcon, { size: "sm", variant: "light", color: "green", radius: "xl", children: /* @__PURE__ */ jsx(IconCheck, { size: 12 }) }),
|
|
297
|
+
/* @__PURE__ */ jsxs(Text, { size: "sm", fw: 500, children: [
|
|
298
|
+
"Submitted: ",
|
|
299
|
+
task.actions.find((a) => a.id === task.selectedAction)?.label || task.selectedAction
|
|
300
|
+
] }),
|
|
301
|
+
task.targetExecutionId && /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: "cyan", leftSection: /* @__PURE__ */ jsx(IconPlayerPlay, { size: 10 }), children: "Executed" })
|
|
302
|
+
] }) }),
|
|
303
|
+
/* @__PURE__ */ jsx(Accordion.Panel, { children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
304
|
+
task.actionPayload !== void 0 && task.actionPayload !== null && /* @__PURE__ */ jsx(JsonViewer, { data: task.actionPayload, maxHeight: 200 }),
|
|
305
|
+
task.completedAt && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
|
|
306
|
+
"Completed ",
|
|
307
|
+
formatDate(task.completedAt),
|
|
308
|
+
task.completedBy ? ` by ${task.completedBy}` : ""
|
|
309
|
+
] }),
|
|
310
|
+
task.targetExecutionId && /* @__PURE__ */ jsx(
|
|
311
|
+
Button,
|
|
312
|
+
{
|
|
313
|
+
variant: "light",
|
|
314
|
+
size: "xs",
|
|
315
|
+
leftSection: /* @__PURE__ */ jsx(IconExternalLink, { size: 14 }),
|
|
316
|
+
onClick: () => {
|
|
317
|
+
onViewExecution?.({
|
|
318
|
+
resourceType: task.originResourceType,
|
|
319
|
+
resourceId: task.originResourceId,
|
|
320
|
+
executionId: task.targetExecutionId
|
|
321
|
+
});
|
|
322
|
+
},
|
|
323
|
+
children: "View Execution"
|
|
324
|
+
}
|
|
325
|
+
)
|
|
326
|
+
] }) })
|
|
327
|
+
] }) }),
|
|
328
|
+
/* @__PURE__ */ jsx(CustomModal, { opened: !!confirmAction, onClose: () => setConfirmAction(null), size: "sm", children: /* @__PURE__ */ jsxs(Stack, { children: [
|
|
329
|
+
/* @__PURE__ */ jsx(Text, { fw: 600, children: "Confirm Action" }),
|
|
330
|
+
/* @__PURE__ */ jsx(Text, { size: "sm", children: confirmAction?.confirmationMessage || `Are you sure you want to ${confirmAction?.label.toLowerCase()}?` }),
|
|
331
|
+
/* @__PURE__ */ jsxs(Group, { justify: "flex-end", children: [
|
|
332
|
+
/* @__PURE__ */ jsx(Button, { variant: "default", onClick: () => setConfirmAction(null), children: "Cancel" }),
|
|
333
|
+
/* @__PURE__ */ jsx(Button, { onClick: handleConfirm, children: confirmAction?.label })
|
|
334
|
+
] })
|
|
335
|
+
] }) }),
|
|
336
|
+
selectedAction && /* @__PURE__ */ jsx(
|
|
337
|
+
ActionModal,
|
|
338
|
+
{
|
|
339
|
+
action: selectedAction,
|
|
340
|
+
task,
|
|
341
|
+
opened: actionModalOpened,
|
|
342
|
+
onClose: () => setActionModalOpened(false),
|
|
343
|
+
onSubmit: (payload, notes) => {
|
|
344
|
+
submitAction({
|
|
345
|
+
taskId: task.id,
|
|
346
|
+
actionId: selectedAction.id,
|
|
347
|
+
payload,
|
|
348
|
+
notes
|
|
349
|
+
});
|
|
350
|
+
setActionModalOpened(false);
|
|
351
|
+
},
|
|
352
|
+
richTextRenderer
|
|
353
|
+
}
|
|
354
|
+
),
|
|
355
|
+
/* @__PURE__ */ jsx(CustomModal, { opened: deleteConfirmOpened, onClose: () => setDeleteConfirmOpened(false), size: "sm", children: /* @__PURE__ */ jsxs(Stack, { children: [
|
|
356
|
+
/* @__PURE__ */ jsx(Text, { fw: 600, children: "Delete Task" }),
|
|
357
|
+
/* @__PURE__ */ jsx(Text, { size: "sm", children: "Are you sure you want to delete this task? This action cannot be undone." }),
|
|
358
|
+
/* @__PURE__ */ jsxs(Group, { justify: "flex-end", children: [
|
|
359
|
+
/* @__PURE__ */ jsx(Button, { variant: "default", onClick: () => setDeleteConfirmOpened(false), children: "Cancel" }),
|
|
360
|
+
/* @__PURE__ */ jsx(
|
|
361
|
+
Button,
|
|
362
|
+
{
|
|
363
|
+
color: "red",
|
|
364
|
+
loading: isDeleting,
|
|
365
|
+
onClick: () => {
|
|
366
|
+
deleteTask(task.id);
|
|
367
|
+
setDeleteConfirmOpened(false);
|
|
368
|
+
},
|
|
369
|
+
children: "Delete"
|
|
370
|
+
}
|
|
371
|
+
)
|
|
372
|
+
] })
|
|
373
|
+
] }) })
|
|
374
|
+
] })
|
|
375
|
+
}
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export { ActionModal, CustomModal, TaskCard, getIcon, iconMap };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* src/components/display/StatCard.module.css */
|
|
2
|
+
.heroCard {
|
|
3
|
+
background: var(--glass-background);
|
|
4
|
+
backdrop-filter: var(--glass-blur);
|
|
5
|
+
border: 1px solid var(--color-border);
|
|
6
|
+
}
|
|
7
|
+
.iconRing {
|
|
8
|
+
position: relative;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
width: 46px;
|
|
13
|
+
height: 46px;
|
|
14
|
+
border-radius: 50%;
|
|
15
|
+
background: color-mix(in srgb, var(--color-primary) 12%, transparent);
|
|
16
|
+
border: 1px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
|
|
17
|
+
color: var(--color-primary);
|
|
18
|
+
flex-shrink: 0;
|
|
19
|
+
box-shadow: 0 0 12px color-mix(in srgb, var(--color-primary) 15%, transparent);
|
|
20
|
+
}
|
|
21
|
+
.iconRingSm {
|
|
22
|
+
composes: iconRing;
|
|
23
|
+
width: 36px;
|
|
24
|
+
height: 36px;
|
|
25
|
+
box-shadow: 0 0 8px color-mix(in srgb, var(--color-primary) 12%, transparent);
|
|
26
|
+
}
|
|
27
|
+
.heroValue {
|
|
28
|
+
font-family: var(--elevasis-font-family-subtitle);
|
|
29
|
+
font-size: 1.85rem;
|
|
30
|
+
font-weight: 800;
|
|
31
|
+
line-height: 1;
|
|
32
|
+
letter-spacing: -0.02em;
|
|
33
|
+
font-variant-numeric: tabular-nums;
|
|
34
|
+
}
|
|
35
|
+
[data-mantine-color-scheme=dark] .heroValue {
|
|
36
|
+
text-shadow: 0 0 20px color-mix(in srgb, var(--color-primary) 20%, transparent);
|
|
37
|
+
}
|
|
38
|
+
.heroValueSm {
|
|
39
|
+
composes: heroValue;
|
|
40
|
+
font-size: 1.35rem;
|
|
41
|
+
font-weight: 700;
|
|
42
|
+
}
|
|
43
|
+
.heroLabel {
|
|
44
|
+
font-size: 0.68rem;
|
|
45
|
+
font-weight: 700;
|
|
46
|
+
text-transform: uppercase;
|
|
47
|
+
letter-spacing: 0.12em;
|
|
48
|
+
color: var(--color-text-dimmed);
|
|
49
|
+
}
|
|
50
|
+
.heroLabelSm {
|
|
51
|
+
composes: heroLabel;
|
|
52
|
+
font-size: 0.62rem;
|
|
53
|
+
}
|