Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/client/cypress/e2e/GSheet/AllAccess_Spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="Cypress" />
import { GSHEET_DATA } from "../../fixtures/test-data-gsheet";
import { featureFlagIntercept } from "../../support/Objects/FeatureFlags";
import {
homePage,
gsheetHelper,
Expand All @@ -15,13 +16,17 @@ const workspaceName = "gsheet apps";
const dataSourceName = "gsheet-all";
let appName = "gsheet-app";
let spreadSheetName = "test-sheet";
describe.skip(
describe(
"GSheet-Functional Tests With All Access",
{
tags: ["@tag.Datasource", "@tag.GSheet", "@tag.Git", "@tag.AccessControl"],
},
function () {
before("Setup app and spreadsheet", function () {
// intercept features call gsheet all sheets enabled
featureFlagIntercept({
release_gs_all_sheets_options_enabled: true,
});
//Add a new app and an add new spreadsheet query
//Setting up the spreadsheet name
const uuid = Cypress._.random(0, 10000);
Expand Down
7 changes: 6 additions & 1 deletion app/client/cypress/e2e/GSheet/GsheetMisc_Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ import EditorNavigation, {
EntityType,
PageLeftPane,
} from "../../support/Pages/EditorNavigation";
import { featureFlagIntercept } from "../../support/Objects/FeatureFlags";
Comment thread
sneha122 marked this conversation as resolved.
Outdated

const workspaceName = "gsheet apps";
const dataSourceName = "gsheet-all";
let appName = "gsheet-app";
let spreadSheetName = "test-sheet";
describe.skip(
describe(
"GSheet Miscellaneous Tests",
{
tags: ["@tag.Datasource", "@tag.GSheet", "@tag.Git", "@tag.AccessControl"],
Expand All @@ -38,6 +39,10 @@ describe.skip(
"rowIndex",
];
before("Setup app and spreadsheet", function () {
// intercept features call gsheet all sheets enabled
featureFlagIntercept({
release_gs_all_sheets_options_enabled: true,
});
//Add a new app and an add new spreadsheet query
//Setting up the spreadsheet name
const uuid = Cypress._.random(0, 10000);
Expand Down
7 changes: 6 additions & 1 deletion app/client/cypress/e2e/GSheet/ReadNWrite_Access_Spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="Cypress" />
import { GSHEET_DATA } from "../../fixtures/test-data-gsheet";
import { featureFlagIntercept } from "../../support/Objects/FeatureFlags";
import {
homePage,
gsheetHelper,
Expand All @@ -11,7 +12,7 @@ import {
appSettings,
} from "../../support/Objects/ObjectsCore";

describe.skip(
describe(
"GSheet-Functional Tests With Read/Write Access",
{
tags: ["@tag.Datasource", "@tag.GSheet", "@tag.Git", "@tag.AccessControl"],
Expand All @@ -26,6 +27,10 @@ describe.skip(
let spreadSheetName = "test-sheet";

before("Setup app and spreadsheet", function () {
// intercept features call gsheet all sheets enabled
featureFlagIntercept({
release_gs_all_sheets_options_enabled: true,
});
//Add a new app and an add new spreadsheet query
//Setting up the spreadsheet name
const uuid = Cypress._.random(0, 10000);
Expand Down
7 changes: 6 additions & 1 deletion app/client/cypress/e2e/GSheet/ReadOnly_Access_Spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="Cypress" />
import { GSHEET_DATA } from "../../fixtures/test-data-gsheet";
import { featureFlagIntercept } from "../../support/Objects/FeatureFlags";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add feature flag setup in before hook

The feature flag is imported but not used. Add it to the before hook to properly enable the feature flag.

 before("Setup app and spreadsheet", function () {
+  featureFlagIntercept({
+    release_gs_all_sheets_options_enabled: true,
+  });
   //Add a new app and an add new spreadsheet query

Committable suggestion skipped: line range outside the PR's diff.

import {
homePage,
gsheetHelper,
Expand All @@ -11,7 +12,7 @@ import {
appSettings,
} from "../../support/Objects/ObjectsCore";

describe.skip(
describe(
"GSheet-Functional Tests With Read Access",
{
tags: ["@tag.Datasource", "@tag.GSheet", "@tag.Git", "@tag.AccessControl"],
Expand All @@ -26,6 +27,10 @@ describe.skip(
let spreadSheetName = "test-sheet";

before("Setup app and spreadsheet", function () {
// intercept features call gsheet all sheets enabled
featureFlagIntercept({
release_gs_all_sheets_options_enabled: true,
});
//Add a new app and an add new spreadsheet query
//Setting up the spreadsheet name
const uuid = Cypress._.random(0, 10000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,23 @@ import {
PageLeftPane,
PagePaneSegment,
} from "../../support/Pages/EditorNavigation";
import { featureFlagIntercept } from "../../support/Objects/FeatureFlags";

const workspaceName = "gsheet apps";
const dataSourceName = "gsheet-all";
let appName = "gsheet-app";
let spreadSheetName = "test-sheet";
describe.skip(
describe(
"GSheet-widget binding",
{
tags: ["@tag.Datasource", "@tag.GSheet", "@tag.Git", "@tag.AccessControl"],
},
function () {
before("Setup app and spreadsheet", function () {
// intercept features call gsheet all sheets enabled
featureFlagIntercept({
release_gs_all_sheets_options_enabled: true,
});
//Setting up the app name
const uuid = Cypress._.random(0, 10000);
spreadSheetName = spreadSheetName + "_" + uuid;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { featureFlagIntercept } from "../../../../support/Objects/FeatureFlags";
import {
dataSources,
deployMode,
Expand All @@ -23,15 +24,21 @@ 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");
VerifyFunctionDropdown([
"Read / Write / Delete | Selected google sheets",
// Hiding below methods as they are not authorized at this state
// "Read / Write / Delete | All google sheets",
// "Read / Write | All google sheets",
// "Read | All google sheets",
"Read / Write / Delete | All google sheets",
"Read / Write | All google sheets",
"Read | All google sheets",
]);
dataSources.SaveDSFromDialog(false);
});
Expand Down
3 changes: 3 additions & 0 deletions app/client/src/ce/entities/FeatureFlag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export const FEATURE_FLAG = {
"release_table_custom_loading_state_enabled",
release_custom_widget_ai_builder: "release_custom_widget_ai_builder",
ab_request_new_integration_enabled: "ab_request_new_integration_enabled",
release_gs_all_sheets_options_enabled:
"release_gs_all_sheets_options_enabled",
} as const;

export type FeatureFlag = keyof typeof FEATURE_FLAG;
Expand Down Expand Up @@ -81,6 +83,7 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = {
release_table_custom_loading_state_enabled: false,
release_custom_widget_ai_builder: false,
ab_request_new_integration_enabled: false,
release_gs_all_sheets_options_enabled: false,
};

export const AB_TESTING_EVENT_KEYS = {
Expand Down
2 changes: 2 additions & 0 deletions app/client/src/components/formControls/RadioButtonControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ function renderComponent(props: renderComponentProps) {

const options = props.options || [];
const defaultValue = props.initialValue as string;
const currentValue = props.input?.value;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider removing defaultValue when using value prop

While adding the value prop is a good practice for controlled components, having both defaultValue and value props might lead to unexpected behavior. The defaultValue prop is typically used for uncontrolled components, while value is for controlled components.

Consider this change:

  return (
    <StyledRadioGroup
      data-testid={props.input?.name}
-     defaultValue={defaultValue}
      onChange={onChangeHandler}
      value={currentValue}
    >

Also applies to: 55-55


return (
<StyledRadioGroup
data-testid={props.input?.name}
defaultValue={defaultValue}
onChange={onChangeHandler}
value={currentValue}
>
{options.map((option) => {
return (
Expand Down
17 changes: 15 additions & 2 deletions app/client/src/pages/Editor/DataSourceEditor/DatasourceSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -140,6 +142,7 @@ export function renderDatasourceSection(
currentEnvironment: string,
datasource: Datasource,
viewMode: boolean | undefined,
featureFlags?: FeatureFlags,
) {
return (
<React.Fragment key={datasource.id}>
Expand All @@ -148,7 +151,7 @@ export function renderDatasourceSection(
isHidden(
datasource.datasourceStorages[currentEnvironment],
section.hidden,
undefined,
featureFlags,
viewMode,
)
)
Expand All @@ -168,6 +171,7 @@ export function renderDatasourceSection(
currentEnvironment,
datasource,
viewMode,
featureFlags,
);
} else {
try {
Expand Down Expand Up @@ -320,6 +324,7 @@ class RenderDatasourceInformation extends React.Component<RenderDatasourceSectio
config,
currentEnv,
datasource,
featureFlags,
isEnvEnabled,
showOnlyCurrentEnv,
viewMode,
Expand All @@ -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 (
Expand All @@ -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,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
]
Expand Down