fix: adding a back button in git revert modal (#23632)

## Description
Adds a back button to git revoke access modal. Clicking on the back
button takes user back to the previous modal. This PR is in accordance
with ADS v2

#### PR fixes following issue(s)
Fixes #23032 

#### Media
Before

![image](https://github.com/appsmithorg/appsmith/assets/8724051/6b2014b2-e86c-42ee-a529-21c3feaf34fe)

After

![image](https://github.com/appsmithorg/appsmith/assets/8724051/4ade9f78-314e-4f2d-9d45-fbcc07ddc7d4)

#### Type of change
- Bug fix (non-breaking change which fixes an issue)

## Testing
Manually tested

#### How Has This Been Tested?
- [x] Manual
- [ ] Jest
- [ ] Cypress
This commit is contained in:
Rudraprasad Das 2023-05-24 11:20:36 +05:30 committed by GitHub
parent 87354cbdcc
commit d4d34b6564
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,12 @@ import {
getIsDisconnectGitModalOpen,
} from "selectors/gitSyncSelectors";
import { useDispatch, useSelector } from "react-redux";
import { revokeGit, setIsDisconnectGitModalOpen } from "actions/gitSyncActions";
import {
revokeGit,
setDisconnectingGitApplication,
setIsDisconnectGitModalOpen,
setIsGitSyncModalOpen,
} from "actions/gitSyncActions";
import {
Button,
Callout,
@ -22,6 +27,7 @@ import {
createMessage,
GIT_REVOKE_ACCESS,
GIT_TYPE_REPO_NAME_FOR_REVOKING_ACCESS,
GO_BACK,
NONE_REVERSIBLE_MESSAGE,
REVOKE,
} from "@appsmith/constants/messages";
@ -35,6 +41,13 @@ function DisconnectGitModal() {
const gitDisconnectDocumentUrl = useSelector(getDisconnectDocUrl);
const [appName, setAppName] = useState("");
const [isRevoking, setIsRevoking] = useState(false);
const handleClickOnBack = useCallback(() => {
dispatch(setIsDisconnectGitModalOpen(false));
dispatch(setIsGitSyncModalOpen({ isOpen: true }));
dispatch(setDisconnectingGitApplication({ id: "", name: "" }));
}, [dispatch]);
const handleClose = useCallback(() => {
dispatch(setIsDisconnectGitModalOpen(false));
}, [dispatch, setIsDisconnectGitModalOpen]);
@ -102,10 +115,18 @@ function DisconnectGitModal() {
</Callout>
</ModalBody>
<ModalFooter>
<Button
className="t--git-revoke-back-button"
kind="secondary"
onClick={handleClickOnBack}
size="md"
>
{createMessage(GO_BACK)}
</Button>
<Button
className="t--git-revoke-button"
isDisabled={shouldDisableRevokeButton}
kind="error"
kind="primary"
onClick={onDisconnectGit}
size="md"
>