chore: git mod - fixes toast issues (#39140)
## Description Fixes issue with missing success toast related to git Fixes https://github.com/appsmithorg/appsmith/issues/38872 Fixes https://github.com/appsmithorg/appsmith/issues/38862 ## Automation /ok-to-test tags="@tag.Git" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/13216997415> > Commit: 95ccaedc4583492a5a6c7b88c6ca8215b2a55807 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13216997415&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Git` > Spec: > <hr>Sat, 08 Feb 2025 17:43:52 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - Discard operations now display clear, contextual success messages to enhance user feedback. - Toast notifications have been added for pull actions and protected branch updates, providing real-time confirmation of successful operations. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
3fb7555962
commit
d199546f1e
|
|
@ -75,7 +75,7 @@ interface TabDeployViewProps {
|
||||||
commit: (commitMessage: string) => void;
|
commit: (commitMessage: string) => void;
|
||||||
commitError: GitApiError | null;
|
commitError: GitApiError | null;
|
||||||
currentBranch: string | null;
|
currentBranch: string | null;
|
||||||
discard: () => void;
|
discard: (successMessage: string) => void;
|
||||||
discardError: GitApiError | null;
|
discardError: GitApiError | null;
|
||||||
isCommitLoading: boolean;
|
isCommitLoading: boolean;
|
||||||
isDiscardLoading: boolean;
|
isDiscardLoading: boolean;
|
||||||
|
|
@ -239,7 +239,7 @@ function TabDeployView({
|
||||||
AnalyticsUtil.logEvent("GIT_DISCARD", {
|
AnalyticsUtil.logEvent("GIT_DISCARD", {
|
||||||
source: "GIT_DISCARD_BUTTON_PRESS_2",
|
source: "GIT_DISCARD_BUTTON_PRESS_2",
|
||||||
});
|
});
|
||||||
discard();
|
discard(createMessage(DISCARD_CHANGES));
|
||||||
setShowDiscardWarning(false);
|
setShowDiscardWarning(false);
|
||||||
setShouldDiscard(true);
|
setShouldDiscard(true);
|
||||||
setIsDiscarding(true);
|
setIsDiscarding(true);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import {
|
||||||
AUTOCOMMIT_IN_PROGRESS_MESSAGE,
|
AUTOCOMMIT_IN_PROGRESS_MESSAGE,
|
||||||
COMMIT_CHANGES,
|
COMMIT_CHANGES,
|
||||||
createMessage,
|
createMessage,
|
||||||
|
DISCARD_AND_PULL_SUCCESS,
|
||||||
GIT_SETTINGS,
|
GIT_SETTINGS,
|
||||||
MERGE,
|
MERGE,
|
||||||
} from "ee/constants/messages";
|
} from "ee/constants/messages";
|
||||||
|
|
@ -27,7 +28,7 @@ const Container = styled.div`
|
||||||
|
|
||||||
interface QuickActionsViewProps {
|
interface QuickActionsViewProps {
|
||||||
currentBranch: string | null;
|
currentBranch: string | null;
|
||||||
discard: () => void;
|
discard: (successMessage: string) => void;
|
||||||
isAutocommitEnabled: boolean;
|
isAutocommitEnabled: boolean;
|
||||||
isAutocommitPolling: boolean;
|
isAutocommitPolling: boolean;
|
||||||
isBranchPopupOpen: boolean;
|
isBranchPopupOpen: boolean;
|
||||||
|
|
@ -105,7 +106,7 @@ function QuickActionsView({
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isProtectedMode) {
|
if (isProtectedMode) {
|
||||||
discard();
|
discard(createMessage(DISCARD_AND_PULL_SUCCESS));
|
||||||
} else {
|
} else {
|
||||||
pull();
|
pull();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,20 @@ export default function useDiscard() {
|
||||||
|
|
||||||
const discardState = useArtifactSelector(selectDiscardState);
|
const discardState = useArtifactSelector(selectDiscardState);
|
||||||
|
|
||||||
const discard = useCallback(() => {
|
const discard = useCallback(
|
||||||
|
(successMessage: string) => {
|
||||||
if (artifactDef && artifactId) {
|
if (artifactDef && artifactId) {
|
||||||
dispatch(gitArtifactActions.discardInit({ artifactDef, artifactId }));
|
dispatch(
|
||||||
|
gitArtifactActions.discardInit({
|
||||||
|
artifactDef,
|
||||||
|
artifactId,
|
||||||
|
successMessage,
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, [artifactDef, artifactId, dispatch]);
|
},
|
||||||
|
[artifactDef, artifactId, dispatch],
|
||||||
|
);
|
||||||
|
|
||||||
const clearDiscardError = useCallback(() => {
|
const clearDiscardError = useCallback(() => {
|
||||||
if (artifactDef) {
|
if (artifactDef) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { toast } from "@appsmith/ads";
|
import { toast } from "@appsmith/ads";
|
||||||
import { captureException } from "@sentry/react";
|
import { captureException } from "@sentry/react";
|
||||||
import { builderURL } from "ee/RouteBuilder";
|
import { builderURL } from "ee/RouteBuilder";
|
||||||
import { createMessage, DISCARD_SUCCESS } from "ee/constants/messages";
|
|
||||||
import discardRequest from "git/requests/discardRequest";
|
import discardRequest from "git/requests/discardRequest";
|
||||||
import type { DiscardResponse } from "git/requests/discardRequest.types";
|
import type { DiscardResponse } from "git/requests/discardRequest.types";
|
||||||
import type { DiscardInitPayload } from "git/store/actions/discardActions";
|
import type { DiscardInitPayload } from "git/store/actions/discardActions";
|
||||||
|
|
@ -15,7 +14,7 @@ import { validateResponse } from "sagas/ErrorSagas";
|
||||||
export default function* discardSaga(
|
export default function* discardSaga(
|
||||||
action: GitArtifactPayloadAction<DiscardInitPayload>,
|
action: GitArtifactPayloadAction<DiscardInitPayload>,
|
||||||
) {
|
) {
|
||||||
const { artifactDef, artifactId } = action.payload;
|
const { artifactDef, artifactId, successMessage } = action.payload;
|
||||||
|
|
||||||
let response: DiscardResponse | undefined;
|
let response: DiscardResponse | undefined;
|
||||||
|
|
||||||
|
|
@ -34,9 +33,11 @@ export default function* discardSaga(
|
||||||
|
|
||||||
if (response && isValidResponse) {
|
if (response && isValidResponse) {
|
||||||
yield put(gitArtifactActions.discardSuccess({ artifactDef }));
|
yield put(gitArtifactActions.discardSuccess({ artifactDef }));
|
||||||
toast.show(createMessage(DISCARD_SUCCESS), {
|
|
||||||
kind: "success",
|
if (successMessage) {
|
||||||
});
|
toast.show(successMessage, { kind: "success" });
|
||||||
|
}
|
||||||
|
|
||||||
// adding delay to show toast animation before reloading
|
// adding delay to show toast animation before reloading
|
||||||
yield delay(500);
|
yield delay(500);
|
||||||
const basePageId: string =
|
const basePageId: string =
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ import { APP_MODE } from "entities/App";
|
||||||
import log from "loglevel";
|
import log from "loglevel";
|
||||||
import { captureException } from "@sentry/react";
|
import { captureException } from "@sentry/react";
|
||||||
import { selectGitApiContractsEnabled } from "git/store/selectors/gitFeatureFlagSelectors";
|
import { selectGitApiContractsEnabled } from "git/store/selectors/gitFeatureFlagSelectors";
|
||||||
|
import { toast } from "@appsmith/ads";
|
||||||
|
import { createMessage, DISCARD_AND_PULL_SUCCESS } from "ee/constants/messages";
|
||||||
|
|
||||||
export default function* pullSaga(
|
export default function* pullSaga(
|
||||||
action: GitArtifactPayloadAction<PullInitPayload>,
|
action: GitArtifactPayloadAction<PullInitPayload>,
|
||||||
|
|
@ -50,6 +52,10 @@ export default function* pullSaga(
|
||||||
mode: APP_MODE.EDIT,
|
mode: APP_MODE.EDIT,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
toast.show(createMessage(DISCARD_AND_PULL_SUCCESS), {
|
||||||
|
kind: "success",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (response && response.responseMeta.error) {
|
if (response && response.responseMeta.error) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
|
import { toast } from "@appsmith/ads";
|
||||||
import { captureException } from "@sentry/react";
|
import { captureException } from "@sentry/react";
|
||||||
|
import { createMessage, PROTECT_BRANCH_SUCCESS } from "ee/constants/messages";
|
||||||
import updateProtectedBranchesRequest from "git/requests/updateProtectedBranchesRequest";
|
import updateProtectedBranchesRequest from "git/requests/updateProtectedBranchesRequest";
|
||||||
import type {
|
import type {
|
||||||
UpdateProtectedBranchesRequestParams,
|
UpdateProtectedBranchesRequestParams,
|
||||||
|
|
@ -41,6 +43,10 @@ export default function* updateProtectedBranchesSaga(
|
||||||
gitArtifactActions.updateProtectedBranchesSuccess({ artifactDef }),
|
gitArtifactActions.updateProtectedBranchesSuccess({ artifactDef }),
|
||||||
);
|
);
|
||||||
yield put(gitArtifactActions.fetchProtectedBranchesInit({ artifactDef }));
|
yield put(gitArtifactActions.fetchProtectedBranchesInit({ artifactDef }));
|
||||||
|
|
||||||
|
toast.show(createMessage(PROTECT_BRANCH_SUCCESS), {
|
||||||
|
kind: "success",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (response && response.responseMeta.error) {
|
if (response && response.responseMeta.error) {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import type {
|
||||||
|
|
||||||
export interface DiscardInitPayload extends GitArtifactBasePayload {
|
export interface DiscardInitPayload extends GitArtifactBasePayload {
|
||||||
artifactId: string;
|
artifactId: string;
|
||||||
|
successMessage?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const discardInitAction = createArtifactAction<DiscardInitPayload>(
|
export const discardInitAction = createArtifactAction<DiscardInitPayload>(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user