Skip to content

Commit

Permalink
Merge branch 'appsmithorg:release' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
hajrezvan authored Jan 23, 2025
2 parents a09e65a + 928a00e commit 4c75d46
Show file tree
Hide file tree
Showing 150 changed files with 1,477 additions and 605 deletions.
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
10 changes: 5 additions & 5 deletions app/client/packages/dsl/src/migrate/helpers/widget-configs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3538,7 +3538,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 @@ -46246,7 +46246,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 @@ -54519,7 +54519,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 @@ -60399,7 +60399,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 @@ -60705,7 +60705,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
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
2 changes: 1 addition & 1 deletion app/client/src/ce/navigation/FocusSetters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { PluginType } from "entities/Plugin";
import type { FocusEntityInfo } from "navigation/FocusEntity";
import { FocusEntity } from "navigation/FocusEntity";
import { getQueryEntityItemUrl } from "../pages/Editor/IDE/EditorPane/Query/utils";
import { getQueryEntityItemUrl } from "ee/pages/Editor/IDE/EditorPane/Query/utils/getQueryEntityItemUrl";

export function setSelectedDatasource(id?: string) {
if (id) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import React from "react";
import ExplorerJSCollectionEntity from "pages/Editor/Explorer/JSActions/JSActionEntity";
import type { ActionParentEntityTypeInterface } from "ee/entities/Engine/actionHelpers";
import { Flex } from "@appsmith/ads";
import type { EntityItem } from "ee/entities/IDE/constants";

export interface JSListItemProps {
item: EntityItem;
isActive: boolean;
parentEntityId: string;
parentEntityType: ActionParentEntityTypeInterface;
}

export const JSListItem = (props: JSListItemProps) => {
const { isActive, item, parentEntityId, parentEntityType } = props;
const { isActive, item, parentEntityId } = props;

return (
<Flex data-testid="t--ide-list-item" flexDirection={"column"}>
Expand All @@ -21,7 +19,6 @@ export const JSListItem = (props: JSListItemProps) => {
isActive={isActive}
key={item.key}
parentEntityId={parentEntityId}
parentEntityType={parentEntityType}
searchKeyword={""}
step={1}
/>
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ADD_PATH } from "ee/constants/routes/appRoutes";
import history from "utils/history";
import { FocusEntity, identifyEntityFromPath } from "navigation/FocusEntity";
import { useModuleOptions } from "ee/utils/moduleInstanceHelpers";
import { getJSUrl } from "ee/pages/Editor/IDE/EditorPane/JS/utils";
import { getJSUrl } from "ee/pages/Editor/IDE/EditorPane/JS/utils/getJSUrl";
import { getIDEViewMode } from "selectors/ideSelectors";
import { EditorViewMode } from "ee/entities/IDE/constants";
import { setListViewActiveState } from "actions/ideActions";
Expand Down
Loading

0 comments on commit 4c75d46

Please sign in to comment.