-
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.
initial working pipeline steps for type Hybrid Sim (#1201)
* initial working pipeline steps for type Hybrid Sim * add UI for changing project type * import fix * add selection page for publish vs amend/revise * formatting * linting * Add change_project_type function and test cases (#1214) * fixes for citations/tree view; add listings to entity view * update publication ingest to add all versions * add project selection to copy modal * linting fixes --------- Co-authored-by: Van Go <[email protected]>
- Loading branch information
Showing
71 changed files
with
3,744 additions
and
239 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.