Skip to content

Commit

Permalink
chore: making autocommit GA (#36347)
Browse files Browse the repository at this point in the history
## Description
- Removal of release_git_autocommit_feature_enabled flag
- Removal of fallback implementation to classes which was autocommit
flag annotated
- Removal of irrelevant test cases post removal of fallback
implementation.


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## 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/10994151881>
> Commit: 42b43f1
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10994151881&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Git`
> Spec:
> <hr>Mon, 23 Sep 2024 12:53:01 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**
- Enhanced file operations for resource management in Git, including
methods for saving, deleting, and reading resources.
- Streamlined handling of auto-commit functionalities, making certain
features universally accessible.

- **Bug Fixes**
- Removed outdated fallback implementations for auto-commit eligibility
and Git auto-commit helpers.

- **Refactor**
- Simplified constructors and dependencies in file operation classes,
improving maintainability.
- Eliminated feature flag dependencies from various components,
including tests, focusing on core functionality.

- **Tests**
- Removed tests related to feature flags, streamlining the testing
process for auto-commit and migration functionalities.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: brayn003 <rudra@appsmith.com>
  • Loading branch information
sondermanish and brayn003 authored Sep 25, 2024
1 parent a93e87b commit 842443c
Show file tree
Hide file tree
Showing 25 changed files with 27,482 additions and 896 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ describe(
},
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 All @@ -128,7 +122,7 @@ function DangerZone() {
<Text renderAs="p">{createMessage(AUTOCOMMIT_MESSAGE)}</Text>
</BodyInnerContainer>
<Button
data-testid="t--git-disconnect-btn"
data-testid="t--git-autocommit-btn"
isLoading={isAutocommitToggling || gitMetadataLoading}
kind={isAutocommitEnabled ? "error" : "secondary"}
onClick={handleToggleAutocommit}
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 @@ -44,8 +44,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 @@ -262,6 +260,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 @@ -275,18 +286,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 Down Expand Up @@ -314,9 +314,6 @@ export default function QuickGitActions() {
isDiscardInProgress || 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 @@ -383,9 +380,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 @@ -1352,14 +1350,10 @@ 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);

Expand Down
Loading

0 comments on commit 842443c

Please sign in to comment.