fix: removing disabled state when loading for git commit button (#30514)
## Description - Fixes initial loading color for the commit button in protected branches - Adds loading state when discard and pull is triggered #### PR fixes following issue(s) Fixes #29485 #### Media <img width="1728" alt="image" src="https://github.com/appsmithorg/appsmith/assets/8724051/d909a085-2ff6-4805-8c92-541a746602fa"> #### Type of change - Bug fix (non-breaking change which fixes an issue) ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved button responsiveness in the Git Sync feature, enabling better control over versioning actions. - **Bug Fixes** - Addressed an issue where Git-related buttons were not accurately reflecting the current state, ensuring they are now correctly enabled or disabled depending on the Git operation in progress. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
4f6bbb5f2c
commit
5ae0924b4c
|
|
@ -34,11 +34,11 @@ import { GitSyncModalTab } from "entities/GitSync";
|
|||
import {
|
||||
getCountOfChangesToCommit,
|
||||
getGitStatus,
|
||||
getIsDiscardInProgress,
|
||||
getIsFetchingGitStatus,
|
||||
getIsGitConnected,
|
||||
getIsPollingAutocommit,
|
||||
getPullFailed,
|
||||
getPullInProgress,
|
||||
protectedModeSelector,
|
||||
} from "selectors/gitSyncSelectors";
|
||||
import SpinnerLoader from "pages/common/SpinnerLoader";
|
||||
|
|
@ -188,18 +188,18 @@ const getQuickActionButtons = ({
|
|||
return [
|
||||
{
|
||||
className: "t--bottom-bar-commit",
|
||||
disabled: isProtectedMode,
|
||||
disabled: !isFetchingGitStatus && isProtectedMode,
|
||||
count: isProtectedMode ? undefined : changesToCommit,
|
||||
icon: "plus",
|
||||
loading: isFetchingGitStatus,
|
||||
onClick: commit,
|
||||
onClick: () => !isFetchingGitStatus && !isProtectedMode && commit(),
|
||||
tooltipText: createMessage(COMMIT_CHANGES),
|
||||
},
|
||||
{
|
||||
className: "t--bottom-bar-pull",
|
||||
count: gitStatus?.behindCount,
|
||||
icon: "down-arrow-2",
|
||||
onClick: () => !pullDisabled && pull(),
|
||||
onClick: () => !showPullLoadingState && !pullDisabled && pull(),
|
||||
tooltipText: pullTooltipMessage,
|
||||
disabled: !showPullLoadingState && pullDisabled,
|
||||
loading: showPullLoadingState,
|
||||
|
|
@ -329,7 +329,7 @@ export default function QuickGitActions() {
|
|||
const { disabled: pullDisabled, message: pullTooltipMessage } =
|
||||
getPullBtnStatus(gitStatus, !!pullFailed, isProtectedMode);
|
||||
|
||||
const isPullInProgress = useSelector(getPullInProgress);
|
||||
const isPullInProgress = useSelector(getIsDiscardInProgress);
|
||||
const isFetchingGitStatus = useSelector(getIsFetchingGitStatus);
|
||||
const showPullLoadingState = isPullInProgress || isFetchingGitStatus;
|
||||
const changesToCommit = useSelector(getCountOfChangesToCommit);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ const initialState: GitSyncReducerState = {
|
|||
fetchingBranches: false,
|
||||
localGitConfig: { authorEmail: "", authorName: "" },
|
||||
|
||||
isDiscarding: false,
|
||||
|
||||
isFetchingLocalGitConfig: false,
|
||||
isFetchingGlobalGitConfig: false,
|
||||
|
||||
|
|
@ -542,6 +544,11 @@ const gitSyncReducer = createReducer(initialState, {
|
|||
...state,
|
||||
deletingBranch: action.payload,
|
||||
}),
|
||||
[ReduxActionTypes.GIT_DISCARD_CHANGES]: (state: GitSyncReducerState) => ({
|
||||
...state,
|
||||
isDiscarding: true,
|
||||
discardError: null,
|
||||
}),
|
||||
[ReduxActionTypes.GIT_DISCARD_CHANGES_SUCCESS]: (
|
||||
state: GitSyncReducerState,
|
||||
action: ReduxAction<any>,
|
||||
|
|
@ -812,7 +819,7 @@ export type GitSyncReducerState = GitBranchDeleteState & {
|
|||
|
||||
gitImportError?: any;
|
||||
|
||||
isDiscarding?: boolean;
|
||||
isDiscarding: boolean;
|
||||
discard?: GitDiscardResponse;
|
||||
discardError?: GitErrorType;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user