From 77a8962d13fb74f278dcbec9ed5ee62790512693 Mon Sep 17 00:00:00 2001 From: brayn003 Date: Tue, 17 Sep 2024 14:52:19 +0800 Subject: [PATCH] fix: removing autocommit feature flag from UI --- .../ClientSide/Git/GitAutocommit_spec.ts | 3 -- app/client/src/ce/entities/FeatureFlag.ts | 3 -- .../PartialExportModal/unitTestUtils.ts | 1 - .../TabGeneral/DangerZone.tsx | 18 +++------ .../Editor/gitSync/QuickGitActions/index.tsx | 37 ++++++++----------- app/client/src/sagas/GitSyncSagas.ts | 8 +--- 6 files changed, 23 insertions(+), 47 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitAutocommit_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Git/GitAutocommit_spec.ts index 724e9c72a04..83ea4255df9 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Git/GitAutocommit_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Git/GitAutocommit_spec.ts @@ -14,9 +14,6 @@ describe( { tags: ["@tag.Git", "@tag.GitAutocommit", "@tag.excludeForAirgap"] }, function () { it("Check if autocommit progress bar is visible and network requests are properly called", function () { - featureFlagIntercept({ - release_git_autocommit_feature_enabled: true, - }); agHelper.GenerateUUID(); cy.get("@guid").then((uid) => { wsName = "GitAC-" + uid; diff --git a/app/client/src/ce/entities/FeatureFlag.ts b/app/client/src/ce/entities/FeatureFlag.ts index 69ac4b7e9c6..63d49c89f77 100644 --- a/app/client/src/ce/entities/FeatureFlag.ts +++ b/app/client/src/ce/entities/FeatureFlag.ts @@ -21,8 +21,6 @@ export const FEATURE_FLAG = { "license_git_branch_protection_enabled", license_git_continuous_delivery_enabled: "license_git_continuous_delivery_enabled", - release_git_autocommit_feature_enabled: - "release_git_autocommit_feature_enabled", license_widget_rtl_support_enabled: "license_widget_rtl_support_enabled", ab_one_click_learning_popover_enabled: "ab_one_click_learning_popover_enabled", @@ -68,7 +66,6 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = { release_drag_drop_building_blocks_enabled: false, release_table_cell_label_value_enabled: false, license_git_branch_protection_enabled: false, - release_git_autocommit_feature_enabled: false, license_git_continuous_delivery_enabled: false, license_widget_rtl_support_enabled: false, ab_one_click_learning_popover_enabled: false, diff --git a/app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts b/app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts index d066f825510..8e635c41e4a 100644 --- a/app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts +++ b/app/client/src/components/editorComponents/PartialImportExport/PartialExportModal/unitTestUtils.ts @@ -12769,7 +12769,6 @@ export const defaultAppState = { release_anvil_enabled: false, release_app_sidebar_enabled: false, license_git_branch_protection_enabled: false, - release_git_autocommit_feature_enabled: true, license_widget_rtl_support_enabled: false, release_show_new_sidebar_announcement_enabled: false, rollout_app_sidebar_enabled: false, diff --git a/app/client/src/pages/Editor/gitSync/GitSettingsModal/TabGeneral/DangerZone.tsx b/app/client/src/pages/Editor/gitSync/GitSettingsModal/TabGeneral/DangerZone.tsx index d7f5a870147..109e8fae298 100644 --- a/app/client/src/pages/Editor/gitSync/GitSettingsModal/TabGeneral/DangerZone.tsx +++ b/app/client/src/pages/Editor/gitSync/GitSettingsModal/TabGeneral/DangerZone.tsx @@ -15,9 +15,8 @@ import { setIsDisconnectGitModalOpen, setGitSettingsModalOpenAction, } from "actions/gitSyncActions"; -import { FEATURE_FLAG } from "ee/entities/FeatureFlag"; import { Button, Divider, Text } from "@appsmith/ads"; -import React from "react"; +import React, { useCallback } from "react"; import { useDispatch, useSelector } from "react-redux"; import { getAutocommitEnabledSelector, @@ -26,7 +25,6 @@ import { } from "selectors/gitSyncSelectors"; import styled from "styled-components"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; -import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; import { useHasConnectToGitPermission, useHasManageAutoCommitPermission, @@ -71,9 +69,6 @@ const StyledDivider = styled(Divider)` function DangerZone() { const isConnectToGitPermitted = useHasConnectToGitPermission(); const isManageAutoCommitPermitted = useHasManageAutoCommitPermission(); - const isAutocommitFeatureEnabled = useFeatureFlag( - FEATURE_FLAG.release_git_autocommit_feature_enabled, - ); const isAutocommitToggling = useSelector(getIsAutocommitToggling); const isAutocommitEnabled = useSelector(getAutocommitEnabledSelector); const gitMetadataLoading = useSelector(getGitMetadataLoadingSelector); @@ -82,7 +77,7 @@ function DangerZone() { const currentApp = useSelector(getCurrentApplication); - const handleDisconnect = () => { + const handleDisconnect = useCallback(() => { AnalyticsUtil.logEvent("GS_DISCONNECT_GIT_CLICK", { source: "GIT_CONNECTION_MODAL", }); @@ -94,9 +89,9 @@ function DangerZone() { }), ); dispatch(setIsDisconnectGitModalOpen(true)); - }; + }, [currentApp?.id, currentApp?.name, dispatch]); - const handleToggleAutocommit = () => { + const handleToggleAutocommit = useCallback(() => { if (isAutocommitEnabled) { dispatch(setGitSettingsModalOpenAction({ open: false })); dispatch(setIsAutocommitModalOpen(true)); @@ -104,10 +99,9 @@ function DangerZone() { dispatch(toggleAutocommitEnabledInit()); AnalyticsUtil.logEvent("GS_AUTO_COMMIT_ENABLED"); } - }; + }, [dispatch, isAutocommitEnabled]); - const showAutoCommit = - isAutocommitFeatureEnabled && isManageAutoCommitPermitted; + const showAutoCommit = isManageAutoCommitPermitted; const showDisconnect = isConnectToGitPermitted; const showDivider = showAutoCommit && showDisconnect; diff --git a/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx b/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx index b70cd6363e5..1727f3f0d10 100644 --- a/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx +++ b/app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx @@ -1,4 +1,4 @@ -import React, { useMemo } from "react"; +import React, { useCallback, useMemo } from "react"; import styled from "styled-components"; import BranchButton from "./BranchButton"; @@ -43,8 +43,6 @@ import SpinnerLoader from "pages/common/SpinnerLoader"; import { getTypographyByKey } from "@appsmith/ads-old"; import { Button, Icon, Tooltip } from "@appsmith/ads"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; -import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; -import { FEATURE_FLAG } from "ee/entities/FeatureFlag"; import AutocommitStatusbar from "./AutocommitStatusbar"; import { useHasConnectToGitPermission } from "../hooks/gitPermissionHooks"; import { GitSettingsTab } from "reducers/uiReducers/gitSyncReducer"; @@ -258,6 +256,19 @@ function ConnectGitPlaceholder() { ); }, [isConnectToGitPermitted]); + const handleClickOnGitConnect = useCallback(() => { + AnalyticsUtil.logEvent("GS_CONNECT_GIT_CLICK", { + source: "BOTTOM_BAR_GIT_CONNECT_BUTTON", + }); + + dispatch( + setIsGitSyncModalOpen({ + isOpen: true, + tab: GitSyncModalTab.GIT_CONNECTION, + }), + ); + }, [dispatch]); + return ( @@ -271,18 +282,7 @@ function ConnectGitPlaceholder() { className="t--connect-git-bottom-bar" isDisabled={!isConnectToGitPermitted} kind="secondary" - onClick={() => { - AnalyticsUtil.logEvent("GS_CONNECT_GIT_CLICK", { - source: "BOTTOM_BAR_GIT_CONNECT_BUTTON", - }); - - dispatch( - setIsGitSyncModalOpen({ - isOpen: true, - tab: GitSyncModalTab.GIT_CONNECTION, - }), - ); - }} + onClick={handleClickOnGitConnect} size="sm" > {createMessage(CONNECT_GIT_BETA)} @@ -308,9 +308,6 @@ export default function QuickGitActions() { const showPullLoadingState = isPullInProgress || isFetchingGitStatus; const changesToCommit = useSelector(getCountOfChangesToCommit); - const isAutocommitFeatureEnabled = useFeatureFlag( - FEATURE_FLAG.release_git_autocommit_feature_enabled, - ); const gitMetadata = useSelector(getGitMetadataSelector); const isPollingAutocommit = useSelector(getIsPollingAutocommit); const isAutocommitEnabled = gitMetadata?.autoCommitConfig?.enabled; @@ -375,9 +372,7 @@ export default function QuickGitActions() { return isGitConnected ? ( - {isAutocommitFeatureEnabled && - isAutocommitEnabled && - isPollingAutocommit ? ( + {isAutocommitEnabled && isPollingAutocommit ? ( ) : ( quickActionButtons.map((button) => ( diff --git a/app/client/src/sagas/GitSyncSagas.ts b/app/client/src/sagas/GitSyncSagas.ts index 8b7007533d1..0459326e1db 100644 --- a/app/client/src/sagas/GitSyncSagas.ts +++ b/app/client/src/sagas/GitSyncSagas.ts @@ -134,8 +134,6 @@ import type { Action } from "entities/Action"; import type { JSCollectionDataState } from "ee/reducers/entityReducers/jsActionsReducer"; import { toast } from "@appsmith/ads"; import { gitExtendedSagas } from "ee/sagas/GitExtendedSagas"; -import { selectFeatureFlagCheck } from "ee/selectors/featureFlagsSelectors"; -import { FEATURE_FLAG } from "ee/entities/FeatureFlag"; import type { ApplicationPayload } from "entities/Application"; export function* handleRepoLimitReachedError(response?: ApiResponse) { @@ -1252,13 +1250,9 @@ function* pollAutocommitProgressSaga(): any { } function* triggerAutocommitSaga() { - const isAutocommitFeatureEnabled: boolean = yield select( - selectFeatureFlagCheck, - FEATURE_FLAG.release_git_autocommit_feature_enabled, - ); const gitMetadata: GitMetadata = yield select(getGitMetadataSelector); const isAutocommitEnabled: boolean = !!gitMetadata?.autoCommitConfig?.enabled; - if (isAutocommitFeatureEnabled && isAutocommitEnabled) { + if (isAutocommitEnabled) { /* @ts-expect-error: not sure how to do typings of this */ const pollTask = yield fork(pollAutocommitProgressSaga); yield take(ReduxActionTypes.GIT_AUTOCOMMIT_STOP_PROGRESS_POLLING);