diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitBranchProtect_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitBranchProtect_spec.ts index 91f342963c..5f53ebffac 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitBranchProtect_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitBranchProtect_spec.ts @@ -2,37 +2,9 @@ import { featureFlagIntercept } from "../../../../../support/Objects/FeatureFlag import * as _ from "../../../../../support/Objects/ObjectsCore"; let guid: any; -let repoName1: any; -let repoName2: any; +let repoName: any; describe("Git Branch Protection", function () { - it("Issue 28056 - 1 : Check if protection is not enabled when feature flag is disabled", function () { - _.agHelper.GenerateUUID(); - cy.get("@guid").then((uid) => { - guid = uid; - const wsName = "GitBranchProtect-1" + uid; - const appName = "GitBranchProtect-1" + uid; - _.homePage.CreateNewWorkspace(wsName, true); - _.homePage.CreateAppInWorkspace(wsName, appName); - featureFlagIntercept({ - release_git_connect_v2_enabled: true, - release_git_branch_protection_enabled: false, - }); - cy.wait(1000); - _.gitSync.CreateNConnectToGitV2(); - cy.get("@gitRepoName").then((repName) => { - repoName1 = repName; - _.agHelper.AssertElementExist(_.entityExplorer._entityExplorerWrapper); - _.agHelper.AssertElementExist(_.propPane._propertyPaneSidebar); - _.agHelper.AssertElementEnabledDisabled( - _.gitSync._bottomBarCommit, - 0, - false, - ); - }); - }); - }); - it("Issue 28056 - 2 : Check if protection is enabled when feature flag is enabled", function () { _.agHelper.GenerateUUID(); cy.get("@guid").then((uid) => { @@ -43,7 +15,6 @@ describe("Git Branch Protection", function () { _.homePage.CreateAppInWorkspace(wsName, appName); featureFlagIntercept({ release_git_connect_v2_enabled: true, - release_git_branch_protection_enabled: true, }); cy.wait(1000); @@ -54,7 +25,7 @@ describe("Git Branch Protection", function () { _.gitSync.CreateNConnectToGitV2(); cy.get("@gitRepoName").then((repName) => { - repoName2 = repName; + repoName = repName; cy.wait("@gitProtectApi").then((res1) => { expect(res1.response).to.have.property("statusCode", 200); _.agHelper.AssertElementVisibility( @@ -76,7 +47,6 @@ describe("Git Branch Protection", function () { }); after(() => { - _.gitSync.DeleteTestGithubRepo(repoName1); - _.gitSync.DeleteTestGithubRepo(repoName2); + _.gitSync.DeleteTestGithubRepo(repoName); }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitConnectV2_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitConnectV2_spec.ts index 79950ddb47..cfcc878870 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitConnectV2_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitConnectV2_spec.ts @@ -5,6 +5,7 @@ let ws1Name: string; let ws2Name: string; let app1Name: string; let repoName: any; +let branchName: any; describe("Git Connect V2", function () { before(() => { @@ -36,17 +37,21 @@ describe("Git Connect V2", function () { release_git_connect_v2_enabled: true, }); - _.entityExplorer.DragDropWidgetNVerify(_.draggableWidgets.TEXT, 300, 300); - _.propPane.RenameWidget("Text1", "MyText"); - _.propPane.UpdatePropertyFieldValue("Text", "Hello World"); - _.gitSync.CommitAndPush(); + _.gitSync.CreateGitBranch("test", true); + cy.get("@gitbranchName").then((bName) => { + branchName = bName; + _.entityExplorer.DragDropWidgetNVerify(_.draggableWidgets.TEXT, 300, 300); + _.propPane.RenameWidget("Text1", "MyText"); + _.propPane.UpdatePropertyFieldValue("Text", "Hello World"); + _.gitSync.CommitAndPush(); - _.gitSync.ImportAppFromGitV2(ws2Name, repoName); - - _.entityExplorer.ExpandCollapseEntity("Widgets"); - _.entityExplorer.AssertEntityPresenceInExplorer("MyText"); - _.entityExplorer.SelectEntityByName("MyText"); - _.propPane.ValidatePropertyFieldValue("Text", "Hello World"); + _.gitSync.ImportAppFromGitV2(ws2Name, repoName); + _.gitSync.SwitchGitBranch(branchName); + _.entityExplorer.ExpandCollapseEntity("Widgets"); + _.entityExplorer.AssertEntityPresenceInExplorer("MyText"); + _.entityExplorer.SelectEntityByName("MyText"); + _.propPane.ValidatePropertyFieldValue("Text", "Hello World"); + }); }); after(() => { diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts index 5a075b4d37..1b27f43a3c 100644 --- a/app/client/src/ce/constants/messages.ts +++ b/app/client/src/ce/constants/messages.ts @@ -1034,7 +1034,7 @@ export const ADD_DEPLOY_KEY_STEP_TITLE = () => export const HOW_TO_ADD_DEPLOY_KEY = () => "How to paste SSH Key in repo and give write access?"; export const CONSENT_ADDED_DEPLOY_KEY = () => - "I've added deploy key and gave it write access"; + "I've added the deploy key and gave it write access"; export const PREVIOUS_STEP = () => "Previous step"; export const GIT_CONNECT_SUCCESS_TITLE = () => "Successfully connected to your Git remote repository"; @@ -1083,7 +1083,7 @@ export const BRANCH_PROTECTION_CHANGE_RULE = () => "You can remove protection on your default branch in Git settings."; export const BRANCH_TOOLTIP_TITLE = () => "🚫 This is a protected branch"; export const BRANCH_TOOLTIP_MESSAGE = () => - "You can remove protection on your default branch in Git settings."; + "Please create a new branch or checkout an existing one to edit the app."; export const GO_TO_SETTINGS = () => "Go to settings"; export const NOW_PROTECT_BRANCH = () => "You can now protect your default branch."; diff --git a/app/client/src/ce/entities/FeatureFlag.ts b/app/client/src/ce/entities/FeatureFlag.ts index 3eeb97db63..c6eb13dde0 100644 --- a/app/client/src/ce/entities/FeatureFlag.ts +++ b/app/client/src/ce/entities/FeatureFlag.ts @@ -28,8 +28,6 @@ export const FEATURE_FLAG = { ab_show_templates_instead_of_blank_canvas_enabled: "ab_show_templates_instead_of_blank_canvas_enabled", release_app_sidebar_enabled: "release_app_sidebar_enabled", - release_git_branch_protection_enabled: - "release_git_branch_protection_enabled", license_git_branch_protection_enabled: "license_git_branch_protection_enabled", license_widget_rtl_support_enabled: "license_widget_rtl_support_enabled", @@ -66,7 +64,6 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = { release_anvil_enabled: false, ab_show_templates_instead_of_blank_canvas_enabled: false, release_app_sidebar_enabled: false, - release_git_branch_protection_enabled: false, license_git_branch_protection_enabled: false, license_widget_rtl_support_enabled: false, ab_onboarding_flow_start_with_data_dev_only_enabled: false, diff --git a/app/client/src/ce/utils/analyticsUtilTypes.ts b/app/client/src/ce/utils/analyticsUtilTypes.ts index 0659596ff1..684f7b0861 100644 --- a/app/client/src/ce/utils/analyticsUtilTypes.ts +++ b/app/client/src/ce/utils/analyticsUtilTypes.ts @@ -185,6 +185,9 @@ export type EventName = | "GS_GENERATE_KEY_BUTTON_CLICK" | "GS_CONNECT_BUTTON_ON_GIT_SYNC_MODAL_CLICK" | "GS_START_USING_GIT" + | "GS_DEFAULT_BRANCH_UPDATE" + | "GS_PROTECTED_BRANCHES_UPDATE" + | "GS_OPEN_GIT_SETTINGS" | "GIT_DISCARD_WARNING" | "GIT_DISCARD_CANCEL" | "GIT_DISCARD" diff --git a/app/client/src/constants/ThirdPartyConstants.tsx b/app/client/src/constants/ThirdPartyConstants.tsx index 2c995eab26..f03e68f827 100644 --- a/app/client/src/constants/ThirdPartyConstants.tsx +++ b/app/client/src/constants/ThirdPartyConstants.tsx @@ -27,6 +27,10 @@ export const PROVISIONING_SETUP_DOC = "http://docs.appsmith.com/advanced-concepts/user-provisioning-group-sync"; export const DISCORD_URL = "https://discord.gg/rBTTVJp"; export const ENTERPRISE_PRICING_PAGE = "https://www.appsmith.com/enterprise"; +export const DOCS_BRANCH_PROTECTION_URL = + "https://docs.appsmith.com/advanced-concepts/version-control-with-git/working-with-branches#branch-protection"; +export const DOCS_DEFAULT_BRANCH_URL = + "https://docs.appsmith.com/advanced-concepts/version-control-with-git/working-with-branches#default-branch"; export const PRICING_PAGE_URL = ( URL: string, diff --git a/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx b/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx index 5ef6f74b52..a2176be174 100644 --- a/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx +++ b/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx @@ -130,18 +130,11 @@ function QuickActionButton({ ); } -const getPullBtnStatus = ( - gitStatus: any, - pullFailed: boolean, - isProtected: boolean, -) => { +const getPullBtnStatus = (gitStatus: any, pullFailed: boolean) => { const { behindCount, isClean } = gitStatus || {}; let message = createMessage(NO_COMMITS_TO_PULL); let disabled = behindCount === 0; - if (isProtected) { - disabled = false; - message = createMessage(PULL_CHANGES); - } else if (!isClean) { + if (!isClean) { disabled = true; message = createMessage(CANNOT_PULL_WITH_LOCAL_UNCOMMITTED_CHANGES); } else if (pullFailed) { @@ -322,7 +315,7 @@ export default function QuickGitActions() { const isProtectedMode = useSelector(protectedModeSelector); const { disabled: pullDisabled, message: pullTooltipMessage } = - getPullBtnStatus(gitStatus, !!pullFailed, isProtectedMode); + getPullBtnStatus(gitStatus, !!pullFailed); const isPullInProgress = useSelector(getPullInProgress); const isFetchingGitStatus = useSelector(getIsFetchingGitStatus); diff --git a/app/client/src/pages/Editor/gitSync/Tabs/ConnectionSuccess.tsx b/app/client/src/pages/Editor/gitSync/Tabs/ConnectionSuccess.tsx index 83f86190bf..6dca220f0a 100644 --- a/app/client/src/pages/Editor/gitSync/Tabs/ConnectionSuccess.tsx +++ b/app/client/src/pages/Editor/gitSync/Tabs/ConnectionSuccess.tsx @@ -8,7 +8,6 @@ import { BRANCH_PROTECTION_RULE_1, BRANCH_PROTECTION_RULE_2, BRANCH_PROTECTION_RULE_3, - GIT_CONNECT_SUCCESS_MESSAGE, GIT_CONNECT_SUCCESS_TITLE, OPEN_GIT_SETTINGS, START_USING_GIT, @@ -21,10 +20,6 @@ import { useDispatch, useSelector } from "react-redux"; import styled from "styled-components"; import { getCurrentAppGitMetaData } from "@appsmith/selectors/applicationSelectors"; import AnalyticsUtil from "utils/AnalyticsUtil"; -import { - getDefaultGitBranchName, - getIsGitProtectedFeatureEnabled, -} from "selectors/gitSyncSelectors"; const Container = styled.div``; @@ -77,10 +72,6 @@ const features = [ function ConnectionSuccess() { const gitMetadata = useSelector(getCurrentAppGitMetaData); - const defaultBranchName = useSelector(getDefaultGitBranchName); - const isGitProtectedFeatureEnabled = useSelector( - getIsGitProtectedFeatureEnabled, - ); const dispatch = useDispatch(); useEffect(() => { @@ -105,24 +96,20 @@ function ConnectionSuccess() { tab: GitSyncModalTab.SETTINGS, }), ); - AnalyticsUtil.logEvent("GS_START_USING_GIT", { + AnalyticsUtil.logEvent("GS_OPEN_GIT_SETTINGS", { repoUrl: gitMetadata?.remoteUrl, }); }; - const preBranchProtectionContent = () => { - return ( - {createMessage(GIT_CONNECT_SUCCESS_MESSAGE)} - ); - }; - - const postBranchProtectionContent = () => { + const branchProtectionContent = () => { return ( <> Right now,{" "} - {defaultBranchName} is set - as the default branch and it is protected. + + {gitMetadata?.defaultBranchName} + {" "} + is set as the default branch and it is protected. {createMessage(BRANCH_PROTECTION_RULES_AS_FOLLOWS)} @@ -144,19 +131,7 @@ function ConnectionSuccess() { ); }; - const preBranchProtectionActions = () => { - return ( - - ); - }; - - const postBranchProtectionActions = () => { + const branchProtectionActions = () => { return ( <>