-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/Tapis-v3-redesign
- Loading branch information
Showing
94 changed files
with
4,247 additions
and
289 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
client/modules/_hooks/src/datafiles/projects/UseValidateEntitySelection.ts
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,32 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
import apiClient from '../../apiClient'; | ||
|
||
export type TPipelineValidationResult = { | ||
errorType: string; | ||
name: string; | ||
title: string; | ||
missing: string[]; | ||
}; | ||
|
||
async function validateEntitySelection( | ||
projectId: string, | ||
entityUuids: string[] | ||
) { | ||
const res = await apiClient.post<{ result: TPipelineValidationResult[] }>( | ||
`/api/projects/v2/${projectId}/entities/validate/`, | ||
{ entityUuids } | ||
); | ||
return res.data; | ||
} | ||
|
||
export function useValidateEntitySelection() { | ||
return useMutation({ | ||
mutationFn: ({ | ||
projectId, | ||
entityUuids, | ||
}: { | ||
projectId: string; | ||
entityUuids: string[]; | ||
}) => validateEntitySelection(projectId, entityUuids), | ||
}); | ||
} |
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
36 changes: 36 additions & 0 deletions
36
client/modules/_hooks/src/datafiles/projects/usePatchEntityMetadata.ts
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,36 @@ | ||
import { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
import apiClient from '../../apiClient'; | ||
|
||
async function patchEntityMetadata( | ||
entityUuid: string, | ||
patchMetadata: Record<string, unknown> | ||
) { | ||
// Replace undefined with null so that deleted values are unset instead of ignored. | ||
Object.keys(patchMetadata).forEach((k) => { | ||
if (patchMetadata[k] === undefined) { | ||
patchMetadata[k] = null; | ||
} | ||
}); | ||
const res = await apiClient.patch( | ||
`/api/projects/v2/entities/${entityUuid}/`, | ||
{ patchMetadata } | ||
); | ||
return res.data; | ||
} | ||
|
||
export function usePatchEntityMetadata() { | ||
const queryClient = useQueryClient(); | ||
return useMutation({ | ||
mutationFn: ({ | ||
entityUuid, | ||
patchMetadata, | ||
}: { | ||
patchMetadata: Record<string, unknown>; | ||
entityUuid: string; | ||
}) => patchEntityMetadata(entityUuid, patchMetadata), | ||
onSuccess: () => | ||
queryClient.invalidateQueries({ | ||
queryKey: ['datafiles', 'projects', 'detail'], | ||
}), | ||
}); | ||
} |
33 changes: 33 additions & 0 deletions
33
client/modules/_hooks/src/datafiles/projects/usePatchProjectMetadata.ts
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,33 @@ | ||
import { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
import apiClient from '../../apiClient'; | ||
|
||
async function patchProjectMetadata( | ||
projectId: string, | ||
patchMetadata: Record<string, unknown> | ||
) { | ||
// Replace undefined with null so that deleted values are unset instead of ignored. | ||
Object.keys(patchMetadata).forEach((k) => { | ||
if (patchMetadata[k] === undefined) { | ||
patchMetadata[k] = null; | ||
} | ||
}); | ||
const res = await apiClient.patch(`/api/projects/v2/${projectId}/`, { | ||
patchMetadata, | ||
}); | ||
return res.data; | ||
} | ||
|
||
export function usePatchProjectMetadata(projectId: string) { | ||
const queryClient = useQueryClient(); | ||
return useMutation({ | ||
mutationFn: ({ | ||
patchMetadata, | ||
}: { | ||
patchMetadata: Record<string, unknown>; | ||
}) => patchProjectMetadata(projectId, patchMetadata), | ||
onSuccess: () => | ||
queryClient.invalidateQueries({ | ||
queryKey: ['datafiles', 'projects', 'detail', projectId], | ||
}), | ||
}); | ||
} |
4 changes: 2 additions & 2 deletions
4
client/modules/_hooks/src/datafiles/projects/useProjectDetail.ts
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
4 changes: 2 additions & 2 deletions
4
client/modules/_hooks/src/datafiles/projects/useProjectPreview.tsx
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
17 changes: 15 additions & 2 deletions
17
client/modules/_hooks/src/datafiles/publications/usePublicationDetail.ts
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
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
Oops, something went wrong.