diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index f79dfd8..a51fe24 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,12 +1,22 @@
+
+
+
-
-
+
+
+
+
+
+
+
+
+
@@ -37,7 +47,7 @@
"RunOnceActivity.ShowReadmeOnStart": "true",
"WebServerToolWindowFactoryState": "false",
"git-widget-placeholder": "master",
- "last_opened_file_path": "/Users/ember/Development/APC.GUI",
+ "last_opened_file_path": "/Users/ember/Development/APC.GUI/src/app/components",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.stylelint": "true",
"node.js.detected.package.tslint": "true",
@@ -47,6 +57,7 @@
"nodejs_package_manager_path": "yarn",
"npm.start.executor": "Debug",
"prettierjs.PrettierConfiguration.Package": "/Users/ember/Development/APC.GUI/node_modules/prettier",
+ "run.code.analysis.last.selected.profile": "pProject Default",
"settings.editor.selected.configurable": "settings.javascript.prettier",
"ts.external.directory.path": "/Users/ember/Development/APC.GUI/node_modules/typescript/lib",
"vue.rearranger.settings.migration": "true"
@@ -61,6 +72,11 @@
+
+
+
+
+
@@ -76,7 +92,9 @@
-
+
+
+
1673610819659
@@ -114,7 +132,15 @@
1705011384985
-
+
+
+ 1705013993183
+
+
+
+ 1705013993183
+
+
@@ -126,6 +152,7 @@
-
+
+
\ No newline at end of file
diff --git a/src/api/apc.tsx b/src/api/apc.tsx
index 27e502f..e652e8b 100644
--- a/src/api/apc.tsx
+++ b/src/api/apc.tsx
@@ -10,9 +10,6 @@ export const APC_API =
window.location.protocol + '//' + window.location.hostname + ':8004/api';
const APC_ARTIFACTS = '/artifact';
const APC_PROCESSOR = '/processor';
-/* Delete */
-const DeleteArtifactUrl = (processor: string) =>
- `${APC_ARTIFACTS}/${processor}/`;
const axios_ctx = createContext({} as AxiosInstance);
@@ -64,13 +61,28 @@ export const useApcApi = () => {
};
const DeleteArtifact = ({ id, processor }) => {
- return APC.delete(DeleteArtifactUrl(processor), {
+ return APC.delete(APC_ARTIFACTS, {
data: {
id: id,
+ processor: processor,
},
});
};
+ const TrackArtifact = ({ id, processor }) => {
+ return APC.post(APC_ARTIFACTS + '/track', {
+ id: id,
+ processor: processor,
+ });
+ };
+
+ const ValidateArtifact = ({ id, processor }) => {
+ return APC.post(APC_ARTIFACTS + '/validate', {
+ id: id,
+ processor: processor,
+ });
+ };
+
/* Add */
const AddArtifact = (artifact: Artifact) => {
return APC.post(APC_ARTIFACTS, {
@@ -109,9 +121,11 @@ export const useApcApi = () => {
UpdateProcessor,
AddArtifact,
TrackAllArtifacts,
+ TrackArtifact,
DeleteArtifact,
GetAllProcessors,
GetAllProcessorArtifacts,
ValidateAllArtifacts,
+ ValidateArtifact,
};
};
diff --git a/src/app/components/ArtifactTable/InspectButton.tsx b/src/app/components/ArtifactTable/InspectButton.tsx
index adecd11..31ece0d 100644
--- a/src/app/components/ArtifactTable/InspectButton.tsx
+++ b/src/app/components/ArtifactTable/InspectButton.tsx
@@ -4,10 +4,7 @@
*
*/
import { Button } from '@blueprintjs/core';
-import { useMutation } from '@tanstack/react-query';
-import { useApcApi } from 'api/apc';
import React, { memo } from 'react';
-import { useKeycloak } from '@react-keycloak-fork/web';
import { Artifact } from 'types';
interface Props {
diff --git a/src/app/components/ArtifactTable/index.tsx b/src/app/components/ArtifactTable/index.tsx
index 1123f1c..fcffcf7 100644
--- a/src/app/components/ArtifactTable/index.tsx
+++ b/src/app/components/ArtifactTable/index.tsx
@@ -3,9 +3,9 @@
* ArtifactTable
*
*/
-import { ButtonGroup, Button, Checkbox, Spinner, Tag } from '@blueprintjs/core';
+import { Button, ButtonGroup, Checkbox, Spinner, Tag } from '@blueprintjs/core';
import _ from 'lodash';
-import { Column, Cell, Table2 } from '@blueprintjs/table';
+import { Cell, Column, Table2 } from '@blueprintjs/table';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useApcApi } from 'api/apc';
import React, { memo, useState } from 'react';
@@ -19,6 +19,9 @@ import { InspectButton } from './InspectButton';
import { ArtifactInspector } from 'app/components/ArtifactInspector';
import { AxiosResponse } from 'axios';
import { SearchBar } from './SearchBar';
+import { TrackArtifactButton } from '../TrackArtifactButton/Loadable';
+import { ValidateArtifactButton } from '../ValidateArtifactButton/Loadable';
+import { DeleteArtifactButton } from '../DeleteArtifactButton/Loadable';
interface Props {
processor: Processor;
@@ -60,8 +63,6 @@ const FilterArtifacts = (
export const ArtifactTable = memo((props: Props) => {
const apc = useApcApi();
- const { keycloak } = useKeycloak();
- const query_client = useQueryClient();
const [only_roots, SetOnlyRoots] = useState(true);
const [deep_filter, SetDeepFilter] = useState(false);
const [inspect, SetInspect] = useState(null);
@@ -71,16 +72,6 @@ export const ArtifactTable = memo((props: Props) => {
apc.GetAllProcessorArtifacts,
);
- const mutation = useMutation({
- mutationFn: apc.DeleteArtifact,
- onSuccess: (data: AxiosResponse) => {
- const artifact = data.data;
- query_client.invalidateQueries({
- queryKey: ['artifact_table', artifact.processor, true],
- });
- },
- });
-
if (query.isLoading) {
return ;
}
@@ -132,17 +123,9 @@ export const ArtifactTable = memo((props: Props) => {
-
+
+
+
),
diff --git a/src/app/components/DeleteArtifactButton/Loadable.ts b/src/app/components/DeleteArtifactButton/Loadable.ts
new file mode 100644
index 0000000..eae1a74
--- /dev/null
+++ b/src/app/components/DeleteArtifactButton/Loadable.ts
@@ -0,0 +1,12 @@
+/**
+ *
+ * Asynchronously loads the component for TrackAllButton
+ *
+ */
+
+import { lazyLoad } from 'utils/loadable';
+
+export const DeleteArtifactButton = lazyLoad(
+ () => import('./index'),
+ module => module.DeleteArtifactButton,
+);
diff --git a/src/app/components/DeleteArtifactButton/index.tsx b/src/app/components/DeleteArtifactButton/index.tsx
new file mode 100644
index 0000000..f32ce0f
--- /dev/null
+++ b/src/app/components/DeleteArtifactButton/index.tsx
@@ -0,0 +1,50 @@
+/**
+ *
+ * TrackAllButton
+ *
+ */
+import { Button } from '@blueprintjs/core';
+import { useMutation, useQueryClient } from '@tanstack/react-query';
+import { useApcApi } from 'api/apc';
+import React, { memo } from 'react';
+import { useKeycloak } from '@react-keycloak-fork/web';
+import { AxiosResponse } from 'axios';
+import { Artifact } from '../../../types';
+
+interface Props {
+ id: string;
+ processor: string;
+}
+
+export const DeleteArtifactButton = memo((props: Props) => {
+ const apc = useApcApi();
+ const { keycloak } = useKeycloak();
+ const query_client = useQueryClient();
+ const mutation = useMutation({
+ mutationFn: apc.DeleteArtifact,
+ onSuccess: (data: AxiosResponse) => {
+ const artifact = data.data;
+ query_client.invalidateQueries({
+ queryKey: ['artifact_table', artifact.processor, true],
+ });
+ },
+ });
+
+ if (!keycloak.hasResourceRole('Administrator')) {
+ return null;
+ }
+
+ return (
+
+ );
+});
diff --git a/src/app/components/TrackArtifactButton/Loadable.ts b/src/app/components/TrackArtifactButton/Loadable.ts
new file mode 100644
index 0000000..f12eafb
--- /dev/null
+++ b/src/app/components/TrackArtifactButton/Loadable.ts
@@ -0,0 +1,12 @@
+/**
+ *
+ * Asynchronously loads the component for TrackAllButton
+ *
+ */
+
+import { lazyLoad } from 'utils/loadable';
+
+export const TrackArtifactButton = lazyLoad(
+ () => import('./index'),
+ module => module.TrackArtifactButton,
+);
diff --git a/src/app/components/TrackArtifactButton/index.tsx b/src/app/components/TrackArtifactButton/index.tsx
new file mode 100644
index 0000000..84cc9ff
--- /dev/null
+++ b/src/app/components/TrackArtifactButton/index.tsx
@@ -0,0 +1,31 @@
+/**
+ *
+ * TrackAllButton
+ *
+ */
+import { Button } from '@blueprintjs/core';
+import { useMutation } from '@tanstack/react-query';
+import { useApcApi } from 'api/apc';
+import React, { memo } from 'react';
+import { useKeycloak } from '@react-keycloak-fork/web';
+
+interface Props {
+ id: string;
+ processor: string;
+}
+
+export const TrackArtifactButton = memo((props: Props) => {
+ const apc = useApcApi();
+ const mutation = useMutation(apc.TrackArtifact);
+
+ return (
+
+ );
+});
diff --git a/src/app/components/ValidateArtifactButton/Loadable.ts b/src/app/components/ValidateArtifactButton/Loadable.ts
new file mode 100644
index 0000000..104f005
--- /dev/null
+++ b/src/app/components/ValidateArtifactButton/Loadable.ts
@@ -0,0 +1,12 @@
+/**
+ *
+ * Asynchronously loads the component for TrackAllButton
+ *
+ */
+
+import { lazyLoad } from 'utils/loadable';
+
+export const ValidateArtifactButton = lazyLoad(
+ () => import('./index'),
+ module => module.ValidateArtifactButton,
+);
diff --git a/src/app/components/ValidateArtifactButton/index.tsx b/src/app/components/ValidateArtifactButton/index.tsx
new file mode 100644
index 0000000..69141d8
--- /dev/null
+++ b/src/app/components/ValidateArtifactButton/index.tsx
@@ -0,0 +1,31 @@
+/**
+ *
+ * TrackAllButton
+ *
+ */
+import { Button } from '@blueprintjs/core';
+import { useMutation } from '@tanstack/react-query';
+import { useApcApi } from 'api/apc';
+import React, { memo } from 'react';
+import { useKeycloak } from '@react-keycloak-fork/web';
+
+interface Props {
+ id: string;
+ processor: string;
+}
+
+export const ValidateArtifactButton = memo((props: Props) => {
+ const apc = useApcApi();
+ const mutation = useMutation(apc.ValidateArtifact);
+
+ return (
+
+ );
+});