@ocelescope/filter 0.7.0 → 0.9.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 +63 -45
- package/package.json +16 -16
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AttributesTable, RelationTable, defineModule, defineModuleRoute, useCurrentOcel, useInvalidate } from "@ocelescope/core";
|
|
2
2
|
import { CheckIcon, FilterIcon, PlusIcon, RotateCcwIcon, Trash2Icon, XIcon } from "lucide-react";
|
|
3
|
-
import { ActionIcon, ActionIconGroup, Box, Grid, Group, LoadingOverlay, MultiSelect, NumberInput, Paper, RangeSlider, ScrollArea, Stack, Switch, Tabs, Text, TextInput } from "@mantine/core";
|
|
3
|
+
import { ActionIcon, ActionIconGroup, Box, Grid, Group, LoadingOverlay, MultiSelect, NumberInput, Paper, RangeSlider, ScrollArea, Scroller, Stack, Switch, Tabs, Text, TextInput } from "@mantine/core";
|
|
4
4
|
import hash from "object-hash";
|
|
5
5
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
6
6
|
import { customFetch } from "@ocelescope/api-client";
|
|
@@ -80,8 +80,9 @@ const setFilter = (ocelId, timeFrameFilterActivityFilterObjectTypeFilterEventAtt
|
|
|
80
80
|
signal
|
|
81
81
|
}, options);
|
|
82
82
|
};
|
|
83
|
+
const getSetFilterMutationKey = () => ["setFilter"];
|
|
83
84
|
const getSetFilterMutationOptions = (options) => {
|
|
84
|
-
const mutationKey =
|
|
85
|
+
const mutationKey = getSetFilterMutationKey();
|
|
85
86
|
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
86
87
|
...options,
|
|
87
88
|
mutation: {
|
|
@@ -572,22 +573,23 @@ var dayjs_default = dayjs;
|
|
|
572
573
|
//#endregion
|
|
573
574
|
//#region src/components/FilterViews/TimeFrameFilter.tsx
|
|
574
575
|
const TimeGraph = memo(({ timeInfo, startDate, endDate }) => {
|
|
576
|
+
const data = useMemo(() => {
|
|
577
|
+
return timeInfo.date_distribution.map(({ start_timestamp, end_timestamp, entity_count }) => {
|
|
578
|
+
const isInRange = (!startDate || dayjs_default(end_timestamp).isAfter(dayjs_default(startDate))) && (!endDate || dayjs_default(start_timestamp).isBefore(dayjs_default(endDate)));
|
|
579
|
+
return {
|
|
580
|
+
date: `${dayjs_default(start_timestamp).format("YYYY-MM-DD HH:mm")}-${dayjs_default(end_timestamp).format("YYYY-MM-DD HH:mm")} `,
|
|
581
|
+
...isInRange ? { value: Object.values(entity_count).reduce((acc, curr) => acc + curr, 0) } : { disabledValue: Object.values(entity_count).reduce((acc, curr) => acc + curr, 0) }
|
|
582
|
+
};
|
|
583
|
+
});
|
|
584
|
+
}, [
|
|
585
|
+
timeInfo,
|
|
586
|
+
startDate,
|
|
587
|
+
endDate
|
|
588
|
+
]);
|
|
575
589
|
return /* @__PURE__ */ jsx(BarChart, {
|
|
576
590
|
h: 300,
|
|
577
591
|
w: "100%",
|
|
578
|
-
data
|
|
579
|
-
return timeInfo.date_distribution.map(({ start_timestamp, end_timestamp, entity_count }) => {
|
|
580
|
-
const isInRange = (!startDate || dayjs_default(end_timestamp).isAfter(dayjs_default(startDate))) && (!endDate || dayjs_default(start_timestamp).isBefore(dayjs_default(endDate)));
|
|
581
|
-
return {
|
|
582
|
-
date: `${dayjs_default(start_timestamp).format("YYYY-MM-DD HH:mm")}-${dayjs_default(end_timestamp).format("YYYY-MM-DD HH:mm")} `,
|
|
583
|
-
...isInRange ? { value: Object.values(entity_count).reduce((acc, curr) => acc + curr, 0) } : { disabledValue: Object.values(entity_count).reduce((acc, curr) => acc + curr, 0) }
|
|
584
|
-
};
|
|
585
|
-
});
|
|
586
|
-
}, [
|
|
587
|
-
timeInfo,
|
|
588
|
-
startDate,
|
|
589
|
-
endDate
|
|
590
|
-
]),
|
|
592
|
+
data,
|
|
591
593
|
dataKey: "date",
|
|
592
594
|
type: "stacked",
|
|
593
595
|
series: [{
|
|
@@ -949,34 +951,49 @@ const FilterForm = ({ ocelId, currentFilter, onSubmit }) => {
|
|
|
949
951
|
value: currentTab,
|
|
950
952
|
onChange: (newTab) => setCurrentTab(newTab),
|
|
951
953
|
keepMounted: false,
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
954
|
+
style: {
|
|
955
|
+
display: "flex",
|
|
956
|
+
flexDirection: "column"
|
|
957
|
+
},
|
|
958
|
+
h: "100%",
|
|
959
|
+
children: [/* @__PURE__ */ jsxs(Group, {
|
|
960
|
+
py: "xs",
|
|
961
|
+
gap: 0,
|
|
962
|
+
wrap: "nowrap",
|
|
963
|
+
children: [/* @__PURE__ */ jsx(Tabs.List, {
|
|
964
|
+
flex: 1,
|
|
965
|
+
miw: 0,
|
|
966
|
+
children: /* @__PURE__ */ jsx(Scroller, { children: Object.entries(FILTER_MAP).map(([key, { title }]) => /* @__PURE__ */ jsx(Tabs.Tab, {
|
|
967
|
+
value: key,
|
|
968
|
+
children: title
|
|
969
|
+
}, key)) })
|
|
970
|
+
}), /* @__PURE__ */ jsxs(ActionIconGroup, { children: [formState.isDirty && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ActionIcon, {
|
|
971
|
+
onClick: handleSubmit((data) => {
|
|
972
|
+
onSubmit?.(cleanUpFilters(data));
|
|
973
|
+
}),
|
|
974
|
+
size: "lg",
|
|
975
|
+
color: "green",
|
|
976
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { size: 24 })
|
|
977
|
+
}), /* @__PURE__ */ jsx(ActionIcon, {
|
|
978
|
+
size: "lg",
|
|
979
|
+
color: "yellow",
|
|
980
|
+
onClick: () => reset(generateDefaultFilter(currentFilter)),
|
|
981
|
+
children: /* @__PURE__ */ jsx(RotateCcwIcon, { size: 24 })
|
|
982
|
+
})] }), currentFilter.length > 0 && /* @__PURE__ */ jsx(ActionIcon, {
|
|
983
|
+
size: "lg",
|
|
984
|
+
color: "red",
|
|
985
|
+
onClick: () => onSubmit?.([]),
|
|
986
|
+
children: /* @__PURE__ */ jsx(Trash2Icon, { size: 24 })
|
|
987
|
+
})] })]
|
|
988
|
+
}), Object.entries(FILTER_MAP).map(([key, { ViewComponent, description }]) => /* @__PURE__ */ jsx(Tabs.Panel, {
|
|
976
989
|
value: key,
|
|
977
990
|
p: "md",
|
|
991
|
+
flex: 1,
|
|
992
|
+
mih: 0,
|
|
993
|
+
style: { overflow: "auto" },
|
|
978
994
|
children: /* @__PURE__ */ jsxs(Stack, {
|
|
979
995
|
gap: "md",
|
|
996
|
+
h: "100%",
|
|
980
997
|
children: [/* @__PURE__ */ jsxs(Text, {
|
|
981
998
|
size: "sm",
|
|
982
999
|
c: "dimmed",
|
|
@@ -1008,6 +1025,12 @@ const FilterPage = () => {
|
|
|
1008
1025
|
})
|
|
1009
1026
|
}, hash(filterPipeline)), /* @__PURE__ */ jsx(LoadingOverlay, { visible: status === "pending" })] });
|
|
1010
1027
|
};
|
|
1028
|
+
var FilterPage_default = defineModuleRoute({
|
|
1029
|
+
component: FilterPage,
|
|
1030
|
+
label: "Filter",
|
|
1031
|
+
name: "filter",
|
|
1032
|
+
requiresOcel: true
|
|
1033
|
+
});
|
|
1011
1034
|
//#endregion
|
|
1012
1035
|
//#region src/index.ts
|
|
1013
1036
|
var src_default = defineModule({
|
|
@@ -1015,12 +1038,7 @@ var src_default = defineModule({
|
|
|
1015
1038
|
description: "Filter functionality provided by the ocelescope package",
|
|
1016
1039
|
label: "Log Filter",
|
|
1017
1040
|
authors: [{ name: "Öztürk, Görkem-Emre" }],
|
|
1018
|
-
routes: [
|
|
1019
|
-
component: FilterPage,
|
|
1020
|
-
label: "Filter",
|
|
1021
|
-
name: "filter",
|
|
1022
|
-
requiresOcel: true
|
|
1023
|
-
})],
|
|
1041
|
+
routes: [FilterPage_default],
|
|
1024
1042
|
icon: FilterIcon
|
|
1025
1043
|
});
|
|
1026
1044
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocelescope/filter",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.0",
|
|
5
5
|
"description": "A module for basic filtering of OCELs",
|
|
6
6
|
"author": "Görkem-Emre Öztürk <goerkem.oeztuerk@rwth-aachen.de>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,30 +33,30 @@
|
|
|
33
33
|
"@mantine/dates": "^9.5.1",
|
|
34
34
|
"@mantine/hooks": "^9.5.1",
|
|
35
35
|
"@mantine/notifications": "^9.5.1",
|
|
36
|
+
"@ocelescope/api-base": "^0.9.0",
|
|
37
|
+
"@ocelescope/api-client": "^0.9.0",
|
|
38
|
+
"@ocelescope/core": "^0.9.0",
|
|
36
39
|
"@tanstack/react-query": "^5.90.21",
|
|
37
|
-
"axios": "^1.
|
|
38
|
-
"dayjs": "^1.11.
|
|
40
|
+
"axios": "^1.20.0",
|
|
41
|
+
"dayjs": "^1.11.23",
|
|
39
42
|
"lucide-react": "^1.0.0",
|
|
40
43
|
"mantine-datatable": "^9.4.0",
|
|
41
|
-
"next": "16.3.
|
|
44
|
+
"next": "16.3.6",
|
|
42
45
|
"object-hash": "^3.0.0",
|
|
43
|
-
"react": "^19.
|
|
44
|
-
"react-dom": "^19.
|
|
46
|
+
"react": "^19.3.0",
|
|
47
|
+
"react-dom": "^19.3.0",
|
|
45
48
|
"react-hook-form": "^7.71.2",
|
|
46
|
-
"recharts": "^3.2.1"
|
|
47
|
-
"@ocelescope/api-base": "^0.7.0",
|
|
48
|
-
"@ocelescope/api-client": "^0.7.0",
|
|
49
|
-
"@ocelescope/core": "^0.7.0"
|
|
49
|
+
"recharts": "^3.2.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@mantine/notifications": "^9.5.1",
|
|
53
|
-
"@
|
|
53
|
+
"@ocelescope/api-config": "^0.9.0",
|
|
54
|
+
"@types/node": "^26.6.1",
|
|
54
55
|
"@types/object-hash": "^3.0.6",
|
|
55
|
-
"@types/react": "^19.
|
|
56
|
-
"@types/react-dom": "^19.
|
|
57
|
-
"tsdown": "^0.
|
|
58
|
-
"typescript": "^6.0.3"
|
|
59
|
-
"@ocelescope/api-config": "^0.7.0"
|
|
56
|
+
"@types/react": "^19.3.0",
|
|
57
|
+
"@types/react-dom": "^19.3.0",
|
|
58
|
+
"tsdown": "^0.23.0",
|
|
59
|
+
"typescript": "^6.0.3"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "orval && tsdown",
|