@ocelescope/management 0.6.0 → 0.8.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/index.js +260 -166
- package/package.json +15 -14
package/dist/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { FullScreenUpload, UploadSection, defineModule, defineModuleRoute, useDownloadFlatOCEL, useDownloadOCEL, useDownloadResource, useDownloadResourceAsPnml, useInvalidate } from "@ocelescope/core";
|
|
2
|
-
import { ActionIcon, Badge, Button, Container, Group, Loader, Menu, MenuItem, Modal, Select, Stack, TextInput, Title, Tooltip } from "@mantine/core";
|
|
2
|
+
import { ActionIcon, Badge, Button, Container, Group, Loader, Menu, MenuItem, Modal, MultiSelect, Select, Stack, TextInput, Title, Tooltip } from "@mantine/core";
|
|
3
|
+
import { useDebouncedValue } from "@mantine/hooks";
|
|
3
4
|
import { generateColor } from "@marko19907/string-to-color";
|
|
4
|
-
import { useDeleteOcel, useDeleteResource, useGetOcels,
|
|
5
|
+
import { DownloadOCELExt, useDeleteOcel, useDeleteResource, useGetOcels, useGetSystemTasks, useObjectCounts, useRenameOcel, useRenameResource, useResources } from "@ocelescope/api-base";
|
|
5
6
|
import { ResourceModal } from "@ocelescope/resources";
|
|
6
|
-
import { CheckIcon, DownloadIcon, EllipsisVerticalIcon, EyeIcon, FilterIcon, PencilIcon, TrashIcon, XIcon } from "lucide-react";
|
|
7
|
+
import { CheckIcon, DownloadIcon, EllipsisVerticalIcon, EyeIcon, FilterIcon, PencilIcon, SearchIcon, TrashIcon, XIcon } from "lucide-react";
|
|
7
8
|
import { DataTable } from "mantine-datatable";
|
|
8
|
-
import { useCallback, useMemo, useState } from "react";
|
|
9
|
+
import { memo, useCallback, useMemo, useState } from "react";
|
|
9
10
|
import dayjs from "dayjs";
|
|
10
11
|
import isBetween from "dayjs/plugin/isBetween.js";
|
|
11
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -14,6 +15,77 @@ dayjs.extend(isBetween);
|
|
|
14
15
|
var dayjs_default = dayjs;
|
|
15
16
|
const formatDateTime = (dateString) => dayjs(dateString).format("YYYY-MM-DD HH:mm");
|
|
16
17
|
//#endregion
|
|
18
|
+
//#region src/components/EntityActionsMenu.tsx
|
|
19
|
+
const ocelExtensions = Object.values(DownloadOCELExt);
|
|
20
|
+
const EntityActionsMenu = ({ entity, onRename, onInspect, onDownloadOcel, onExportAsXes, onDownloadResource, onDownloadResourceAsPnml, onDelete }) => {
|
|
21
|
+
const { id, type, entityTypeName, isUploading } = entity;
|
|
22
|
+
if (isUploading) return /* @__PURE__ */ jsx(Loader, { size: 20 });
|
|
23
|
+
return /* @__PURE__ */ jsxs(Menu, {
|
|
24
|
+
width: 200,
|
|
25
|
+
position: "left-start",
|
|
26
|
+
children: [/* @__PURE__ */ jsx(Menu.Target, { children: /* @__PURE__ */ jsx(ActionIcon, {
|
|
27
|
+
variant: "subtle",
|
|
28
|
+
onClick: (e) => e.stopPropagation(),
|
|
29
|
+
children: /* @__PURE__ */ jsx(EllipsisVerticalIcon, { size: 20 })
|
|
30
|
+
}) }), /* @__PURE__ */ jsxs(Menu.Dropdown, {
|
|
31
|
+
onClick: (e) => e.stopPropagation(),
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsx(Menu.Item, {
|
|
34
|
+
leftSection: /* @__PURE__ */ jsx(PencilIcon, { size: 16 }),
|
|
35
|
+
onClick: () => onRename(entity),
|
|
36
|
+
children: "Rename"
|
|
37
|
+
}),
|
|
38
|
+
type === "resource" && /* @__PURE__ */ jsx(MenuItem, {
|
|
39
|
+
leftSection: /* @__PURE__ */ jsx(EyeIcon, { size: 16 }),
|
|
40
|
+
onClick: () => onInspect(id),
|
|
41
|
+
children: "Inspect"
|
|
42
|
+
}),
|
|
43
|
+
type === "ocel" ? /* @__PURE__ */ jsxs(Menu.Sub, {
|
|
44
|
+
position: "right-start",
|
|
45
|
+
children: [/* @__PURE__ */ jsx(Menu.Sub.Target, { children: /* @__PURE__ */ jsx(Menu.Sub.Item, {
|
|
46
|
+
leftSection: /* @__PURE__ */ jsx(DownloadIcon, { size: 16 }),
|
|
47
|
+
children: "Download"
|
|
48
|
+
}) }), /* @__PURE__ */ jsxs(Menu.Sub.Dropdown, { children: [ocelExtensions.map((extension) => /* @__PURE__ */ jsx(Menu.Item, {
|
|
49
|
+
onClick: () => onDownloadOcel(id, extension),
|
|
50
|
+
children: extension
|
|
51
|
+
}, extension)), /* @__PURE__ */ jsx(Menu.Item, {
|
|
52
|
+
onClick: () => onExportAsXes(id),
|
|
53
|
+
children: ".xes"
|
|
54
|
+
}, ".xes")] })]
|
|
55
|
+
}) : entityTypeName === "Petri Net" ? /* @__PURE__ */ jsxs(Menu.Sub, {
|
|
56
|
+
position: "right-start",
|
|
57
|
+
children: [/* @__PURE__ */ jsx(Menu.Sub.Target, { children: /* @__PURE__ */ jsx(Menu.Sub.Item, {
|
|
58
|
+
leftSection: /* @__PURE__ */ jsx(DownloadIcon, { size: 16 }),
|
|
59
|
+
children: "Download"
|
|
60
|
+
}) }), /* @__PURE__ */ jsxs(Menu.Sub.Dropdown, { children: [/* @__PURE__ */ jsx(Menu.Item, {
|
|
61
|
+
onClick: () => onDownloadResource(id),
|
|
62
|
+
children: ".ocelescope"
|
|
63
|
+
}), /* @__PURE__ */ jsx(Menu.Item, {
|
|
64
|
+
onClick: () => onDownloadResourceAsPnml(id),
|
|
65
|
+
children: ".pnml"
|
|
66
|
+
})] })]
|
|
67
|
+
}) : /* @__PURE__ */ jsx(Menu.Item, {
|
|
68
|
+
onClick: () => onDownloadResource(id),
|
|
69
|
+
leftSection: /* @__PURE__ */ jsx(DownloadIcon, { size: 16 }),
|
|
70
|
+
children: "Download"
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ jsx(Menu.Divider, {}),
|
|
73
|
+
/* @__PURE__ */ jsx(Menu.Item, {
|
|
74
|
+
leftSection: /* @__PURE__ */ jsx(TrashIcon, {
|
|
75
|
+
size: 16,
|
|
76
|
+
color: "red"
|
|
77
|
+
}),
|
|
78
|
+
color: "red",
|
|
79
|
+
fw: "bold",
|
|
80
|
+
onClick: () => onDelete(id, type),
|
|
81
|
+
children: "Delete"
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
var EntityActionsMenu_default = memo(EntityActionsMenu);
|
|
88
|
+
//#endregion
|
|
17
89
|
//#region src/components/XESExportWindow.tsx
|
|
18
90
|
const XESExportWindow = ({ ocelId, onClose }) => {
|
|
19
91
|
const { data: objectCounts } = useObjectCounts(ocelId ?? "", void 0, { query: { enabled: !!ocelId } });
|
|
@@ -46,11 +118,6 @@ const XESExportWindow = ({ ocelId, onClose }) => {
|
|
|
46
118
|
};
|
|
47
119
|
//#endregion
|
|
48
120
|
//#region src/components/ResourceManagementTable.tsx
|
|
49
|
-
const ocelExtensions = [
|
|
50
|
-
".sqlite",
|
|
51
|
-
".xml",
|
|
52
|
-
".json"
|
|
53
|
-
];
|
|
54
121
|
const ResourceManagementTable = () => {
|
|
55
122
|
const { data: ocels = [] } = useGetOcels();
|
|
56
123
|
const { data: resources = [] } = useResources();
|
|
@@ -63,7 +130,6 @@ const ResourceManagementTable = () => {
|
|
|
63
130
|
const { download: downloadOCEL } = useDownloadOCEL();
|
|
64
131
|
const { download: downloadResource } = useDownloadResource();
|
|
65
132
|
const { download: downloadResourceAsPnml } = useDownloadResourceAsPnml();
|
|
66
|
-
const { data: resourceMeta = {} } = useGetResourceMeta();
|
|
67
133
|
const { mutate: deleteResource } = useDeleteResource({ mutation: { onSuccess: () => invalidate(["resources"]) } });
|
|
68
134
|
const { mutate: deleteOcel } = useDeleteOcel({ mutation: { onSuccess: () => invalidate(["ocels"]) } });
|
|
69
135
|
const { mutate: renameOcel } = useRenameOcel({ mutation: { onSuccess: () => invalidate(["ocels"]) } });
|
|
@@ -73,9 +139,7 @@ const ResourceManagementTable = () => {
|
|
|
73
139
|
case "ocel":
|
|
74
140
|
deleteOcel({ ocelId: id });
|
|
75
141
|
break;
|
|
76
|
-
case "resource":
|
|
77
|
-
deleteResource({ resourceId: id });
|
|
78
|
-
break;
|
|
142
|
+
case "resource": deleteResource({ resourceId: id });
|
|
79
143
|
}
|
|
80
144
|
}, [deleteResource, deleteOcel]);
|
|
81
145
|
const renameEntity = useCallback((id, entityType, newName) => {
|
|
@@ -94,33 +158,39 @@ const ResourceManagementTable = () => {
|
|
|
94
158
|
}, [renameOcel, renameResource]);
|
|
95
159
|
const [renamedEntity, setRenamedEntity] = useState(void 0);
|
|
96
160
|
const [viewedResource, setViewedResource] = useState();
|
|
97
|
-
const
|
|
98
|
-
|
|
161
|
+
const [searchedName, setSearchedName] = useState(null);
|
|
162
|
+
const [debouncedSearch] = useDebouncedValue(searchedName, 200);
|
|
163
|
+
const allEntityTypes = useMemo(() => [...ocels.length > 0 || tasks.length > 0 ? ["OCEL"] : [], ...new Set(resources.map(({ resource_type_label }) => resource_type_label))], [
|
|
164
|
+
ocels,
|
|
165
|
+
resources,
|
|
166
|
+
tasks
|
|
167
|
+
]);
|
|
168
|
+
const [includedEntityTypes, setIncludedEntityTypes] = useState([]);
|
|
169
|
+
const [sortStatus, setSortStatus] = useState({
|
|
170
|
+
columnAccessor: "createdAt",
|
|
171
|
+
direction: "desc"
|
|
172
|
+
});
|
|
173
|
+
const allEntities = useMemo(() => {
|
|
174
|
+
const ocelEntities = ocels.map(({ name, created_at, id, filter_applied }) => ({
|
|
99
175
|
id,
|
|
100
176
|
name,
|
|
101
177
|
type: "ocel",
|
|
102
|
-
|
|
103
|
-
createdAt:
|
|
104
|
-
downloadFormats: [
|
|
105
|
-
".xml",
|
|
106
|
-
".json",
|
|
107
|
-
".sqlite"
|
|
108
|
-
],
|
|
178
|
+
entityTypeName: "OCEL",
|
|
179
|
+
createdAt: dayjs_default(created_at).toISOString(),
|
|
109
180
|
isFiltered: !!filter_applied
|
|
110
181
|
}));
|
|
111
|
-
const resourceEntities = resources.map(({ id, name,
|
|
182
|
+
const resourceEntities = resources.map(({ id, name, resource_type_label, created_at }) => ({
|
|
112
183
|
id,
|
|
113
184
|
name,
|
|
114
|
-
|
|
185
|
+
entityTypeName: resource_type_label,
|
|
115
186
|
type: "resource",
|
|
116
|
-
|
|
117
|
-
createdAt: formatDateTime(dayjs_default(created_at).toISOString())
|
|
187
|
+
createdAt: dayjs_default(created_at).toISOString()
|
|
118
188
|
}));
|
|
119
189
|
const taskEntity = tasks.map(({ id, metadata }) => ({
|
|
120
190
|
id,
|
|
121
|
-
createdAt: metadata.uploaded_at,
|
|
191
|
+
createdAt: dayjs_default(metadata.uploaded_at).toISOString(),
|
|
122
192
|
name: metadata.fileName,
|
|
123
|
-
|
|
193
|
+
entityTypeName: "OCEL",
|
|
124
194
|
type: "ocel",
|
|
125
195
|
isUploading: true
|
|
126
196
|
}));
|
|
@@ -132,9 +202,158 @@ const ResourceManagementTable = () => {
|
|
|
132
202
|
}, [
|
|
133
203
|
ocels,
|
|
134
204
|
resources,
|
|
135
|
-
tasks
|
|
136
|
-
resourceMeta
|
|
205
|
+
tasks
|
|
137
206
|
]);
|
|
207
|
+
const entities = useMemo(() => {
|
|
208
|
+
const searchTerm = debouncedSearch?.trim().toLowerCase();
|
|
209
|
+
const includedTypes = new Set(includedEntityTypes);
|
|
210
|
+
const { columnAccessor, direction } = sortStatus;
|
|
211
|
+
const sign = direction === "desc" ? -1 : 1;
|
|
212
|
+
return allEntities.filter(({ name, entityTypeName }) => (!searchTerm || name.trim().toLowerCase().includes(searchTerm)) && (includedTypes.size === 0 || includedTypes.has(entityTypeName))).sort((a, b) => sign * String(a[columnAccessor] ?? "").localeCompare(String(b[columnAccessor] ?? ""), void 0, {
|
|
213
|
+
numeric: true,
|
|
214
|
+
sensitivity: "base"
|
|
215
|
+
}));
|
|
216
|
+
}, [
|
|
217
|
+
allEntities,
|
|
218
|
+
sortStatus,
|
|
219
|
+
debouncedSearch,
|
|
220
|
+
includedEntityTypes
|
|
221
|
+
]);
|
|
222
|
+
const startRename = useCallback(({ id, name }) => setRenamedEntity({
|
|
223
|
+
id,
|
|
224
|
+
value: name
|
|
225
|
+
}), []);
|
|
226
|
+
const downloadOcelAs = useCallback((id, extension) => downloadOCEL(id, { ext: extension }), [downloadOCEL]);
|
|
227
|
+
const columns = useMemo(() => [
|
|
228
|
+
{
|
|
229
|
+
accessor: "name",
|
|
230
|
+
sortable: true,
|
|
231
|
+
filter: /* @__PURE__ */ jsx(TextInput, {
|
|
232
|
+
placeholder: "Search by name ...",
|
|
233
|
+
leftSection: /* @__PURE__ */ jsx(SearchIcon, { size: 16 }),
|
|
234
|
+
rightSection: /* @__PURE__ */ jsx(ActionIcon, {
|
|
235
|
+
size: "sm",
|
|
236
|
+
variant: "transparent",
|
|
237
|
+
c: "dimmed",
|
|
238
|
+
onClick: () => setSearchedName(null),
|
|
239
|
+
children: /* @__PURE__ */ jsx(XIcon, { size: 14 })
|
|
240
|
+
}),
|
|
241
|
+
value: searchedName ?? "",
|
|
242
|
+
onChange: (value) => setSearchedName(value.currentTarget.value ?? null)
|
|
243
|
+
}),
|
|
244
|
+
filtering: !!searchedName,
|
|
245
|
+
render: ({ id, type, name, isFiltered }) => /* @__PURE__ */ jsx(Fragment, { children: renamedEntity?.id === id ? /* @__PURE__ */ jsxs(Group, { children: [/* @__PURE__ */ jsx(TextInput, {
|
|
246
|
+
variant: "unstyled",
|
|
247
|
+
value: renamedEntity.value,
|
|
248
|
+
style: { borderBottom: "1px solid #9ca3af" },
|
|
249
|
+
onChange: (e) => {
|
|
250
|
+
setRenamedEntity({
|
|
251
|
+
id,
|
|
252
|
+
value: e.target.value
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}), /* @__PURE__ */ jsxs(Group, {
|
|
256
|
+
gap: "xs",
|
|
257
|
+
children: [/* @__PURE__ */ jsx(ActionIcon, {
|
|
258
|
+
color: "green",
|
|
259
|
+
m: 0,
|
|
260
|
+
onClick: () => {
|
|
261
|
+
renameEntity(id, type, renamedEntity.value);
|
|
262
|
+
setRenamedEntity(void 0);
|
|
263
|
+
},
|
|
264
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { size: 16 })
|
|
265
|
+
}), /* @__PURE__ */ jsx(ActionIcon, {
|
|
266
|
+
color: "red",
|
|
267
|
+
m: 0,
|
|
268
|
+
onClick: () => {
|
|
269
|
+
setRenamedEntity(void 0);
|
|
270
|
+
},
|
|
271
|
+
children: /* @__PURE__ */ jsx(XIcon, { size: 16 })
|
|
272
|
+
})]
|
|
273
|
+
})] }) : /* @__PURE__ */ jsxs(Group, {
|
|
274
|
+
gap: 6,
|
|
275
|
+
wrap: "nowrap",
|
|
276
|
+
children: [name, isFiltered && /* @__PURE__ */ jsx(Tooltip, {
|
|
277
|
+
label: "This log has been filtered",
|
|
278
|
+
children: /* @__PURE__ */ jsx(FilterIcon, {
|
|
279
|
+
size: 14,
|
|
280
|
+
color: "var(--mantine-color-blue-6)"
|
|
281
|
+
})
|
|
282
|
+
})]
|
|
283
|
+
}) })
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
accessor: "createdAt",
|
|
287
|
+
sortable: true,
|
|
288
|
+
render: ({ createdAt, isUploading }) => isUploading ? "uploading" : formatDateTime(createdAt)
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
accessor: "entityTypeName",
|
|
292
|
+
sortable: true,
|
|
293
|
+
title: "Type",
|
|
294
|
+
filter: /* @__PURE__ */ jsx(MultiSelect, {
|
|
295
|
+
placeholder: "Filter by type ...",
|
|
296
|
+
data: allEntityTypes,
|
|
297
|
+
leftSection: /* @__PURE__ */ jsx(SearchIcon, { size: 16 }),
|
|
298
|
+
value: includedEntityTypes,
|
|
299
|
+
onChange: setIncludedEntityTypes,
|
|
300
|
+
clearable: true,
|
|
301
|
+
searchable: true,
|
|
302
|
+
maw: 300,
|
|
303
|
+
comboboxProps: { withinPortal: false },
|
|
304
|
+
renderOption: ({ option, checked }) => /* @__PURE__ */ jsxs(Group, {
|
|
305
|
+
gap: "xs",
|
|
306
|
+
wrap: "nowrap",
|
|
307
|
+
children: [checked && /* @__PURE__ */ jsx(CheckIcon, { size: 14 }), /* @__PURE__ */ jsx(Badge, {
|
|
308
|
+
color: generateColor(option.value),
|
|
309
|
+
children: option.label
|
|
310
|
+
})]
|
|
311
|
+
}),
|
|
312
|
+
renderPill: ({ option, onRemove, disabled }) => /* @__PURE__ */ jsx(Badge, {
|
|
313
|
+
color: generateColor(String(option.value)),
|
|
314
|
+
style: { cursor: disabled ? void 0 : "pointer" },
|
|
315
|
+
rightSection: !disabled && /* @__PURE__ */ jsx(XIcon, { size: 12 }),
|
|
316
|
+
onMouseDown: (event) => {
|
|
317
|
+
event.preventDefault();
|
|
318
|
+
onRemove?.();
|
|
319
|
+
},
|
|
320
|
+
children: option.label
|
|
321
|
+
})
|
|
322
|
+
}),
|
|
323
|
+
filtering: includedEntityTypes.length > 0,
|
|
324
|
+
render: ({ entityTypeName }) => /* @__PURE__ */ jsx(Badge, {
|
|
325
|
+
color: generateColor(entityTypeName),
|
|
326
|
+
children: entityTypeName
|
|
327
|
+
})
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
accessor: "",
|
|
331
|
+
textAlign: "right",
|
|
332
|
+
width: "0%",
|
|
333
|
+
render: (entity) => /* @__PURE__ */ jsx(EntityActionsMenu_default, {
|
|
334
|
+
entity,
|
|
335
|
+
onRename: startRename,
|
|
336
|
+
onInspect: setViewedResource,
|
|
337
|
+
onDownloadOcel: downloadOcelAs,
|
|
338
|
+
onExportAsXes: setExportOcelId,
|
|
339
|
+
onDownloadResource: downloadResource,
|
|
340
|
+
onDownloadResourceAsPnml: downloadResourceAsPnml,
|
|
341
|
+
onDelete: deleteEntity
|
|
342
|
+
})
|
|
343
|
+
}
|
|
344
|
+
], [
|
|
345
|
+
searchedName,
|
|
346
|
+
renamedEntity,
|
|
347
|
+
renameEntity,
|
|
348
|
+
allEntityTypes,
|
|
349
|
+
includedEntityTypes,
|
|
350
|
+
startRename,
|
|
351
|
+
downloadOcelAs,
|
|
352
|
+
downloadResource,
|
|
353
|
+
downloadResourceAsPnml,
|
|
354
|
+
deleteEntity
|
|
355
|
+
]);
|
|
356
|
+
const hasEntities = allEntityTypes.length > 0;
|
|
138
357
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
139
358
|
viewedResource && /* @__PURE__ */ jsx(ResourceModal, {
|
|
140
359
|
id: viewedResource,
|
|
@@ -144,140 +363,13 @@ const ResourceManagementTable = () => {
|
|
|
144
363
|
ocelId: exportOcelId,
|
|
145
364
|
onClose: () => setExportOcelId(void 0)
|
|
146
365
|
}, exportOcelId),
|
|
147
|
-
|
|
366
|
+
hasEntities ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FullScreenUpload, {}), /* @__PURE__ */ jsx(DataTable, {
|
|
148
367
|
withTableBorder: true,
|
|
149
368
|
borderRadius: "md",
|
|
150
369
|
idAccessor: "id",
|
|
151
|
-
columns
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
render: ({ id, type, name, isFiltered }) => /* @__PURE__ */ jsx(Fragment, { children: renamedEntity?.id === id ? /* @__PURE__ */ jsxs(Group, { children: [/* @__PURE__ */ jsx(TextInput, {
|
|
155
|
-
variant: "unstyled",
|
|
156
|
-
value: renamedEntity.value,
|
|
157
|
-
style: { borderBottom: "1px solid #9ca3af" },
|
|
158
|
-
onChange: (e) => {
|
|
159
|
-
setRenamedEntity({
|
|
160
|
-
id,
|
|
161
|
-
value: e.target.value
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}), /* @__PURE__ */ jsxs(Group, {
|
|
165
|
-
gap: "xs",
|
|
166
|
-
children: [/* @__PURE__ */ jsx(ActionIcon, {
|
|
167
|
-
color: "green",
|
|
168
|
-
m: 0,
|
|
169
|
-
onClick: () => {
|
|
170
|
-
renameEntity(id, type, renamedEntity.value);
|
|
171
|
-
setRenamedEntity(void 0);
|
|
172
|
-
},
|
|
173
|
-
children: /* @__PURE__ */ jsx(CheckIcon, { size: 16 })
|
|
174
|
-
}), /* @__PURE__ */ jsx(ActionIcon, {
|
|
175
|
-
color: "red",
|
|
176
|
-
m: 0,
|
|
177
|
-
onClick: () => {
|
|
178
|
-
setRenamedEntity(void 0);
|
|
179
|
-
},
|
|
180
|
-
children: /* @__PURE__ */ jsx(XIcon, { size: 16 })
|
|
181
|
-
})]
|
|
182
|
-
})] }) : /* @__PURE__ */ jsxs(Group, {
|
|
183
|
-
gap: 6,
|
|
184
|
-
wrap: "nowrap",
|
|
185
|
-
children: [name, isFiltered && /* @__PURE__ */ jsx(Tooltip, {
|
|
186
|
-
label: "This log has been filtered",
|
|
187
|
-
children: /* @__PURE__ */ jsx(FilterIcon, {
|
|
188
|
-
size: 14,
|
|
189
|
-
color: "var(--mantine-color-blue-6)"
|
|
190
|
-
})
|
|
191
|
-
})]
|
|
192
|
-
}) })
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
accessor: "createdAt",
|
|
196
|
-
render: ({ createdAt, isUploading }) => isUploading ? "uploading" : formatDateTime(createdAt)
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
accessor: "entityTypes",
|
|
200
|
-
title: "Type",
|
|
201
|
-
render: ({ type, entityTypes }) => /* @__PURE__ */ jsx(Group, {
|
|
202
|
-
gap: "xs",
|
|
203
|
-
children: [...type === "ocel" ? ["OCEL"] : [], ...entityTypes].map((entityType) => /* @__PURE__ */ jsx(Badge, {
|
|
204
|
-
color: generateColor(entityType),
|
|
205
|
-
children: entityType
|
|
206
|
-
}, entityType))
|
|
207
|
-
})
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
accessor: "",
|
|
211
|
-
textAlign: "right",
|
|
212
|
-
width: "0%",
|
|
213
|
-
render: ({ type, resourceType, id, name, isUploading }) => isUploading ? /* @__PURE__ */ jsx(Loader, { size: 20 }) : /* @__PURE__ */ jsxs(Menu, {
|
|
214
|
-
width: 200,
|
|
215
|
-
position: "left-start",
|
|
216
|
-
children: [/* @__PURE__ */ jsx(Menu.Target, { children: /* @__PURE__ */ jsx(ActionIcon, {
|
|
217
|
-
variant: "subtle",
|
|
218
|
-
onClick: (e) => e.stopPropagation(),
|
|
219
|
-
children: /* @__PURE__ */ jsx(EllipsisVerticalIcon, { size: 20 })
|
|
220
|
-
}) }), /* @__PURE__ */ jsxs(Menu.Dropdown, {
|
|
221
|
-
onClick: (e) => e.stopPropagation(),
|
|
222
|
-
children: [
|
|
223
|
-
/* @__PURE__ */ jsx(Menu.Item, {
|
|
224
|
-
leftSection: /* @__PURE__ */ jsx(PencilIcon, { size: 16 }),
|
|
225
|
-
onClick: () => setRenamedEntity({
|
|
226
|
-
id,
|
|
227
|
-
value: name
|
|
228
|
-
}),
|
|
229
|
-
children: "Rename"
|
|
230
|
-
}),
|
|
231
|
-
type === "resource" && /* @__PURE__ */ jsx(MenuItem, {
|
|
232
|
-
leftSection: /* @__PURE__ */ jsx(EyeIcon, { size: 16 }),
|
|
233
|
-
onClick: () => setViewedResource(id),
|
|
234
|
-
children: "Inspect"
|
|
235
|
-
}),
|
|
236
|
-
type === "ocel" ? /* @__PURE__ */ jsxs(Menu.Sub, {
|
|
237
|
-
position: "right-start",
|
|
238
|
-
children: [/* @__PURE__ */ jsx(Menu.Sub.Target, { children: /* @__PURE__ */ jsx(Menu.Sub.Item, {
|
|
239
|
-
leftSection: /* @__PURE__ */ jsx(DownloadIcon, { size: 16 }),
|
|
240
|
-
children: "Download"
|
|
241
|
-
}) }), /* @__PURE__ */ jsxs(Menu.Sub.Dropdown, { children: [ocelExtensions.map((extension) => /* @__PURE__ */ jsx(Menu.Item, {
|
|
242
|
-
onClick: () => downloadOCEL(id, { ext: extension }),
|
|
243
|
-
children: extension
|
|
244
|
-
}, extension)), /* @__PURE__ */ jsx(Menu.Item, {
|
|
245
|
-
onClick: () => setExportOcelId(id),
|
|
246
|
-
children: ".xes"
|
|
247
|
-
}, ".xes")] })]
|
|
248
|
-
}) : resourceType === "PetriNet" ? /* @__PURE__ */ jsxs(Menu.Sub, {
|
|
249
|
-
position: "right-start",
|
|
250
|
-
children: [/* @__PURE__ */ jsx(Menu.Sub.Target, { children: /* @__PURE__ */ jsx(Menu.Sub.Item, {
|
|
251
|
-
leftSection: /* @__PURE__ */ jsx(DownloadIcon, { size: 16 }),
|
|
252
|
-
children: "Download"
|
|
253
|
-
}) }), /* @__PURE__ */ jsxs(Menu.Sub.Dropdown, { children: [/* @__PURE__ */ jsx(Menu.Item, {
|
|
254
|
-
onClick: () => downloadResource(id),
|
|
255
|
-
children: ".ocelescope"
|
|
256
|
-
}), /* @__PURE__ */ jsx(Menu.Item, {
|
|
257
|
-
onClick: () => downloadResourceAsPnml(id),
|
|
258
|
-
children: ".pnml"
|
|
259
|
-
})] })]
|
|
260
|
-
}) : /* @__PURE__ */ jsx(Menu.Item, {
|
|
261
|
-
onClick: () => downloadResource(id),
|
|
262
|
-
leftSection: /* @__PURE__ */ jsx(DownloadIcon, { size: 16 }),
|
|
263
|
-
children: "Download"
|
|
264
|
-
}),
|
|
265
|
-
/* @__PURE__ */ jsx(Menu.Divider, {}),
|
|
266
|
-
/* @__PURE__ */ jsx(Menu.Item, {
|
|
267
|
-
leftSection: /* @__PURE__ */ jsx(TrashIcon, {
|
|
268
|
-
size: 16,
|
|
269
|
-
color: "red"
|
|
270
|
-
}),
|
|
271
|
-
color: "red",
|
|
272
|
-
fw: "bold",
|
|
273
|
-
onClick: () => deleteEntity(id, type),
|
|
274
|
-
children: "Delete"
|
|
275
|
-
})
|
|
276
|
-
]
|
|
277
|
-
})]
|
|
278
|
-
})
|
|
279
|
-
}
|
|
280
|
-
],
|
|
370
|
+
columns,
|
|
371
|
+
sortStatus,
|
|
372
|
+
onSortStatusChange: setSortStatus,
|
|
281
373
|
records: entities
|
|
282
374
|
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Title, {
|
|
283
375
|
size: "h3",
|
|
@@ -290,6 +382,7 @@ const ResourceManagementTable = () => {
|
|
|
290
382
|
const ResourceManagementPage = ({ children }) => {
|
|
291
383
|
return /* @__PURE__ */ jsx(Container, {
|
|
292
384
|
h: "100%",
|
|
385
|
+
p: "md",
|
|
293
386
|
children: /* @__PURE__ */ jsxs(Stack, {
|
|
294
387
|
gap: "sm",
|
|
295
388
|
h: "100%",
|
|
@@ -297,6 +390,11 @@ const ResourceManagementPage = ({ children }) => {
|
|
|
297
390
|
})
|
|
298
391
|
});
|
|
299
392
|
};
|
|
393
|
+
var ResourceManagementPage_default = defineModuleRoute({
|
|
394
|
+
component: ResourceManagementPage,
|
|
395
|
+
label: "Management",
|
|
396
|
+
name: "management"
|
|
397
|
+
});
|
|
300
398
|
//#endregion
|
|
301
399
|
//#region src/index.ts
|
|
302
400
|
var src_default = defineModule({
|
|
@@ -304,11 +402,7 @@ var src_default = defineModule({
|
|
|
304
402
|
description: "A tool for managing Resources and OCEL",
|
|
305
403
|
label: "Resources",
|
|
306
404
|
authors: [{ name: "Öztürk, Görkem-Emre" }],
|
|
307
|
-
routes: [
|
|
308
|
-
component: ResourceManagementPage,
|
|
309
|
-
label: "Management",
|
|
310
|
-
name: "management"
|
|
311
|
-
})]
|
|
405
|
+
routes: [ResourceManagementPage_default]
|
|
312
406
|
});
|
|
313
407
|
//#endregion
|
|
314
408
|
export { src_default as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocelescope/management",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"description": "A tool for managing Resources and OCEL",
|
|
6
6
|
"author": "Görkem-Emre Öztürk <goerkem.oeztuerk@rwth-aachen.de>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -27,24 +27,25 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@mantine/core": "^9.
|
|
30
|
+
"@mantine/core": "^9.5.1",
|
|
31
|
+
"@mantine/hooks": "^9.5.1",
|
|
31
32
|
"@marko19907/string-to-color": "*",
|
|
32
|
-
"
|
|
33
|
+
"@ocelescope/api-base": "^0.8.0",
|
|
34
|
+
"@ocelescope/core": "^0.8.0",
|
|
35
|
+
"@ocelescope/resources": "^0.8.0",
|
|
36
|
+
"dayjs": "^1.11.23",
|
|
33
37
|
"lucide-react": "^1.0.0",
|
|
34
38
|
"mantine-datatable": "^9.4.0",
|
|
35
|
-
"react": "^19.
|
|
36
|
-
"react-dom": "^19.
|
|
37
|
-
"@ocelescope/api-base": "^0.6.0",
|
|
38
|
-
"@ocelescope/resources": "^0.6.0",
|
|
39
|
-
"@ocelescope/core": "^0.6.0"
|
|
39
|
+
"react": "^19.3.0",
|
|
40
|
+
"react-dom": "^19.3.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"@tsdown/css": "^0.
|
|
43
|
-
"@types/node": "^26.
|
|
44
|
-
"@types/react": "^19.
|
|
45
|
-
"@types/react-dom": "^19.
|
|
46
|
-
"tsdown": "^0.
|
|
47
|
-
"typescript": "^
|
|
43
|
+
"@tsdown/css": "^0.23.0",
|
|
44
|
+
"@types/node": "^26.6.1",
|
|
45
|
+
"@types/react": "^19.3.0",
|
|
46
|
+
"@types/react-dom": "^19.3.0",
|
|
47
|
+
"tsdown": "^0.23.0",
|
|
48
|
+
"typescript": "^6.0.3"
|
|
48
49
|
},
|
|
49
50
|
"scripts": {
|
|
50
51
|
"build": "tsdown",
|