-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'task/WP-724' of github.com:TACC/Core-Portal into task/W…
…P-724
- Loading branch information
Showing
21 changed files
with
642 additions
and
159 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -20,7 +20,6 @@ | |
} | ||
|
||
.member-search { | ||
margin-bottom: 1em; | ||
font-size: 12px !important; | ||
} | ||
|
||
|
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { useSelector, useDispatch, shallowEqual } from 'react-redux'; | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { apiClient } from 'utils/apiClient'; | ||
|
||
export async function mkdirUtil({ | ||
api, | ||
scheme, | ||
system, | ||
path, | ||
dirname, | ||
}: { | ||
api: string; | ||
scheme: string; | ||
system: string; | ||
path: string; | ||
dirname: string; | ||
}): Promise<{ name: string; path: string }> { | ||
let apiPath = !path || path[0] === '/' ? path : `/${path}`; | ||
if (apiPath === '/') { | ||
apiPath = ''; | ||
} | ||
let url = `/api/datafiles/${api}/mkdir/${scheme}/${system}/${apiPath}/`; | ||
url = url.replace(/\/{2,}/g, '/'); | ||
const response = await apiClient.put<{ name: string; path: string }>(url, { | ||
dir_name: dirname, | ||
}); | ||
|
||
return response.data; | ||
} | ||
|
||
function useMkdir() { | ||
const dispatch = useDispatch(); | ||
const status = useSelector( | ||
(state: any) => state.files.operationStatus.mkdir, | ||
shallowEqual | ||
); | ||
|
||
const setStatus = (newStatus: any) => { | ||
dispatch({ | ||
type: 'DATA_FILES_SET_OPERATION_STATUS', | ||
payload: { status: newStatus, operation: 'mkdir' }, | ||
}); | ||
}; | ||
|
||
const { mutate } = useMutation({ mutationFn: mkdirUtil }); | ||
|
||
const mkdir = ({ | ||
api, | ||
scheme, | ||
system, | ||
path, | ||
dirname, | ||
reloadCallback, | ||
}: { | ||
api: string; | ||
scheme: string; | ||
system: string; | ||
path: string; | ||
dirname: string; | ||
reloadCallback: any; | ||
}) => { | ||
mutate( | ||
{ | ||
api, | ||
scheme, | ||
system, | ||
path, | ||
dirname, | ||
}, | ||
{ | ||
onSuccess: () => { | ||
dispatch({ | ||
type: 'DATA_FILES_TOGGLE_MODAL', | ||
payload: { | ||
operation: 'mkdir', | ||
props: {}, | ||
}, | ||
}); | ||
reloadCallback(); | ||
}, | ||
onError: () => {}, | ||
} | ||
); | ||
}; | ||
|
||
return { mkdir, status, setStatus }; | ||
} | ||
|
||
export default useMkdir; |
Oops, something went wrong.