@elevasis/ui 1.15.3 → 1.17.1

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.
Files changed (41) hide show
  1. package/dist/charts/index.d.ts +25 -2
  2. package/dist/charts/index.js +2 -2
  3. package/dist/{chunk-FEZ2TGSH.js → chunk-7ATCF6UL.js} +282 -14
  4. package/dist/{chunk-4NHYV42S.js → chunk-7S5FS7WW.js} +35 -4
  5. package/dist/chunk-ADSSLKKP.js +10 -0
  6. package/dist/{chunk-WY2BCL5F.js → chunk-F25DUOWI.js} +2 -2
  7. package/dist/chunk-MHW43EOH.js +47 -0
  8. package/dist/{chunk-6YIE72M2.js → chunk-NUULWBAD.js} +1 -1
  9. package/dist/{chunk-E6Q6A5TU.js → chunk-QCEUL5QG.js} +2 -6
  10. package/dist/{chunk-4NAZQ7WO.js → chunk-RYSPAQGW.js} +2 -2
  11. package/dist/{chunk-XY7VKOKI.js → chunk-UEYUPTAD.js} +80 -777
  12. package/dist/chunk-ZGK6XZVY.js +1208 -0
  13. package/dist/components/index.d.ts +511 -488
  14. package/dist/components/index.js +28 -1221
  15. package/dist/features/operations/index.css +565 -0
  16. package/dist/features/operations/index.d.ts +90 -0
  17. package/dist/features/operations/index.js +241 -0
  18. package/dist/hooks/index.d.ts +509 -488
  19. package/dist/hooks/index.js +4 -4
  20. package/dist/hooks/published.d.ts +509 -488
  21. package/dist/hooks/published.js +4 -4
  22. package/dist/index.d.ts +522 -490
  23. package/dist/index.js +6 -6
  24. package/dist/initialization/index.d.ts +508 -487
  25. package/dist/layout/index.d.ts +196 -6
  26. package/dist/layout/index.js +5 -4
  27. package/dist/profile/index.d.ts +508 -487
  28. package/dist/provider/index.d.ts +1 -1
  29. package/dist/provider/index.js +4 -4
  30. package/dist/provider/published.d.ts +1 -1
  31. package/dist/router/index.d.ts +12 -1
  32. package/dist/router/index.js +1 -1
  33. package/dist/supabase/index.d.ts +890 -851
  34. package/dist/theme/index.d.ts +1 -1
  35. package/dist/theme/index.js +3 -3
  36. package/dist/types/index.d.ts +509 -488
  37. package/package.json +5 -1
  38. package/dist/chunk-LHQTTUL2.js +0 -27
  39. package/dist/components/layout/backgrounds/CyberParticles.d.ts +0 -30
  40. package/dist/components/layout/backgrounds/CyberParticles.d.ts.map +0 -1
  41. package/dist/components/layout/backgrounds/CyberParticles.js +0 -138
@@ -0,0 +1,241 @@
1
+ import { ExecutionStats } from '../../chunk-ZGK6XZVY.js';
2
+ import { SubshellLoader } from '../../chunk-ADSSLKKP.js';
3
+ import { PageTitleCaption, TabCountBadge, ResourceCard } from '../../chunk-7S5FS7WW.js';
4
+ import '../../chunk-KBLGVZBD.js';
5
+ import { useStatusFilter, useResourceSearch, useResourcesDomainFilters, filterByDomainFilters } from '../../chunk-XGVD76EL.js';
6
+ import { usePaginationState, useResources, useRecentExecutionsByResource } from '../../chunk-TRVSTJTK.js';
7
+ import '../../chunk-LXHZYSMQ.js';
8
+ import '../../chunk-NJJ3NQ7B.js';
9
+ import '../../chunk-MHW43EOH.js';
10
+ import '../../chunk-F6RBK7NJ.js';
11
+ import '../../chunk-XA34RETF.js';
12
+ import '../../chunk-ELJIFLCB.js';
13
+ import '../../chunk-L4XXM55J.js';
14
+ import '../../chunk-SLVC5OJ2.js';
15
+ import '../../chunk-RNP5R5I3.js';
16
+ import '../../chunk-F25DUOWI.js';
17
+ import '../../chunk-NUULWBAD.js';
18
+ import '../../chunk-SZHARWKU.js';
19
+ import '../../chunk-UEYUPTAD.js';
20
+ import '../../chunk-7ATCF6UL.js';
21
+ import '../../chunk-53GNREDV.js';
22
+ import '../../chunk-QJ2KCHKX.js';
23
+ import '../../chunk-U2522LSW.js';
24
+ import '../../chunk-RULQSZYX.js';
25
+ import { formatRelativeTime } from '../../chunk-FCFLBMVI.js';
26
+ import '../../chunk-CC3SDRIF.js';
27
+ import '../../chunk-ALA56RGZ.js';
28
+ import { useInitialization } from '../../chunk-DVKEEY5J.js';
29
+ import '../../chunk-QEPXAWE2.js';
30
+ import '../../chunk-DD3CCMCZ.js';
31
+ import '../../chunk-BRJ3QZ4E.js';
32
+ import '../../chunk-Q7DJKLEN.js';
33
+ import { Stack, Card, Text, Button, Tabs, Group, Pagination } from '@mantine/core';
34
+ import { IconApps, IconRoute, IconBrain } from '@tabler/icons-react';
35
+ import { useState, useEffect, useMemo } from 'react';
36
+ import { jsx, jsxs } from 'react/jsx-runtime';
37
+
38
+ function ResourcesPage({
39
+ initialFilter,
40
+ onTypeChange,
41
+ timeRange,
42
+ onResourceClick,
43
+ pageSize = 20
44
+ }) {
45
+ const { organizationReady } = useInitialization();
46
+ const urlType = initialFilter;
47
+ const [selectedFilter, setSelectedFilter] = useState(urlType || "all");
48
+ const statusFilter = useStatusFilter((s) => s.value);
49
+ const searchQuery = useResourceSearch((s) => s.query);
50
+ const domainFilters = useResourcesDomainFilters((s) => s.filters);
51
+ const { page, setPage, offset, totalPages } = usePaginationState(pageSize, [
52
+ selectedFilter,
53
+ statusFilter,
54
+ domainFilters,
55
+ searchQuery
56
+ ]);
57
+ useEffect(() => {
58
+ if (urlType) {
59
+ setSelectedFilter(urlType);
60
+ } else {
61
+ setSelectedFilter("all");
62
+ }
63
+ }, [urlType]);
64
+ const { data, error, refetch, isFetching } = useResources();
65
+ const { data: executionData } = useRecentExecutionsByResource({
66
+ timeRange
67
+ });
68
+ const executionLookup = useMemo(() => {
69
+ if (!executionData?.resources) return /* @__PURE__ */ new Map();
70
+ return new Map(executionData.resources.map((r) => [r.resourceId, r]));
71
+ }, [executionData]);
72
+ const { workflows = [], agents = [], total = 0 } = data || {};
73
+ const filteredResources = useMemo(() => {
74
+ const typedWorkflows = (workflows || []).map((w) => ({ ...w, type: "workflow" }));
75
+ const typedAgents = (agents || []).map((a) => ({ ...a, type: "agent" }));
76
+ let resources = [];
77
+ switch (selectedFilter) {
78
+ case "workflow":
79
+ resources = typedWorkflows;
80
+ break;
81
+ case "agent":
82
+ resources = typedAgents;
83
+ break;
84
+ case "all":
85
+ resources = [...typedWorkflows, ...typedAgents];
86
+ break;
87
+ default:
88
+ resources = [];
89
+ }
90
+ if (statusFilter !== "all") {
91
+ resources = resources.filter((resource) => resource.status === statusFilter);
92
+ }
93
+ resources = filterByDomainFilters(resources, domainFilters);
94
+ if (searchQuery.trim()) {
95
+ const q = searchQuery.toLowerCase();
96
+ resources = resources.filter(
97
+ (r) => r.name.toLowerCase().includes(q) || r.resourceId.toLowerCase().includes(q) || r.description?.toLowerCase().includes(q)
98
+ );
99
+ }
100
+ const enriched = resources.map((resource) => {
101
+ const execData = executionLookup.get(resource.resourceId);
102
+ return {
103
+ ...resource,
104
+ lastExecution: execData?.lastExecution,
105
+ totalExecutions: execData?.totalExecutions || 0,
106
+ successCount: execData?.successCount || 0,
107
+ failureCount: execData?.failureCount || 0,
108
+ successRate: execData?.successRate || 0
109
+ };
110
+ });
111
+ enriched.sort((a, b) => {
112
+ if (a.lastExecution && b.lastExecution) {
113
+ return new Date(b.lastExecution).getTime() - new Date(a.lastExecution).getTime();
114
+ }
115
+ if (a.lastExecution) return -1;
116
+ if (b.lastExecution) return 1;
117
+ return a.name.localeCompare(b.name);
118
+ });
119
+ return enriched;
120
+ }, [workflows, agents, selectedFilter, statusFilter, domainFilters, searchQuery, executionLookup]);
121
+ if (!organizationReady || isFetching && !data) {
122
+ return /* @__PURE__ */ jsx(SubshellLoader, {});
123
+ }
124
+ if (error) {
125
+ return /* @__PURE__ */ jsxs(Stack, { children: [
126
+ /* @__PURE__ */ jsx(PageTitleCaption, { title: "Resources", caption: "Failed to load resources" }),
127
+ /* @__PURE__ */ jsxs(Card, { children: [
128
+ /* @__PURE__ */ jsxs(Text, { c: "red", children: [
129
+ "Error: ",
130
+ error.message
131
+ ] }),
132
+ /* @__PURE__ */ jsx(Button, { onClick: () => refetch(), children: "Retry" })
133
+ ] })
134
+ ] });
135
+ }
136
+ const getResourceCount = (type) => {
137
+ const filteredW = filterByDomainFilters(workflows, domainFilters);
138
+ const filteredA = filterByDomainFilters(agents, domainFilters);
139
+ switch (type) {
140
+ case "workflow":
141
+ return filteredW.length;
142
+ case "agent":
143
+ return filteredA.length;
144
+ case "all":
145
+ return filteredW.length + filteredA.length;
146
+ default:
147
+ return 0;
148
+ }
149
+ };
150
+ const handleTabChange = (value) => {
151
+ if (value) {
152
+ const filterValue = value;
153
+ setSelectedFilter(filterValue);
154
+ onTypeChange(filterValue === "all" ? void 0 : filterValue);
155
+ }
156
+ };
157
+ const isFiltering = filteredResources.length !== total;
158
+ const paginatedResources = filteredResources.slice(offset, offset + pageSize);
159
+ return /* @__PURE__ */ jsxs(Stack, { children: [
160
+ /* @__PURE__ */ jsx(
161
+ PageTitleCaption,
162
+ {
163
+ title: "Resources",
164
+ caption: isFiltering ? `${filteredResources.length} Resources Available, ${total - filteredResources.length} Filtered` : `${total} Resources Available`
165
+ }
166
+ ),
167
+ /* @__PURE__ */ jsx(Tabs, { value: selectedFilter, onChange: handleTabChange, variant: "default", children: /* @__PURE__ */ jsxs(Tabs.List, { children: [
168
+ /* @__PURE__ */ jsx(
169
+ Tabs.Tab,
170
+ {
171
+ value: "all",
172
+ leftSection: /* @__PURE__ */ jsx(IconApps, { size: 16 }),
173
+ rightSection: /* @__PURE__ */ jsx(TabCountBadge, { count: getResourceCount("all"), isLoading: isFetching }),
174
+ children: "All"
175
+ }
176
+ ),
177
+ /* @__PURE__ */ jsx(
178
+ Tabs.Tab,
179
+ {
180
+ value: "workflow",
181
+ leftSection: /* @__PURE__ */ jsx(IconRoute, { size: 16 }),
182
+ rightSection: /* @__PURE__ */ jsx(TabCountBadge, { count: getResourceCount("workflow"), isLoading: isFetching }),
183
+ children: "Workflows"
184
+ }
185
+ ),
186
+ /* @__PURE__ */ jsx(
187
+ Tabs.Tab,
188
+ {
189
+ value: "agent",
190
+ leftSection: /* @__PURE__ */ jsx(IconBrain, { size: 16 }),
191
+ rightSection: /* @__PURE__ */ jsx(TabCountBadge, { count: getResourceCount("agent"), isLoading: isFetching }),
192
+ children: "Agents"
193
+ }
194
+ )
195
+ ] }) }),
196
+ filteredResources.length > 0 ? /* @__PURE__ */ jsx(Stack, { gap: "xs", children: paginatedResources.map((resource) => {
197
+ const isDormant = resource.totalExecutions === 0;
198
+ return /* @__PURE__ */ jsx(
199
+ ResourceCard,
200
+ {
201
+ resource,
202
+ onClick: onResourceClick,
203
+ layout: "row",
204
+ dormant: isDormant,
205
+ "data-resource-id": resource.resourceId,
206
+ lastRunLabel: resource.lastExecution ? `Last run ${formatRelativeTime(resource.lastExecution)}` : void 0,
207
+ rightSection: /* @__PURE__ */ jsx(
208
+ ExecutionStats,
209
+ {
210
+ totalExecutions: resource.totalExecutions,
211
+ successCount: resource.successCount,
212
+ failureCount: resource.failureCount,
213
+ successRate: resource.successRate,
214
+ compact: true
215
+ }
216
+ ),
217
+ style: isDormant ? { opacity: 0.7 } : void 0
218
+ },
219
+ resource.resourceId
220
+ );
221
+ }) }) : /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Stack, { align: "center", children: [
222
+ /* @__PURE__ */ jsxs(Text, { c: "dimmed", children: [
223
+ "No resources found for ",
224
+ selectedFilter === "all" ? "any type" : selectedFilter
225
+ ] }),
226
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: selectedFilter === "all" ? "Register workflows or agents to see them here" : `Register ${selectedFilter}s to see them here` })
227
+ ] }) }),
228
+ totalPages(filteredResources.length) > 1 && /* @__PURE__ */ jsx(Group, { justify: "flex-start", children: /* @__PURE__ */ jsx(
229
+ Pagination,
230
+ {
231
+ size: "sm",
232
+ total: totalPages(filteredResources.length),
233
+ value: page,
234
+ onChange: setPage,
235
+ boundaries: 1
236
+ }
237
+ ) })
238
+ ] });
239
+ }
240
+
241
+ export { ResourcesPage };