-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated to include individual artifact commands, such as refresh/upda…
…te and validate that the artifact is on disk.
- Loading branch information
1 parent
d397857
commit fffa49b
Showing
10 changed files
with
207 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* | ||
* Asynchronously loads the component for TrackAllButton | ||
* | ||
*/ | ||
|
||
import { lazyLoad } from 'utils/loadable'; | ||
|
||
export const DeleteArtifactButton = lazyLoad( | ||
() => import('./index'), | ||
module => module.DeleteArtifactButton, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Artifact>) => { | ||
const artifact = data.data; | ||
query_client.invalidateQueries({ | ||
queryKey: ['artifact_table', artifact.processor, true], | ||
}); | ||
}, | ||
}); | ||
|
||
if (!keycloak.hasResourceRole('Administrator')) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Button | ||
intent="danger" | ||
disabled={!keycloak.hasResourceRole('Administrator')} | ||
onClick={() => { | ||
if (window.confirm('Do you really want to delete ' + props.id)) { | ||
mutation.mutate({ id: props.id, processor: props.processor }); | ||
} | ||
}} | ||
loading={mutation.isLoading} | ||
icon="trash" | ||
></Button> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* | ||
* Asynchronously loads the component for TrackAllButton | ||
* | ||
*/ | ||
|
||
import { lazyLoad } from 'utils/loadable'; | ||
|
||
export const TrackArtifactButton = lazyLoad( | ||
() => import('./index'), | ||
module => module.TrackArtifactButton, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<Button | ||
intent="success" | ||
loading={mutation.isLoading} | ||
onClick={() => | ||
mutation.mutate({ id: props.id, processor: props.processor }) | ||
} | ||
icon={'refresh'} | ||
></Button> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* | ||
* Asynchronously loads the component for TrackAllButton | ||
* | ||
*/ | ||
|
||
import { lazyLoad } from 'utils/loadable'; | ||
|
||
export const ValidateArtifactButton = lazyLoad( | ||
() => import('./index'), | ||
module => module.ValidateArtifactButton, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<Button | ||
intent="warning" | ||
loading={mutation.isLoading} | ||
onClick={() => | ||
mutation.mutate({ id: props.id, processor: props.processor }) | ||
} | ||
icon={'saved'} | ||
></Button> | ||
); | ||
}); |