@ocelescope/ocelot 0.6.1 → 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 +174 -175
- package/package.json +23 -23
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { defineModule, defineModuleRoute, useCurrentOcel } from "@ocelescope/core";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { ActionIcon,
|
|
4
|
-
import { useDebouncedState,
|
|
3
|
+
import { ActionIcon, Autocomplete, Box, Divider, Flex, Group, Input, LoadingOverlay, Popover, ScrollArea, Scroller, SegmentedControl, SimpleGrid, Stack, Table, Tabs, Text, Title } from "@mantine/core";
|
|
4
|
+
import { useDebouncedState, useDisclosure } from "@mantine/hooks";
|
|
5
5
|
import { useE2o, useEventAttributes, useEventCounts, useO2o, useObjectAttributes, useObjectCounts } from "@ocelescope/api-base";
|
|
6
|
-
import {
|
|
6
|
+
import { DownloadIcon, SearchIcon } from "lucide-react";
|
|
7
7
|
import { memo, useCallback, useEffect, useMemo, useState } from "react";
|
|
8
|
+
import { DataTable } from "mantine-datatable";
|
|
8
9
|
import { keepPreviousData, useQuery } from "@tanstack/react-query";
|
|
9
10
|
import { customFetch } from "@ocelescope/api-client";
|
|
10
|
-
import { DataTable } from "mantine-datatable";
|
|
11
11
|
import { BaseEdge, Controls, EdgeLabelRenderer, Handle, MarkerType, Position, ReactFlow, ReactFlowProvider, applyNodeChanges, getSmoothStepPath, getStraightPath, useEdgesState, useInternalNode, useReactFlow } from "@xyflow/react";
|
|
12
12
|
import FileSaver from "file-saver";
|
|
13
13
|
import { toPng } from "html-to-image";
|
|
@@ -105,27 +105,31 @@ const EntityOverview = ({ attributes, relations, entityCounts, search = "" }) =>
|
|
|
105
105
|
return relationMap;
|
|
106
106
|
}, {});
|
|
107
107
|
}, [relations]);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
108
|
+
const filteredEvents = useMemo(() => {
|
|
109
|
+
const toSearch = search.toLowerCase();
|
|
110
|
+
return Object.entries(entityCounts).filter(([event, _]) => event.toLowerCase().includes(search.toLowerCase()) || relationMap[event]?.some(({ target, qualifier }) => target.toLowerCase().includes(toSearch) || qualifier.toLowerCase().includes(toSearch)) || attributes?.some(({ name, entity_type }) => event === entity_type && name.toLowerCase().includes(toSearch)));
|
|
111
|
+
}, [
|
|
112
|
+
search,
|
|
113
|
+
relationMap,
|
|
114
|
+
entityCounts,
|
|
115
|
+
attributes
|
|
116
|
+
]);
|
|
117
|
+
return /* @__PURE__ */ jsx(ScrollArea, {
|
|
118
|
+
offsetScrollbars: true,
|
|
119
|
+
children: /* @__PURE__ */ jsx(SimpleGrid, {
|
|
120
|
+
cols: {
|
|
121
|
+
base: 1,
|
|
122
|
+
sm: 2,
|
|
123
|
+
md: 4
|
|
124
|
+
},
|
|
125
|
+
children: filteredEvents.map(([name, count]) => {
|
|
126
|
+
return /* @__PURE__ */ jsx(EntityCard, {
|
|
127
|
+
count,
|
|
128
|
+
name,
|
|
129
|
+
attributeSummaries: attributes.filter(({ entity_type }) => entity_type === name) ?? [],
|
|
130
|
+
relationSummaries: relationMap[name] ?? []
|
|
131
|
+
}, name);
|
|
132
|
+
})
|
|
129
133
|
})
|
|
130
134
|
});
|
|
131
135
|
};
|
|
@@ -137,28 +141,32 @@ const EventOverview = () => {
|
|
|
137
141
|
const { data: e2o } = useE2o(id);
|
|
138
142
|
const { data: eventCounts, isLoading: isEventCountsLoading } = useEventCounts(id);
|
|
139
143
|
const [searchValue, setSearchValue] = useDebouncedState("", 200);
|
|
140
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(LoadingOverlay, { visible: isEventCountsLoading }), /* @__PURE__ */ jsxs(Stack, {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
144
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(LoadingOverlay, { visible: isEventCountsLoading }), /* @__PURE__ */ jsxs(Stack, {
|
|
145
|
+
p: "xs",
|
|
146
|
+
h: "100%",
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ jsx(Title, {
|
|
149
|
+
order: 2,
|
|
150
|
+
children: "Event Overview"
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ jsx(Text, {
|
|
153
|
+
c: "dimmed",
|
|
154
|
+
size: "sm",
|
|
155
|
+
children: "Get an overview of all event types in this log. Search through them and see how often each type occurs, what attributes it carries, and which objects it has a relation with."
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ jsx(Input, {
|
|
158
|
+
leftSection: /* @__PURE__ */ jsx(SearchIcon, {}),
|
|
159
|
+
defaultValue: searchValue,
|
|
160
|
+
onChange: (newSearch) => setSearchValue(newSearch.target.value)
|
|
161
|
+
}),
|
|
162
|
+
eventCounts && /* @__PURE__ */ jsx(EntityOverview, {
|
|
163
|
+
relations: e2o?.response ?? [],
|
|
164
|
+
entityCounts: eventCounts,
|
|
165
|
+
attributes: eventsAttributes,
|
|
166
|
+
search: searchValue
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
})] });
|
|
162
170
|
};
|
|
163
171
|
var eventOverview_default = defineModuleRoute({
|
|
164
172
|
component: EventOverview,
|
|
@@ -172,7 +180,7 @@ const customFetch$1 = async (config, options) => customFetch(config, options);
|
|
|
172
180
|
//#endregion
|
|
173
181
|
//#region src/api/base.ts
|
|
174
182
|
/**
|
|
175
|
-
* Generated by orval
|
|
183
|
+
* Generated by orval 🍺
|
|
176
184
|
* Do not edit manually.
|
|
177
185
|
* Ocelot
|
|
178
186
|
* OpenAPI spec version: 1.0
|
|
@@ -220,7 +228,8 @@ const getPaginatedEventsQueryOptions = (ocelId, params, options) => {
|
|
|
220
228
|
*/
|
|
221
229
|
function usePaginatedEvents(ocelId, params, options, queryClient) {
|
|
222
230
|
const queryOptions = getPaginatedEventsQueryOptions(ocelId, params, options);
|
|
223
|
-
|
|
231
|
+
const query = useQuery(queryOptions, queryClient);
|
|
232
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
224
233
|
}
|
|
225
234
|
/**
|
|
226
235
|
* @summary Get Objects
|
|
@@ -253,7 +262,8 @@ const getPaginatedObjectsQueryOptions = (ocelId, params, options) => {
|
|
|
253
262
|
*/
|
|
254
263
|
function usePaginatedObjects(ocelId, params, options, queryClient) {
|
|
255
264
|
const queryOptions = getPaginatedObjectsQueryOptions(ocelId, params, options);
|
|
256
|
-
|
|
265
|
+
const query = useQuery(queryOptions, queryClient);
|
|
266
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
257
267
|
}
|
|
258
268
|
/**
|
|
259
269
|
* @summary Get Object Columns
|
|
@@ -286,7 +296,8 @@ const getObjectColumnsQueryOptions = (ocelId, params, options) => {
|
|
|
286
296
|
*/
|
|
287
297
|
function useObjectColumns(ocelId, params, options, queryClient) {
|
|
288
298
|
const queryOptions = getObjectColumnsQueryOptions(ocelId, params, options);
|
|
289
|
-
|
|
299
|
+
const query = useQuery(queryOptions, queryClient);
|
|
300
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
290
301
|
}
|
|
291
302
|
/**
|
|
292
303
|
* @summary Get Activity Columns
|
|
@@ -319,12 +330,30 @@ const getActivityColumnsQueryOptions = (ocelId, params, options) => {
|
|
|
319
330
|
*/
|
|
320
331
|
function useActivityColumns(ocelId, params, options, queryClient) {
|
|
321
332
|
const queryOptions = getActivityColumnsQueryOptions(ocelId, params, options);
|
|
322
|
-
|
|
333
|
+
const query = useQuery(queryOptions, queryClient);
|
|
334
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
323
335
|
}
|
|
324
336
|
//#endregion
|
|
325
337
|
//#region src/components/EntityTable.tsx
|
|
326
|
-
const EntityTable = ({
|
|
327
|
-
const
|
|
338
|
+
const EntityTable = ({ type, ocelId, entityName }) => {
|
|
339
|
+
const areEntitiesEvents = type === "events";
|
|
340
|
+
const [page, setPage] = useState(1);
|
|
341
|
+
const [sort, setSort] = useState(void 0);
|
|
342
|
+
const [pageSize, setPageSize] = useState(20);
|
|
343
|
+
const { data: entities } = (areEntitiesEvents ? usePaginatedEvents : usePaginatedObjects)(ocelId, {
|
|
344
|
+
type: entityName,
|
|
345
|
+
page_size: pageSize,
|
|
346
|
+
page,
|
|
347
|
+
...sort && {
|
|
348
|
+
sort_by: sort.columnAccessor,
|
|
349
|
+
ascending: sort.direction === "asc"
|
|
350
|
+
}
|
|
351
|
+
}, { query: {
|
|
352
|
+
placeholderData: keepPreviousData,
|
|
353
|
+
staleTime: 5e3
|
|
354
|
+
} });
|
|
355
|
+
const { data: columns = [] } = (areEntitiesEvents ? useActivityColumns : useObjectColumns)(ocelId, { type_name: entityName });
|
|
356
|
+
const records = useMemo(() => entities?.items.map((entity) => ({
|
|
328
357
|
...entity,
|
|
329
358
|
...entity.attributes,
|
|
330
359
|
...Object.assign({}, ...Object.entries(entity.relations).map(([qualifierName, entityIds]) => ({ [qualifierName]: entityIds.join(", ") })))
|
|
@@ -334,11 +363,12 @@ const EntityTable = ({ entities, columns, onPageChange, onPageSizeChange, sortSt
|
|
|
334
363
|
render: (record) => record[column.accessor],
|
|
335
364
|
sortable: column.type === "attribute"
|
|
336
365
|
})), [columns]);
|
|
337
|
-
return /* @__PURE__ */ jsx(DataTable, {
|
|
366
|
+
return entities ? /* @__PURE__ */ jsx(DataTable, {
|
|
367
|
+
height: "100%",
|
|
338
368
|
page: entities.page,
|
|
339
369
|
totalRecords: entities.total_items,
|
|
340
370
|
recordsPerPage: entities.page_size,
|
|
341
|
-
onPageChange,
|
|
371
|
+
onPageChange: setPage,
|
|
342
372
|
withColumnBorders: true,
|
|
343
373
|
columns: transformedColumns,
|
|
344
374
|
records,
|
|
@@ -347,104 +377,25 @@ const EntityTable = ({ entities, columns, onPageChange, onPageSizeChange, sortSt
|
|
|
347
377
|
40,
|
|
348
378
|
50
|
|
349
379
|
],
|
|
350
|
-
onRecordsPerPageChange:
|
|
351
|
-
sortStatus:
|
|
380
|
+
onRecordsPerPageChange: setPageSize,
|
|
381
|
+
sortStatus: sort ?? {
|
|
352
382
|
columnAccessor: "id",
|
|
353
383
|
direction: "asc"
|
|
354
384
|
},
|
|
355
|
-
onSortStatusChange:
|
|
356
|
-
});
|
|
357
|
-
};
|
|
358
|
-
//#endregion
|
|
359
|
-
//#region src/components/SingleLineTabs/SingleLineTabs.tsx
|
|
360
|
-
const SingleLineTabs = ({ setCurrentTab, currentTab, tabs }) => {
|
|
361
|
-
const currentTabIndex = useMemo(() => tabs.findIndex((tab) => tab.value === currentTab), [currentTab, tabs]);
|
|
362
|
-
const { targetRef, scrollableRef, scrollIntoView } = useScrollIntoView({
|
|
363
|
-
axis: "x",
|
|
364
|
-
duration: 0
|
|
365
|
-
});
|
|
366
|
-
const onChangeCurrentTab = useCallback((newTab) => {
|
|
367
|
-
setCurrentTab(newTab);
|
|
368
|
-
scrollIntoView({ alignment: "center" });
|
|
369
|
-
}, [scrollIntoView, setCurrentTab]);
|
|
370
|
-
return /* @__PURE__ */ jsxs(Flex, {
|
|
371
|
-
align: "center",
|
|
372
|
-
justify: "center",
|
|
373
|
-
children: [
|
|
374
|
-
/* @__PURE__ */ jsx(Button, {
|
|
375
|
-
variant: "subtle",
|
|
376
|
-
onClick: () => {
|
|
377
|
-
onChangeCurrentTab(tabs[Math.max(0, currentTabIndex - 1)].value);
|
|
378
|
-
},
|
|
379
|
-
disabled: currentTabIndex === 0,
|
|
380
|
-
children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
|
|
381
|
-
}),
|
|
382
|
-
/* @__PURE__ */ jsx(ScrollArea, {
|
|
383
|
-
w: "100%",
|
|
384
|
-
scrollbars: false,
|
|
385
|
-
viewportRef: scrollableRef,
|
|
386
|
-
children: /* @__PURE__ */ jsx(Tabs, {
|
|
387
|
-
variant: "default",
|
|
388
|
-
value: currentTab,
|
|
389
|
-
onChange: (newTab) => {
|
|
390
|
-
if (newTab) onChangeCurrentTab(newTab);
|
|
391
|
-
},
|
|
392
|
-
children: /* @__PURE__ */ jsx(Tabs.List, {
|
|
393
|
-
style: {
|
|
394
|
-
flexWrap: "unset",
|
|
395
|
-
minWidth: "max-content"
|
|
396
|
-
},
|
|
397
|
-
grow: true,
|
|
398
|
-
justify: "space-between",
|
|
399
|
-
children: tabs.map((tab) => /* @__PURE__ */ jsx(Tabs.Tab, {
|
|
400
|
-
value: tab.value,
|
|
401
|
-
ref: currentTab === tab.value ? targetRef : void 0,
|
|
402
|
-
children: tab.label
|
|
403
|
-
}, tab.value))
|
|
404
|
-
})
|
|
405
|
-
})
|
|
406
|
-
}),
|
|
407
|
-
/* @__PURE__ */ jsx(Button, {
|
|
408
|
-
variant: "subtle",
|
|
409
|
-
onClick: () => {
|
|
410
|
-
onChangeCurrentTab(tabs[Math.min(tabs.length - 1, currentTabIndex + 1)].value);
|
|
411
|
-
},
|
|
412
|
-
disabled: currentTabIndex === tabs.length - 1,
|
|
413
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
414
|
-
})
|
|
415
|
-
]
|
|
416
|
-
});
|
|
385
|
+
onSortStatusChange: setSort
|
|
386
|
+
}) : /* @__PURE__ */ jsx(LoadingOverlay, { visible: true });
|
|
417
387
|
};
|
|
418
388
|
//#endregion
|
|
419
389
|
//#region src/components/EntityPage.tsx
|
|
420
390
|
const EntityPage = ({ ocelId, type, title, description }) => {
|
|
421
|
-
const
|
|
422
|
-
const
|
|
423
|
-
const [
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
type: currentTab ?? "",
|
|
430
|
-
page_size: pageSize,
|
|
431
|
-
page,
|
|
432
|
-
...sort && {
|
|
433
|
-
sort_by: sort.columnAccessor,
|
|
434
|
-
ascending: sort.direction === "asc"
|
|
435
|
-
}
|
|
436
|
-
}, { query: {
|
|
437
|
-
enabled: !!currentTab,
|
|
438
|
-
placeholderData: keepPreviousData,
|
|
439
|
-
staleTime: 5e3
|
|
440
|
-
} });
|
|
441
|
-
const { data } = (areEntitiesEvents ? useActivityColumns : useObjectColumns)(ocelId, { type_name: currentTab ?? "" }, { query: { enabled: !!currentTab } });
|
|
442
|
-
useEffect(() => {
|
|
443
|
-
if (!currentTab && entityNames.length > 0) setCurrentTab(entityNames[0]);
|
|
444
|
-
}, [currentTab, entityNames]);
|
|
445
|
-
if (entityNames.length === 0) return null;
|
|
446
|
-
return /* @__PURE__ */ jsxs(Flex, {
|
|
447
|
-
direction: "column",
|
|
391
|
+
const { data: entityCounts, isLoading } = (type === "events" ? useEventCounts : useObjectCounts)(ocelId);
|
|
392
|
+
const [activeTab, setActiveTab] = useState(null);
|
|
393
|
+
const [searchOpened, { close: closeSearch, toggle: toggleSearch }] = useDisclosure(false);
|
|
394
|
+
const entityNames = useMemo(() => Object.keys(entityCounts ?? []), [entityCounts]);
|
|
395
|
+
return /* @__PURE__ */ jsxs(Stack, {
|
|
396
|
+
gap: "xs",
|
|
397
|
+
p: "xs",
|
|
398
|
+
pos: "relative",
|
|
448
399
|
h: "100%",
|
|
449
400
|
children: [
|
|
450
401
|
title && /* @__PURE__ */ jsx(Title, {
|
|
@@ -457,27 +408,71 @@ const EntityPage = ({ ocelId, type, title, description }) => {
|
|
|
457
408
|
mb: "xs",
|
|
458
409
|
children: description
|
|
459
410
|
}),
|
|
460
|
-
/* @__PURE__ */
|
|
461
|
-
|
|
411
|
+
entityCounts && /* @__PURE__ */ jsxs(Tabs, {
|
|
412
|
+
keepMounted: false,
|
|
413
|
+
value: activeTab ?? entityNames[0],
|
|
414
|
+
onChange: setActiveTab,
|
|
415
|
+
flex: 1,
|
|
416
|
+
mih: 0,
|
|
417
|
+
display: "flex",
|
|
418
|
+
style: { flexDirection: "column" },
|
|
419
|
+
children: [/* @__PURE__ */ jsxs(Group, {
|
|
420
|
+
wrap: "nowrap",
|
|
421
|
+
gap: "0",
|
|
422
|
+
style: { flexShrink: 0 },
|
|
423
|
+
children: [/* @__PURE__ */ jsxs(Popover, {
|
|
424
|
+
width: 300,
|
|
425
|
+
position: "bottom-start",
|
|
426
|
+
withArrow: true,
|
|
427
|
+
shadow: "md",
|
|
428
|
+
opened: searchOpened,
|
|
429
|
+
onChange: closeSearch,
|
|
430
|
+
trapFocus: true,
|
|
431
|
+
returnFocus: true,
|
|
432
|
+
children: [/* @__PURE__ */ jsx(Popover.Target, { children: /* @__PURE__ */ jsx(ActionIcon, {
|
|
433
|
+
size: "lg",
|
|
434
|
+
h: "100%",
|
|
435
|
+
onClick: toggleSearch,
|
|
436
|
+
"aria-label": `Search ${type} types`,
|
|
437
|
+
bdrs: 0,
|
|
438
|
+
children: /* @__PURE__ */ jsx(SearchIcon, { size: 16 })
|
|
439
|
+
}) }), /* @__PURE__ */ jsx(Popover.Dropdown, { children: /* @__PURE__ */ jsx(Autocomplete, {
|
|
440
|
+
data: entityNames,
|
|
441
|
+
"aria-label": `${type} type`,
|
|
442
|
+
placeholder: `Search ${type} types`,
|
|
443
|
+
selectFirstOptionOnChange: true,
|
|
444
|
+
comboboxProps: { withinPortal: false },
|
|
445
|
+
onOptionSubmit: (value) => {
|
|
446
|
+
setActiveTab(value);
|
|
447
|
+
closeSearch();
|
|
448
|
+
}
|
|
449
|
+
}) })]
|
|
450
|
+
}), /* @__PURE__ */ jsx(Tabs.List, {
|
|
451
|
+
flex: 1,
|
|
452
|
+
miw: 0,
|
|
453
|
+
children: /* @__PURE__ */ jsx(Scroller, { children: Object.entries(entityCounts ?? {}).map(([entityName, count]) => /* @__PURE__ */ jsxs(Tabs.Tab, {
|
|
454
|
+
value: entityName,
|
|
455
|
+
children: [
|
|
456
|
+
entityName,
|
|
457
|
+
" (",
|
|
458
|
+
count,
|
|
459
|
+
")"
|
|
460
|
+
]
|
|
461
|
+
}, entityName)) })
|
|
462
|
+
})]
|
|
463
|
+
}), entityNames.map((entityName) => /* @__PURE__ */ jsx(Tabs.Panel, {
|
|
462
464
|
value: entityName,
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
465
|
+
pos: "relative",
|
|
466
|
+
flex: 1,
|
|
467
|
+
mih: 0,
|
|
468
|
+
children: /* @__PURE__ */ jsx(EntityTable, {
|
|
469
|
+
type,
|
|
470
|
+
ocelId,
|
|
471
|
+
entityName
|
|
472
|
+
})
|
|
473
|
+
}, entityName))]
|
|
471
474
|
}),
|
|
472
|
-
|
|
473
|
-
entities,
|
|
474
|
-
columns: data ?? [],
|
|
475
|
-
withTimestamp: type === "events",
|
|
476
|
-
onPageChange: (newPage) => setPage(newPage),
|
|
477
|
-
onPageSizeChange: (newPageSize) => setPageSize(newPageSize),
|
|
478
|
-
sortStatus: sort,
|
|
479
|
-
onStartStatusChange: (sortStatus) => setSort(sortStatus)
|
|
480
|
-
})
|
|
475
|
+
/* @__PURE__ */ jsx(LoadingOverlay, { visible: isLoading })
|
|
481
476
|
]
|
|
482
477
|
});
|
|
483
478
|
};
|
|
@@ -759,7 +754,7 @@ const useDagreLayout = () => {
|
|
|
759
754
|
});
|
|
760
755
|
for (const edge of getEdges()) dagreGraph.setEdge(edge.source, edge.target);
|
|
761
756
|
dagre.layout(dagreGraph);
|
|
762
|
-
|
|
757
|
+
const positionedNodes = nodes.map((node) => {
|
|
763
758
|
const { x, y } = dagreGraph.node(node.id);
|
|
764
759
|
return {
|
|
765
760
|
...node,
|
|
@@ -768,7 +763,8 @@ const useDagreLayout = () => {
|
|
|
768
763
|
y
|
|
769
764
|
}
|
|
770
765
|
};
|
|
771
|
-
})
|
|
766
|
+
});
|
|
767
|
+
setNodes(positionedNodes);
|
|
772
768
|
await fitView();
|
|
773
769
|
}, [
|
|
774
770
|
getNodes,
|
|
@@ -954,7 +950,8 @@ const layoutToHook = {
|
|
|
954
950
|
const handleDownload = async (fileName) => {
|
|
955
951
|
const flow = document.querySelector(".react-flow__viewport");
|
|
956
952
|
if (!flow) return;
|
|
957
|
-
|
|
953
|
+
const dataUrl = await toPng(flow, { backgroundColor: "white" });
|
|
954
|
+
saveAs(dataUrl, `${fileName}.png`);
|
|
958
955
|
};
|
|
959
956
|
const InnerFlow = ({ initialNodes, initialEdges, layoutOptions = { type: "dagre" } }) => {
|
|
960
957
|
const [nodes, setNodes] = useState(initialNodes.map((node) => ({
|
|
@@ -1075,6 +1072,7 @@ const ObjectGraph = () => {
|
|
|
1075
1072
|
return /* @__PURE__ */ jsxs(Stack, {
|
|
1076
1073
|
w: "100%",
|
|
1077
1074
|
h: "100%",
|
|
1075
|
+
p: "xs",
|
|
1078
1076
|
children: [
|
|
1079
1077
|
/* @__PURE__ */ jsx(Title, {
|
|
1080
1078
|
order: 2,
|
|
@@ -1148,6 +1146,12 @@ const ObjectPage = () => {
|
|
|
1148
1146
|
description: "Browse the individual objects in this log. Pick an object type to see its records in a table, with their attributes and the objects they have a relation with."
|
|
1149
1147
|
}, id);
|
|
1150
1148
|
};
|
|
1149
|
+
var objects_default = defineModuleRoute({
|
|
1150
|
+
component: ObjectPage,
|
|
1151
|
+
label: "Objects",
|
|
1152
|
+
name: "objects",
|
|
1153
|
+
requiresOcel: true
|
|
1154
|
+
});
|
|
1151
1155
|
//#endregion
|
|
1152
1156
|
//#region src/index.ts
|
|
1153
1157
|
var src_default = defineModule({
|
|
@@ -1157,12 +1161,7 @@ var src_default = defineModule({
|
|
|
1157
1161
|
authors: [{ name: "Öztürk, Görkem-Emre" }],
|
|
1158
1162
|
routes: [
|
|
1159
1163
|
events_default,
|
|
1160
|
-
|
|
1161
|
-
component: ObjectPage,
|
|
1162
|
-
label: "Objects",
|
|
1163
|
-
name: "objects",
|
|
1164
|
-
requiresOcel: true
|
|
1165
|
-
}),
|
|
1164
|
+
objects_default,
|
|
1166
1165
|
eventOverview_default,
|
|
1167
1166
|
objectOverview_default
|
|
1168
1167
|
],
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocelescope/ocelot",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"description": "A module for inspections of OCELs",
|
|
6
6
|
"author": "Görkem-Emre Öztürk <goerkem.oeztuerk@rwth-aachen.de>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -29,36 +29,36 @@
|
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@dagrejs/dagre": "^3.0.0",
|
|
32
|
-
"@mantine/core": "^9.
|
|
33
|
-
"@mantine/hooks": "^9.
|
|
34
|
-
"@ocelescope/api-base": "^0.
|
|
35
|
-
"@ocelescope/
|
|
32
|
+
"@mantine/core": "^9.5.1",
|
|
33
|
+
"@mantine/hooks": "^9.5.1",
|
|
34
|
+
"@ocelescope/api-base": "^0.8.0",
|
|
35
|
+
"@ocelescope/api-client": "^0.8.0",
|
|
36
|
+
"@ocelescope/core": "^0.8.0",
|
|
36
37
|
"@tanstack/react-query": "^5.90.21",
|
|
37
|
-
"@xyflow/react": "^12.
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"@xyflow/react": "^12.11.3",
|
|
39
|
+
"axios": "^1.20.0",
|
|
40
|
+
"dayjs": "^1.11.23",
|
|
41
|
+
"elkjs": "^0.12.0",
|
|
40
42
|
"file-saver": "^2.0.5",
|
|
41
43
|
"html-to-image": "1.11.13",
|
|
42
44
|
"lucide-react": "^1.0.0",
|
|
43
|
-
"mantine-datatable": "^9.
|
|
44
|
-
"react": "^19.
|
|
45
|
-
"react-dom": "^19.
|
|
46
|
-
"recharts": "^3.2.1"
|
|
47
|
-
"axios": "^1.18.0",
|
|
48
|
-
"@ocelescope/api-client": "^0.6.0"
|
|
45
|
+
"mantine-datatable": "^9.4.0",
|
|
46
|
+
"react": "^19.3.0",
|
|
47
|
+
"react-dom": "^19.3.0",
|
|
48
|
+
"recharts": "^3.2.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"@types/css-modules": "^1.0.5",
|
|
51
|
+
"@ocelescope/api-config": "^0.8.0",
|
|
53
52
|
"@tsconfig/strictest": "^2.0.8",
|
|
53
|
+
"@tsdown/css": "^0.23.0",
|
|
54
|
+
"@types/css-modules": "^1.0.5",
|
|
54
55
|
"@types/file-saver": "^2.0.7",
|
|
55
|
-
"@types/node": "^
|
|
56
|
-
"@types/react": "^19.
|
|
57
|
-
"@types/react-dom": "^19.
|
|
58
|
-
"
|
|
59
|
-
"tsdown": "^0.
|
|
60
|
-
"typescript": "^
|
|
61
|
-
"orval": "^8.5.2"
|
|
56
|
+
"@types/node": "^26.6.1",
|
|
57
|
+
"@types/react": "^19.3.0",
|
|
58
|
+
"@types/react-dom": "^19.3.0",
|
|
59
|
+
"orval": "^8.33.0",
|
|
60
|
+
"tsdown": "^0.23.0",
|
|
61
|
+
"typescript": "^6.0.3"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"dev": "tsdown --watch ./src",
|