-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sidebar changes. FM Formik MUI stuff. Pods update wip.
- Loading branch information
1 parent
527e948
commit 2bf02c3
Showing
28 changed files
with
1,862 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Pods } from '@tapis/tapis-typescript'; | ||
import { apiGenerator, errorDecoder } from '../utils'; | ||
|
||
const updatePod = ( | ||
reqUpdatePod: Pods.UpdatePodRequest, | ||
basePath: string, | ||
jwt: string | ||
): Promise<Pods.PodResponse> => { | ||
const api: Pods.PodsApi = apiGenerator<Pods.PodsApi>( | ||
Pods, | ||
Pods.PodsApi, | ||
basePath, | ||
jwt | ||
); | ||
return errorDecoder<Pods.PodResponse>(() => api.updatePod(reqUpdatePod)); | ||
}; | ||
|
||
export default updatePod; |
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,44 @@ | ||
// FMTextField.tsx | ||
import React from 'react'; | ||
import { TextField } from '@mui/material'; | ||
import { FormikProps } from 'formik'; | ||
|
||
interface FMTextFieldProps { | ||
formik: FormikProps<any>; | ||
name: string; | ||
label: string; | ||
description: string; | ||
type?: string; | ||
size?: 'small' | 'medium'; | ||
} | ||
|
||
const FMTextField: React.FC<FMTextFieldProps> = ({ | ||
formik, | ||
name, | ||
label, | ||
description, | ||
type = 'text', | ||
size = 'small', | ||
}) => { | ||
return ( | ||
<TextField | ||
fullWidth | ||
id={name} | ||
name={name} | ||
label={label} | ||
type={type} | ||
value={formik.values[name]} | ||
onChange={formik.handleChange} | ||
onBlur={formik.handleBlur} | ||
error={formik.touched[name] && Boolean(formik.errors[name])} | ||
helperText={ | ||
formik.touched[name] && formik.errors[name] | ||
? String(formik.errors[name]) | ||
: description | ||
} | ||
size={size} | ||
/> | ||
); | ||
}; | ||
|
||
export default FMTextField; |
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,7 @@ | ||
import React from 'react'; | ||
import { TextField } from '@mui/material'; | ||
import { useField } from 'formik'; | ||
|
||
const FMTextField = ({}) => {}; | ||
|
||
export default FMTextField; |
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,3 @@ | ||
import FMTextField from './FMTextField'; | ||
|
||
export { FMTextField }; |
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
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,48 @@ | ||
import { useEffect } from 'react'; | ||
import { useMutation, MutateOptions } from 'react-query'; | ||
import { Pods } from '@tapis/tapis-typescript'; | ||
import { Pods as API } from '@tapis/tapisui-api'; | ||
import { useTapisConfig } from '../context'; | ||
import QueryKeys from './queryKeys'; | ||
import { updatePod } from '@tapis/tapisui-api/dist/pods'; | ||
|
||
type UpdatePodHookParams = { | ||
updatePod: Pods.UpdatePod; | ||
}; | ||
|
||
const useUpdatePod = (podId: string) => { | ||
const { basePath, accessToken } = useTapisConfig(); | ||
const jwt = accessToken?.access_token || ''; | ||
|
||
// The useMutation react-query hook is used to call operations that make server-side changes | ||
// (Other hooks would be used for data retrieval) | ||
// | ||
// In this case, mkdir helper is called to perform the operation | ||
const { mutate, isLoading, isError, isSuccess, data, error, reset } = | ||
useMutation<Pods.PodResponse, Error, Pods.UpdatePodRequest>( | ||
[QueryKeys.updatePod, podId, basePath, jwt], | ||
(updatePod) => API.updatePod(updatePod, basePath, jwt) | ||
); | ||
|
||
useEffect(() => reset(), [reset, podId]); | ||
|
||
// Return hook object with loading states and login function | ||
return { | ||
isLoading, | ||
isError, | ||
isSuccess, | ||
data, | ||
error, | ||
reset, | ||
updatePod: ( | ||
updatePod: Pods.UpdatePod, | ||
// react-query options to allow callbacks such as onSuccess | ||
options?: MutateOptions<Pods.PodResponse, Error, UpdatePodHookParams> | ||
) => { | ||
// Call mutate to trigger a single post-like API operation | ||
return mutate({ updatePod, podId }, options); | ||
}, | ||
}; | ||
}; | ||
|
||
export default useUpdatePod; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.