Skip to content

Commit

Permalink
fix: removing autocommit feature flag from UI
Browse files Browse the repository at this point in the history
  • Loading branch information
brayn003 committed Sep 17, 2024
1 parent eb7f1b1 commit 77a8962
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions app/client/src/ce/entities/FeatureFlag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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",
});
Expand All @@ -94,20 +89,19 @@ function DangerZone() {
}),
);
dispatch(setIsDisconnectGitModalOpen(true));
};
}, [currentApp?.id, currentApp?.name, dispatch]);

const handleToggleAutocommit = () => {
const handleToggleAutocommit = useCallback(() => {
if (isAutocommitEnabled) {
dispatch(setGitSettingsModalOpenAction({ open: false }));
dispatch(setIsAutocommitModalOpen(true));
} else {
dispatch(toggleAutocommitEnabledInit());
AnalyticsUtil.logEvent("GS_AUTO_COMMIT_ENABLED");
}
};
}, [dispatch, isAutocommitEnabled]);

const showAutoCommit =
isAutocommitFeatureEnabled && isManageAutoCommitPermitted;
const showAutoCommit = isManageAutoCommitPermitted;
const showDisconnect = isConnectToGitPermitted;
const showDivider = showAutoCommit && showDisconnect;

Expand Down
37 changes: 16 additions & 21 deletions app/client/src/pages/Editor/gitSync/QuickGitActions/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo } from "react";
import React, { useCallback, useMemo } from "react";
import styled from "styled-components";

import BranchButton from "./BranchButton";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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 (
<OuterContainer>
<Tooltip content={tooltipContent} isDisabled={!isTooltipEnabled}>
Expand All @@ -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)}
Expand All @@ -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;
Expand Down Expand Up @@ -375,9 +372,7 @@ export default function QuickGitActions() {
return isGitConnected ? (
<Container>
<BranchButton />
{isAutocommitFeatureEnabled &&
isAutocommitEnabled &&
isPollingAutocommit ? (
{isAutocommitEnabled && isPollingAutocommit ? (
<AutocommitStatusbar completed={!isPollingAutocommit} />
) : (
quickActionButtons.map((button) => (
Expand Down
8 changes: 1 addition & 7 deletions app/client/src/sagas/GitSyncSagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 77a8962

Please sign in to comment.