Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app/client/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export REACT_APP_SENTRY_RELEASE=$GIT_SHA
export REACT_APP_CLIENT_LOG_LEVEL=ERROR
# Disable CRA built-in ESLint checks since we have our own config and a separate step for this
export DISABLE_ESLINT_PLUGIN=true
craco --max-old-space-size=7168 build --config craco.build.config.js
craco --max-old-space-size=8192 build --config craco.build.config.js

echo "build finished"
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe(
"Form1",
]);
// disable form validation
propPane.TogglePropertyState("Disabled invalid forms", "Off");
propPane.TogglePropertyState("Disable when form is invalid", "Off");
// set invalid text
agHelper.TypeText(clocators.inputField, fakerHelper.GetRandomNumber());
// assert submit button us enabled since disabled invalid form is off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe(
deployMode.NavigateBacktoEditor();
});

it("2. Disabled Invalid Forms - disables the submit button when form has invalid field(s)", () => {
it("2. Disable when form is invalid - disables the submit button when form has invalid field(s)", () => {
EditorNavigation.SelectEntityByName("JSONForm1", EntityType.Widget);

cy.get("button")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe(
const generalProperties1 = ["visible", "disabled", "animateloading"];

const formSettingsProperties = [
"disabledinvalidforms",
"disablewhenformisinvalid",
"resetformonsuccess",
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3530,7 +3530,7 @@
{
"helpText": "Disabled if the form is invalid, if this widget exists directly within a Form widget.",
"propertyName": "disabledWhenInvalid",
"label": "Disabled invalid forms",
"label": "Disable when form is invalid",
"controlType": "SWITCH",
"isJSConvertible": true,
"isBindProperty": true,
Expand Down Expand Up @@ -46238,7 +46238,7 @@
{
"propertyName": "disabledWhenInvalid",
"helpText": "Disables the submit button when the parent form has a required widget that is not filled",
"label": "Disabled invalid forms",
"label": "Disable when form is invalid",
"controlType": "SWITCH",
"isJSConvertible": true,
"isBindProperty": true,
Expand Down Expand Up @@ -54511,7 +54511,7 @@
{
"helpText": "Disabled if the form is invalid, if this widget exists directly within a Form widget.",
"propertyName": "disabledWhenInvalid",
"label": "Disabled invalid forms",
"label": "Disable when form is invalid",
"controlType": "SWITCH",
"isJSConvertible": true,
"isBindProperty": true,
Expand Down Expand Up @@ -60391,7 +60391,7 @@
{
"helpText": "Disabled if the form is invalid, if this widget exists directly within a Form widget.",
"propertyName": "disabledWhenInvalid",
"label": "Disabled invalid forms",
"label": "Disable when form is invalid",
"controlType": "SWITCH",
"isJSConvertible": true,
"isBindProperty": true,
Expand Down Expand Up @@ -60697,7 +60697,7 @@
{
"helpText": "Disabled if the form is invalid, if this widget exists directly within a Form widget.",
"propertyName": "disabledWhenInvalid",
"label": "Disabled invalid forms",
"label": "Disable when form is invalid",
"controlType": "SWITCH",
"isJSConvertible": true,
"isBindProperty": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { datasourcesEditorIdURL } from "ee/RouteBuilder";
import { omit } from "lodash";
import { getQueryParams } from "utils/URLUtils";
import history from "utils/history";
import { useEditorType } from "ee/hooks";
import { useParentEntityInfo } from "ee/hooks/datasourceEditorHooks";
import { useParentEntityInfo } from "ee/IDE/hooks/useParentEntityInfo";
import { getIDETypeByUrl } from "ee/entities/IDE/utils";
import type { Plugin } from "entities/Plugin";

interface Props {
Expand All @@ -25,8 +25,8 @@ const DatasourceInfo = ({
plugin,
showEditButton,
}: Props) => {
const editorType = useEditorType(location.pathname);
const { parentEntityId } = useParentEntityInfo(editorType);
const ideType = getIDETypeByUrl(location.pathname);
const { parentEntityId } = useParentEntityInfo(ideType);

// eslint-disable-next-line react-perf/jsx-no-new-function-as-prop
const editDatasource = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import { isEmpty, omit } from "lodash";
import { getQueryParams } from "utils/URLUtils";
import { TableColumns } from "./TableColumns";
import { BOTTOMBAR_HEIGHT } from "./constants";
import { useEditorType } from "ee/hooks";
import { useParentEntityInfo } from "ee/hooks/datasourceEditorHooks";
import { useParentEntityInfo } from "ee/IDE/hooks/useParentEntityInfo";
import DatasourceInfo from "./DatasourceInfo";
import { getPlugin } from "ee/selectors/entitiesSelector";
import {
Expand All @@ -34,6 +33,7 @@ import {
} from "ee/utils/BusinessFeatures/permissionPageHelpers";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import { getIDETypeByUrl } from "ee/entities/IDE/utils";

interface Props {
datasourceId: string;
Expand All @@ -58,8 +58,8 @@ const DatasourceTab = (props: Props) => {

const plugin = useSelector((state) => getPlugin(state, pluginId || ""));

const editorType = useEditorType(location.pathname);
const { parentEntityId } = useParentEntityInfo(editorType);
const ideType = getIDETypeByUrl(location.pathname);
const { parentEntityId } = useParentEntityInfo(ideType);

const [selectedTable, setSelectedTable] = useState<string>();

Expand Down
19 changes: 19 additions & 0 deletions app/client/src/ce/IDE/hooks/useParentEntityInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ActionParentEntityType } from "ee/entities/Engine/actionHelpers";
import type { IDEType } from "ee/entities/IDE/constants";
import { useSelector } from "react-redux";
import {
getCurrentApplicationId,
getCurrentBasePageId,
} from "selectors/editorSelectors";

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const useParentEntityInfo = (ideType: IDEType) => {
const appId = useSelector(getCurrentApplicationId);
const basePageId = useSelector(getCurrentBasePageId);

return {
editorId: appId || "",
parentEntityId: basePageId || "",
parentEntityType: ActionParentEntityType.PAGE,
};
};
13 changes: 7 additions & 6 deletions app/client/src/ce/actions/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
saveActionName,
} from "actions/pluginActionActions";
import { saveJSObjectName } from "actions/jsActionActions";
import { IDE_TYPE, type IDEType } from "ee/entities/IDE/constants";

export const createNewQueryBasedOnParentEntity = (
entityId: string,
Expand Down Expand Up @@ -43,29 +44,29 @@ export const createNewJSCollectionBasedOnParentEntity = (
return createNewJSCollection(entityId, from);
};

export const saveActionNameBasedOnParentEntity = (
export const saveActionNameBasedOnIdeType = (
id: string,
name: string,
// Used in EE
// eslint-disable-next-line @typescript-eslint/no-unused-vars
parentEntityType: ActionParentEntityTypeInterface = ActionParentEntityType.PAGE,
ideType: IDEType = IDE_TYPE.App,
) => {
return saveActionName({ id, name });
};

export const saveJSObjectNameBasedOnParentEntity = (
export const saveJSObjectNameBasedOnIdeType = (
id: string,
name: string,
// Used in EE
// eslint-disable-next-line @typescript-eslint/no-unused-vars
parentEntityType: ActionParentEntityTypeInterface = ActionParentEntityType.PAGE,
ideType: IDEType = IDE_TYPE.App,
) => {
return saveJSObjectName({ id, name });
};

export const createNewApiActionBasedOnEditorType = (
export const createNewApiActionBasedOnIdeType = (
// eslint-disable-next-line @typescript-eslint/no-unused-vars
editorType: string,
ideType: IDEType,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
editorId: string,
parentEntityId: string,
Expand Down
12 changes: 10 additions & 2 deletions app/client/src/ce/components/EnvConfigSection/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import type { Datasource } from "entities/Datasource";
import { renderDatasourceSection } from "pages/Editor/DataSourceEditor/DatasourceSection";
import DatasourceFormRenderer from "pages/Editor/DataSourceEditor/DatasourceFormRenderer";

export interface Props {
currentEnv: string;
Expand All @@ -16,5 +17,12 @@ export function EnvConfigSection({
datasource,
viewMode,
}: Props) {
return renderDatasourceSection(config, currentEnv, datasource, viewMode);
return (
<DatasourceFormRenderer
currentEnvironment={currentEnv}
datasource={datasource}
section={config}
viewMode={viewMode}
/>
);
}
2 changes: 2 additions & 0 deletions app/client/src/ce/constants/ReduxActionConstants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,8 @@ const DatasourceEditorActionTypes = {
CREATE_DATASOURCE_INIT: "CREATE_DATASOURCE_INIT",
CREATE_DATASOURCE_SUCCESS: "CREATE_DATASOURCE_SUCCESS",
CREATE_DATASOURCE_FROM_FORM_INIT: "CREATE_DATASOURCE_FROM_FORM_INIT",
CREATE_DATASOURCE_FROM_FORM_TOGGLE_LOADING:
"CREATE_DATASOURCE_FROM_FORM_TOGGLE_LOADING",
CREATE_TEMP_DATASOURCE_FROM_FORM_SUCCESS:
"CREATE_TEMP_DATASOURCE_FROM_FORM_SUCCESS",
UPDATE_DATASOURCE_INIT: "UPDATE_DATASOURCE_INIT",
Expand Down
1 change: 1 addition & 0 deletions app/client/src/ce/constants/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2017,6 +2017,7 @@ export const RECONNECT_BUTTON_TEXT = () => "Reconnect";
export const SAVE_BUTTON_TEXT = () => "Save";
export const TEST_BUTTON_TEXT = () => "Test configuration";
export const SAVE_AND_AUTHORIZE_BUTTON_TEXT = () => "Save & Authorize";
export const CONNECT_DATASOURCE_BUTTON_TEXT = () => "Connect Datasource";
export const SAVE_AND_RE_AUTHORIZE_BUTTON_TEXT = () => "Save & Re-Authorize";
export const DISCARD_POPUP_DONT_SAVE_BUTTON_TEXT = () => "Don't save";
export const GSHEET_AUTHORISED_FILE_IDS_KEY = () => "userAuthorizedSheetIds";
Expand Down
2 changes: 2 additions & 0 deletions app/client/src/ce/entities/FeatureFlag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const FEATURE_FLAG = {
release_gs_all_sheets_options_enabled:
"release_gs_all_sheets_options_enabled",
release_git_modularisation_enabled: "release_git_modularisation_enabled",
release_git_api_contracts_enabled: "release_git_api_contracts_enabled",
ab_premium_datasources_view_enabled: "ab_premium_datasources_view_enabled",
kill_session_recordings_enabled: "kill_session_recordings_enabled",
config_mask_session_recordings_enabled:
Expand Down Expand Up @@ -92,6 +93,7 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = {
release_table_html_column_type_enabled: false,
release_gs_all_sheets_options_enabled: false,
release_git_modularisation_enabled: false,
release_git_api_contracts_enabled: false,
ab_premium_datasources_view_enabled: false,
kill_session_recordings_enabled: false,
config_user_session_recordings_enabled: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { IDE_TYPE, type IDEType } from "ee/entities/IDE/constants";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import { useSelector } from "react-redux";
import { getPagePermissions } from "selectors/editorSelectors";
import { getHasCreateActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers";

export const useCreateActionsPermissions = (ideType: IDEType) => {
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
const pagePermissions = useSelector(getPagePermissions);

switch (ideType) {
case IDE_TYPE.App: {
return getHasCreateActionPermission(isFeatureEnabled, pagePermissions);
}
default: {
return true;
}
}
};
25 changes: 4 additions & 21 deletions app/client/src/ce/hooks/datasourceEditorHooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
GENERATE_NEW_PAGE_BUTTON_TEXT,
createMessage,
} from "ee/constants/messages";
import { ActionParentEntityType } from "ee/entities/Engine/actionHelpers";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import type { AppState } from "ee/reducers";
import { getPlugin } from "ee/selectors/entitiesSelector";
Expand All @@ -18,17 +17,13 @@ import NewActionButton from "pages/Editor/DataSourceEditor/NewActionButton";
import { useShowPageGenerationOnHeader } from "pages/Editor/DataSourceEditor/hooks";
import React from "react";
import { useDispatch, useSelector } from "react-redux";
import {
getCurrentApplicationId,
getCurrentBasePageId,
getPagePermissions,
} from "selectors/editorSelectors";
import { getPagePermissions } from "selectors/editorSelectors";
import { getIsAnvilEnabledInCurrentApplication } from "layoutSystems/anvil/integrations/selectors";
import { isEnabledForPreviewData } from "utils/editorContextUtils";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { EditorNames } from "./";
import { getCurrentApplication } from "ee/selectors/applicationSelectors";
import { openGeneratePageModal } from "pages/Editor/GeneratePage/store/generatePageActions";
import { IDE_TYPE, type IDEType } from "ee/entities/IDE/constants";

export interface HeaderActionProps {
datasource: Datasource | ApiDatasourceForm | undefined;
Expand All @@ -38,7 +33,7 @@ export interface HeaderActionProps {
}

export const useHeaderActions = (
editorType: string,
ideType: IDEType,
{
datasource,
isPluginAuthorized,
Expand Down Expand Up @@ -77,7 +72,7 @@ export const useHeaderActions = (
? false
: !!isPluginAllowedToPreviewData;

if (editorType === EditorNames.APPLICATION) {
if (ideType === IDE_TYPE.App) {
const canCreateDatasourceActions = hasCreateDSActionPermissionInApp({
isEnabled: isFeatureEnabled,
dsPermissions: datasource?.userPermissions ?? [],
Expand Down Expand Up @@ -141,15 +136,3 @@ export const useHeaderActions = (

return {};
};

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const useParentEntityInfo = (editorType: string) => {
const appId = useSelector(getCurrentApplicationId);
const basePageId = useSelector(getCurrentBasePageId);

return {
editorId: appId || "",
parentEntityId: basePageId || "",
parentEntityType: ActionParentEntityType.PAGE,
};
};
25 changes: 0 additions & 25 deletions app/client/src/ce/hooks/hooks.test.ts

This file was deleted.

35 changes: 0 additions & 35 deletions app/client/src/ce/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,4 @@
import {
BUILDER_BASE_PATH_DEPRECATED,
BUILDER_VIEWER_PATH_PREFIX,
} from "constants/routes";
import { useEffect, type RefObject } from "react";
import { matchPath } from "react-router";

export const EditorNames = {
APPLICATION: "app",
};

export interface EditorType {
[key: string]: string;
}

export const editorType: EditorType = {
[BUILDER_VIEWER_PATH_PREFIX]: EditorNames.APPLICATION,
[BUILDER_BASE_PATH_DEPRECATED]: EditorNames.APPLICATION,
};

// Utility function to get editor type based on path
// to be used in non react functions
export const getEditorType = (path: string) => {
const basePath = matchPath(path, {
path: [BUILDER_VIEWER_PATH_PREFIX, BUILDER_BASE_PATH_DEPRECATED],
});

return basePath
? editorType[basePath.path]
: editorType[BUILDER_VIEWER_PATH_PREFIX];
};

// custom hook to get editor type based on path
export const useEditorType = (path: string) => {
return getEditorType(path);
};

export function useOutsideClick<T extends HTMLElement>(
ref: RefObject<T>,
Expand Down
Loading