@ocelescope/plugin 0.1.2 → 0.5.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.
Files changed (2) hide show
  1. package/dist/index.js +112 -65
  2. package/package.json +20 -22
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { BarList, FileDropzone, OcelSelect, defineModule, defineModuleRoute, env, getModuleRoute } from "@ocelescope/core";
1
+ import { BarList, FileDropzone, FullScreenUpload, OcelSelect, defineModule, defineModuleRoute, env, getModuleRoute, useInvalidate } from "@ocelescope/core";
2
2
  import { CheckIcon, Columns2Icon, DatabaseIcon, DownloadIcon, EllipsisVertical, PuzzleIcon, Rows2Icon, Trash2Icon, UploadIcon } from "lucide-react";
3
3
  import { useRouter } from "next/router.js";
4
- import { ActionIcon, Anchor, Badge, Box, Breadcrumbs, Button, Card, Center, Container, Flex, Group, Loader, LoadingOverlay, Menu, Modal, MultiSelect, ScrollArea, Select, SimpleGrid, Splitter, Stack, Text, ThemeIcon, Title, Tooltip } from "@mantine/core";
5
- import { useDeletePlugin, useDownloadPluginResults, useEventAttributes, useEventCounts, useEventIds, useGetComputedValues, useGetExtensionMeta, useGetPlugin, useGetPluginMethod, useGetResourceMeta, useObjectAttributes, useObjectCounts, useObjectIds, usePluginResult, usePlugins, useRunPlugin, useSavePluginResults, useUpload } from "@ocelescope/api-base";
4
+ import { ActionIcon, Anchor, Badge, Box, Breadcrumbs, Button, Card, Center, Container, Divider, Flex, Group, Loader, LoadingOverlay, Menu, Modal, MultiSelect, ScrollArea, Select, SimpleGrid, Splitter, Stack, Switch, Text, ThemeIcon, Title, Tooltip } from "@mantine/core";
5
+ import { useDeletePlugin, useDisableDiscoveryMethod, useDownloadPluginResults, useEnableDiscoveryMethod, useEventAttributes, useEventCounts, useEventIds, useGetComputedValues, useGetExtensionMeta, useGetPlugin, useGetPluginMethod, useGetResourceMeta, useListDiscoveryMethods, useObjectAttributes, useObjectCounts, useObjectIds, usePluginResult, usePlugins, useRunPlugin, useSavePluginResults, useUpload } from "@ocelescope/api-base";
6
6
  import { memo, useCallback, useEffect, useMemo, useState } from "react";
7
7
  import { ResourceSelect, Visualization } from "@ocelescope/resources";
8
8
  import { Controller, useForm, useWatch } from "react-hook-form";
@@ -645,41 +645,80 @@ const MethodCard = ({ method }) => {
645
645
  };
646
646
  const PluginPage = ({ pluginId }) => {
647
647
  const { data: plugin } = useGetPlugin(pluginId);
648
+ const { data: allMethods = [] } = useListDiscoveryMethods();
649
+ const invalidate = useInvalidate();
650
+ const onSuccess = () => invalidate(["discoveryMethods"]);
651
+ const { mutate: disableMethod } = useDisableDiscoveryMethod({ mutation: { onSuccess } });
652
+ const { mutate: enableMethod } = useEnableDiscoveryMethod({ mutation: { onSuccess } });
653
+ const discoveryMethods = useMemo(() => allMethods.flatMap((meta) => meta.variants.filter((v) => v.pluginId === pluginId).map((v) => ({
654
+ name: meta.name,
655
+ variant: v
656
+ }))), [allMethods, pluginId]);
648
657
  return /* @__PURE__ */ jsx(Container, {
649
658
  fluid: true,
650
- children: /* @__PURE__ */ jsxs(Stack, { children: [/* @__PURE__ */ jsxs(Stack, {
651
- gap: 0,
652
- align: "center",
653
- children: [
654
- /* @__PURE__ */ jsx(PluginBreadcrumbs, {}),
655
- /* @__PURE__ */ jsxs(Title, {
656
- mt: "xs",
657
- children: [" ", plugin?.meta.label]
658
- }),
659
- /* @__PURE__ */ jsx(Text, {
660
- c: "dimmed",
661
- children: plugin?.meta.description
662
- })
663
- ]
664
- }), /* @__PURE__ */ jsx(SimpleGrid, {
665
- cols: {
666
- base: 1,
667
- sm: 2,
668
- lg: 4
669
- },
670
- spacing: {
671
- base: 10,
672
- sm: "xl"
673
- },
674
- verticalSpacing: {
675
- base: "md",
676
- sm: "xl"
677
- },
678
- children: plugin?.methods.map((method) => /* @__PURE__ */ jsx(MethodCard, {
679
- method,
680
- pluginId: plugin.id
681
- }, method.name))
682
- })] })
659
+ children: /* @__PURE__ */ jsxs(Stack, { children: [
660
+ /* @__PURE__ */ jsxs(Stack, {
661
+ gap: 0,
662
+ align: "center",
663
+ children: [
664
+ /* @__PURE__ */ jsx(PluginBreadcrumbs, {}),
665
+ /* @__PURE__ */ jsxs(Title, {
666
+ mt: "xs",
667
+ children: [" ", plugin?.meta.label]
668
+ }),
669
+ /* @__PURE__ */ jsx(Text, {
670
+ c: "dimmed",
671
+ children: plugin?.meta.description
672
+ })
673
+ ]
674
+ }),
675
+ /* @__PURE__ */ jsx(SimpleGrid, {
676
+ cols: {
677
+ base: 1,
678
+ sm: 2,
679
+ lg: 4
680
+ },
681
+ spacing: {
682
+ base: 10,
683
+ sm: "xl"
684
+ },
685
+ verticalSpacing: {
686
+ base: "md",
687
+ sm: "xl"
688
+ },
689
+ children: plugin?.methods.map((method) => /* @__PURE__ */ jsx(MethodCard, {
690
+ method,
691
+ pluginId: plugin.id
692
+ }, method.name))
693
+ }),
694
+ discoveryMethods.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Divider, {}), /* @__PURE__ */ jsxs(Stack, {
695
+ gap: "xs",
696
+ children: [/* @__PURE__ */ jsx(Title, {
697
+ order: 4,
698
+ children: "Discovery Methods"
699
+ }), discoveryMethods.map(({ name, variant }) => /* @__PURE__ */ jsxs(Group, {
700
+ justify: "space-between",
701
+ children: [/* @__PURE__ */ jsxs(Stack, {
702
+ gap: 0,
703
+ children: [/* @__PURE__ */ jsx(Text, {
704
+ fw: 500,
705
+ children: name
706
+ }), variant.description && /* @__PURE__ */ jsx(Text, {
707
+ size: "sm",
708
+ c: "dimmed",
709
+ children: variant.description
710
+ })]
711
+ }), /* @__PURE__ */ jsx(Switch, {
712
+ label: "Active in Discovery",
713
+ checked: variant.enabled ?? true,
714
+ onChange: (e) => {
715
+ if (e.currentTarget.checked) enableMethod({ methodId: variant.methodId });
716
+ else disableMethod({ methodId: variant.methodId });
717
+ }
718
+ })]
719
+ }, variant.methodId))]
720
+ })] })
721
+ ] })
683
722
  });
684
723
  };
685
724
  //#endregion
@@ -722,38 +761,46 @@ const PluginCard = ({ plugin }) => {
722
761
  };
723
762
  const UploadPluginCard = () => {
724
763
  const [isModalOpen, setIsModalOpen] = useState(false);
725
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Modal, {
726
- title: /* @__PURE__ */ jsx(Text, {
727
- size: "h3",
728
- children: "Upload"
764
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
765
+ /* @__PURE__ */ jsx(FullScreenUpload, {
766
+ active: !isModalOpen,
767
+ accept: ["application/x-zip-compressed", "application/zip"],
768
+ label: "Drag'n'drop your Plugins to upload."
729
769
  }),
730
- opened: isModalOpen,
731
- onClose: () => setIsModalOpen(false),
732
- size: "xl",
733
- children: /* @__PURE__ */ jsx(PluginUploadSection, { onSuccess: () => setIsModalOpen(false) })
734
- }), /* @__PURE__ */ jsx(Card, {
735
- shadow: "sm",
736
- padding: "lg",
737
- radius: "md",
738
- withBorder: true,
739
- h: "100%",
740
- onClick: () => setIsModalOpen(true),
741
- style: { cursor: "pointer" },
742
- children: /* @__PURE__ */ jsxs(Stack, {
743
- align: "center",
744
- justify: "center",
770
+ /* @__PURE__ */ jsx(Modal, {
771
+ title: /* @__PURE__ */ jsx(Text, {
772
+ size: "h3",
773
+ children: "Upload"
774
+ }),
775
+ opened: isModalOpen,
776
+ onClose: () => setIsModalOpen(false),
777
+ size: "xl",
778
+ children: /* @__PURE__ */ jsx(PluginUploadSection, { onSuccess: () => setIsModalOpen(false) })
779
+ }),
780
+ /* @__PURE__ */ jsx(Card, {
781
+ shadow: "sm",
782
+ padding: "lg",
783
+ radius: "md",
784
+ withBorder: true,
745
785
  h: "100%",
746
- children: [/* @__PURE__ */ jsx(ThemeIcon, {
747
- size: "xl",
748
- variant: "transparent",
749
- children: /* @__PURE__ */ jsx(UploadIcon, { size: 50 })
750
- }), /* @__PURE__ */ jsx(Text, {
751
- fw: "bold",
752
- c: "blue.6",
753
- children: "Upload Plugin"
754
- })]
786
+ onClick: () => setIsModalOpen(true),
787
+ style: { cursor: "pointer" },
788
+ children: /* @__PURE__ */ jsxs(Stack, {
789
+ align: "center",
790
+ justify: "center",
791
+ h: "100%",
792
+ children: [/* @__PURE__ */ jsx(ThemeIcon, {
793
+ size: "xl",
794
+ variant: "transparent",
795
+ children: /* @__PURE__ */ jsx(UploadIcon, { size: 50 })
796
+ }), /* @__PURE__ */ jsx(Text, {
797
+ fw: "bold",
798
+ c: "blue.6",
799
+ children: "Upload Plugin"
800
+ })]
801
+ })
755
802
  })
756
- })] });
803
+ ] });
757
804
  };
758
805
  //#endregion
759
806
  //#region src/pages/PluginsOverview.tsx
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ocelescope/plugin",
3
3
  "type": "module",
4
- "version": "0.1.2",
4
+ "version": "0.5.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",
@@ -27,41 +27,39 @@
27
27
  "access": "public"
28
28
  },
29
29
  "peerDependencies": {
30
- "@apidevtools/json-schema-ref-parser": "^15.3.1",
31
- "@mantine/carousel": "^9.4.0",
32
- "@mantine/charts": "^9.4.0",
33
- "@mantine/core": "^9.4.0",
34
- "@mantine/hooks": "^9.4.0",
30
+ "@apidevtools/json-schema-ref-parser": "^15.5.0",
31
+ "@mantine/carousel": "^9.4.2",
32
+ "@mantine/core": "^9.4.2",
33
+ "@mantine/hooks": "^9.4.2",
35
34
  "@marko19907/string-to-color": "^1.0.2",
36
- "@rjsf/core": "^6.6.2",
37
- "@rjsf/mantine": "^6.6.2",
38
- "@rjsf/utils": "^6.6.2",
39
- "@rjsf/validator-ajv8": "^6.6.2",
35
+ "@rjsf/core": "^6.7.0",
36
+ "@rjsf/mantine": "^6.7.0",
37
+ "@rjsf/utils": "^6.7.0",
38
+ "@rjsf/validator-ajv8": "^6.7.0",
40
39
  "@tanstack/react-query": "^5.90.21",
41
40
  "embla-carousel": "^8.6.0",
42
41
  "embla-carousel-react": "^8.6.0",
43
42
  "flat": "^6.0.1",
44
43
  "json-schema-traverse": "^1.0.0",
45
44
  "lucide-react": "^1.0.0",
46
- "next": "^16.1.6",
47
- "react": "^19.2.0",
48
- "react-dom": "^19.2.0",
45
+ "next": "^16.2.10",
46
+ "react": "^19.2.7",
47
+ "react-dom": "^19.2.7",
49
48
  "react-hook-form": "^7.71.2",
50
- "@ocelescope/resources": "^0.1.2",
51
- "@ocelescope/core": "^0.1.2",
52
- "@ocelescope/api-base": "^0.1.0"
49
+ "@ocelescope/core": "^0.5.0",
50
+ "@ocelescope/resources": "^0.5.0",
51
+ "@ocelescope/api-base": "^0.5.0"
53
52
  },
54
53
  "devDependencies": {
55
- "@apidevtools/json-schema-ref-parser": "^15.3.1",
56
- "@mantine/charts": "^9.4.0",
57
- "@rjsf/mantine": "^6.6.2",
54
+ "@apidevtools/json-schema-ref-parser": "^15.5.0",
55
+ "@rjsf/mantine": "^6.7.0",
58
56
  "@types/file-saver": "^2.0.7",
59
- "@types/node": "^25.0.3",
60
- "@types/react": "^19.2.7",
57
+ "@types/node": "^26.1.1",
58
+ "@types/react": "^19.2.17",
61
59
  "@types/react-dom": "^19.2.3",
62
60
  "flat": "^6.0.1",
63
61
  "json-schema-traverse": "^1.0.0",
64
- "tsdown": "^0.22.0",
62
+ "tsdown": "^0.22.12",
65
63
  "typescript": "^5.9.3"
66
64
  },
67
65
  "scripts": {