fix: gsheets all sheets option enabled behind a feature flag (#37942)

## Description
This PR adds back all sheets option which had been removed in PR:
https://github.com/appsmithorg/appsmith/pull/36125


Fixes #38002
_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.Datasource, @tag.Widget"

### 🔍 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/12311024852>
> Commit: e177b648fd593b8ccc8af88c6d90c3958d7c9752
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12311024852&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Datasource, @tag.Widget`
> Spec:
> <hr>Fri, 13 Dec 2024 08:27:08 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added new options for Google Sheets permissions, enhancing user
selection capabilities.
- Introduced a feature flag to control the visibility of new Google
Sheets options.
	
- **Bug Fixes**
- Improved handling of feature flags in the datasource section
rendering, ensuring correct visibility based on flags.

- **Documentation**
- Updated test specifications for Google Sheets datasource to include
new dropdown options.

- **Chores**
- Enhanced the logic for setting default values in the
RadioButtonControl component.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: “sneha122” <“sneha@appsmith.com”>
Co-authored-by: Alex Golovanov <alex@appsmith.com>
This commit is contained in:
sneha122 2024-12-13 14:09:53 +05:30 committed by GitHub
parent 6eb44a11c7
commit 88ec7c7c50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 70 additions and 3 deletions

View File

@ -1,3 +1,4 @@
import { featureFlagIntercept } from "../../../../support/Objects/FeatureFlags";
import {
dataSources,
deployMode,
@ -23,6 +24,13 @@ describe(
function () {
let pluginName = "Google Sheets";
before(() => {
// intercept features call gsheet all sheets disabled
featureFlagIntercept({
release_gs_all_sheets_options_enabled: false,
});
});
it("1. Verify GSheets dropdown options", function () {
dataSources.NavigateToDSCreateNew();
dataSources.CreatePlugIn("Google Sheets");

View File

@ -24,6 +24,7 @@ class Response {
}
public openResponseTypeMenu() {
this.switchToResponseTab();
cy.get(this.locators.responseDataContainer).realHover();
cy.get(this.locators.responseTypeMenuTrigger).click({ force: true });
}
@ -46,6 +47,7 @@ class Response {
}
public validateResponseStatus(status: string): void {
this.switchToResponseTab();
cy.get(this.locators.responseStatusInfo).trigger("mouseover");
cy.get(this.locators.responseStatusInfoTooltip).should(
"include.text",

View File

@ -46,6 +46,8 @@ export const FEATURE_FLAG = {
release_evaluation_scope_cache: "release_evaluation_scope_cache",
release_table_html_column_type_enabled:
"release_table_html_column_type_enabled",
release_gs_all_sheets_options_enabled:
"release_gs_all_sheets_options_enabled",
} as const;
export type FeatureFlag = keyof typeof FEATURE_FLAG;
@ -86,6 +88,7 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = {
ab_request_new_integration_enabled: false,
release_evaluation_scope_cache: false,
release_table_html_column_type_enabled: false,
release_gs_all_sheets_options_enabled: false,
};
export const AB_TESTING_EVENT_KEYS = {

View File

@ -44,7 +44,10 @@ function renderComponent(props: renderComponentProps) {
};
const options = props.options || [];
const defaultValue = props.initialValue as string;
const selectedValue = props.input?.value;
const defaultValue = !!selectedValue
? selectedValue
: (props.initialValue as string);
return (
<StyledRadioGroup

View File

@ -21,6 +21,7 @@ import { isMultipleEnvEnabled } from "ee/utils/planHelpers";
import { selectFeatureFlags } from "ee/selectors/featureFlagsSelectors";
import { Text } from "@appsmith/ads";
import { Table } from "@appsmith/ads-old";
import type { FeatureFlags } from "ee/entities/FeatureFlag";
const Key = styled.div`
color: var(--ads-v2-color-fg-muted);
@ -69,6 +70,7 @@ interface RenderDatasourceSectionProps {
showOnlyCurrentEnv?: boolean;
currentEnv: string;
isEnvEnabled: boolean;
featureFlags?: FeatureFlags;
}
const renderKVArray = (
// TODO: Fix this the next time the file is edited
@ -140,6 +142,7 @@ export function renderDatasourceSection(
currentEnvironment: string,
datasource: Datasource,
viewMode: boolean | undefined,
featureFlags?: FeatureFlags,
) {
return (
<React.Fragment key={datasource.id}>
@ -148,7 +151,7 @@ export function renderDatasourceSection(
isHidden(
datasource.datasourceStorages[currentEnvironment],
section.hidden,
undefined,
featureFlags,
viewMode,
)
)
@ -168,6 +171,7 @@ export function renderDatasourceSection(
currentEnvironment,
datasource,
viewMode,
featureFlags,
);
} else {
try {
@ -320,6 +324,7 @@ class RenderDatasourceInformation extends React.Component<RenderDatasourceSectio
config,
currentEnv,
datasource,
featureFlags,
isEnvEnabled,
showOnlyCurrentEnv,
viewMode,
@ -333,7 +338,13 @@ class RenderDatasourceInformation extends React.Component<RenderDatasourceSectio
return null;
}
return renderDatasourceSection(config, currentEnv, datasource, viewMode);
return renderDatasourceSection(
config,
currentEnv,
datasource,
viewMode,
featureFlags,
);
}
return (
@ -357,10 +368,12 @@ const mapStateToProps = (state: AppState, ownProps: any) => {
? false
: isMultipleEnvEnabled(selectFeatureFlags(state));
const currentEnvironmentId = getCurrentEnvironmentId(state);
const featureFlags = selectFeatureFlags(state);
return {
currentEnv: isEnvEnabled ? currentEnvironmentId : getDefaultEnvId(),
isEnvEnabled,
featureFlags,
};
};

View File

@ -15,6 +15,7 @@ public enum FeatureFlagEnum {
release_embed_hide_share_settings_enabled,
rollout_datasource_test_rate_limit_enabled,
release_google_sheets_shared_drive_support_enabled,
release_gs_all_sheets_options_enabled,
// Deprecated CE flags over here
release_git_autocommit_feature_enabled,

View File

@ -38,11 +38,48 @@
{
"label": "Read / Write / Delete | Selected google sheets",
"value": "https://www.googleapis.com/auth/drive.file"
},
{
"label": "Read / Write / Delete | All google sheets",
"value": "https://www.googleapis.com/auth/spreadsheets,https://www.googleapis.com/auth/drive"
},
{
"label": "Read / Write | All google sheets",
"value": "https://www.googleapis.com/auth/spreadsheets,https://www.googleapis.com/auth/drive.readonly"
},
{
"label": "Read | All google sheets",
"value": "https://www.googleapis.com/auth/spreadsheets.readonly,https://www.googleapis.com/auth/drive.readonly"
}
],
"initialValue": "https://www.googleapis.com/auth/drive.file",
"customStyles": {
"width": "340px"
},
"hidden": {
"flagValue": "release_gs_all_sheets_options_enabled",
"comparison": "FEATURE_FLAG",
"value": false
}
},
{
"label": "Permissions | Scope",
"configProperty": "datasourceConfiguration.authentication.scopeString",
"controlType": "RADIO_BUTTON",
"options": [
{
"label": "Read / Write / Delete | Selected google sheets",
"value": "https://www.googleapis.com/auth/drive.file"
}
],
"initialValue": "https://www.googleapis.com/auth/drive.file",
"customStyles": {
"width": "340px"
},
"hidden": {
"flagValue": "release_gs_all_sheets_options_enabled",
"comparison": "FEATURE_FLAG",
"value": true
}
}
]