Merge branch 'feat/reactive-actions-run-behaviour' of https://github.com/appsmithorg/appsmith into feat/reactive-actions-run-behaviour
This commit is contained in:
commit
0c8bd0bd2f
|
|
@ -51,10 +51,10 @@ export class JSEditor {
|
||||||
"div.t--js-response-parse-error-call-out";
|
"div.t--js-response-parse-error-call-out";
|
||||||
|
|
||||||
private _onPageLoadSwitch = (functionName: string) =>
|
private _onPageLoadSwitch = (functionName: string) =>
|
||||||
`.${functionName}-on-page-load-setting
|
`.${functionName}-run-behavior
|
||||||
input[role="switch"]`;
|
input[role="combobox"]`;
|
||||||
private _onPageLoadSwitchStatus = (functionName: string) =>
|
private _onPageLoadSwitchStatus = (functionName: string) =>
|
||||||
`//div[contains(@class, '${functionName}-on-page-load-setting')]//label/input`;
|
`//div[contains(@class, '${functionName}-run-behavior-setting')]//label/input`;
|
||||||
|
|
||||||
private _jsObjName = this.locator._activeEntityTab;
|
private _jsObjName = this.locator._activeEntityTab;
|
||||||
public _jsObjTxt = this.locator._activeEntityTabInput;
|
public _jsObjTxt = this.locator._activeEntityTabInput;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import {
|
||||||
isPluginActionSettingsOpen,
|
isPluginActionSettingsOpen,
|
||||||
openPluginActionSettings,
|
openPluginActionSettings,
|
||||||
} from "../../store";
|
} from "../../store";
|
||||||
import { THEME } from "../../constants/PluginActionConstants";
|
import { THEME } from "../../types/PluginActionTypes";
|
||||||
import { type DocsLink, openDoc } from "constants/DocumentationLinks";
|
import { type DocsLink, openDoc } from "constants/DocumentationLinks";
|
||||||
import { ToolbarSettingsPopover } from "IDE";
|
import { ToolbarSettingsPopover } from "IDE";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,13 @@ export const RUN_BEHAVIOR = {
|
||||||
label: "On page load",
|
label: "On page load",
|
||||||
subText: "Query runs when the page loads or when manually triggered",
|
subText: "Query runs when the page loads or when manually triggered",
|
||||||
value: ActionRunBehaviour.ON_PAGE_LOAD,
|
value: ActionRunBehaviour.ON_PAGE_LOAD,
|
||||||
|
children: "On page load",
|
||||||
},
|
},
|
||||||
MANUAL: {
|
MANUAL: {
|
||||||
label: "Manual",
|
label: "Manual",
|
||||||
subText: "Query only runs when called in an event or JS with .run()",
|
subText: "Query only runs when called in an event or JS with .run()",
|
||||||
value: ActionRunBehaviour.MANUAL,
|
value: ActionRunBehaviour.MANUAL,
|
||||||
|
children: "Manual",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ import type { EventLocation } from "ee/utils/analyticsUtilTypes";
|
||||||
import type { GenerateDestinationIdInfoReturnType } from "ee/sagas/helpers";
|
import type { GenerateDestinationIdInfoReturnType } from "ee/sagas/helpers";
|
||||||
import type { Span } from "instrumentation/types";
|
import type { Span } from "instrumentation/types";
|
||||||
import type { EvaluationReduxAction } from "./EvaluationReduxActionTypes";
|
import type { EvaluationReduxAction } from "./EvaluationReduxActionTypes";
|
||||||
import type { ActionRunBehaviourType } from "PluginActionEditor/constants/PluginActionConstants";
|
import type { ActionRunBehaviourType } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
export const createActionRequest = (
|
export const createActionRequest = (
|
||||||
payload: Partial<Action>,
|
payload: Partial<Action>,
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import type { APIRequest } from "constants/AppsmithActionConstants/ActionConstan
|
||||||
import type { WidgetType } from "constants/WidgetConstants";
|
import type { WidgetType } from "constants/WidgetConstants";
|
||||||
import type { ActionParentEntityTypeInterface } from "ee/entities/Engine/actionHelpers";
|
import type { ActionParentEntityTypeInterface } from "ee/entities/Engine/actionHelpers";
|
||||||
import type { PostActionRunConfig } from "./types";
|
import type { PostActionRunConfig } from "./types";
|
||||||
import type { ActionRunBehaviourType } from "PluginActionEditor/constants/PluginActionConstants";
|
import type { ActionRunBehaviourType } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
export interface Property {
|
export interface Property {
|
||||||
key: string;
|
key: string;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import type {
|
||||||
import type { DSLWidget } from "WidgetProvider/constants";
|
import type { DSLWidget } from "WidgetProvider/constants";
|
||||||
import type { FetchApplicationResponse } from "ee/api/ApplicationApi";
|
import type { FetchApplicationResponse } from "ee/api/ApplicationApi";
|
||||||
import type { APP_MODE } from "entities/App";
|
import type { APP_MODE } from "entities/App";
|
||||||
import type { ActionRunBehaviourType } from "PluginActionEditor/constants/PluginActionConstants";
|
import type { ActionRunBehaviourType } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
export interface FetchPageRequest {
|
export interface FetchPageRequest {
|
||||||
pageId: string;
|
pageId: string;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import type {
|
||||||
FieldEntityInformation,
|
FieldEntityInformation,
|
||||||
TEditorModes,
|
TEditorModes,
|
||||||
} from "components/editorComponents/CodeEditor/EditorConfig";
|
} from "components/editorComponents/CodeEditor/EditorConfig";
|
||||||
import type { EntityNavigationData } from "selectors/navigationSelectors";
|
import type { EntityNavigationData } from "entities/DataTree/dataTreeTypes";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import type CodeMirror from "codemirror";
|
import type CodeMirror from "codemirror";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import type {
|
||||||
UpdateActionPropertyActionPayload,
|
UpdateActionPropertyActionPayload,
|
||||||
} from "actions/pluginActionActions";
|
} from "actions/pluginActionActions";
|
||||||
import { klona } from "klona";
|
import { klona } from "klona";
|
||||||
import type { ActionRunBehaviourType } from "PluginActionEditor/constants/PluginActionConstants";
|
import type { ActionRunBehaviourType } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
export interface ActionData {
|
export interface ActionData {
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import {
|
||||||
import { set, keyBy, findIndex, unset } from "lodash";
|
import { set, keyBy, findIndex, unset } from "lodash";
|
||||||
import { create } from "mutative";
|
import { create } from "mutative";
|
||||||
import { klona } from "klona";
|
import { klona } from "klona";
|
||||||
import type { ActionRunBehaviourType } from "PluginActionEditor/constants/PluginActionConstants";
|
import type { ActionRunBehaviourType } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
export const initialState: JSCollectionDataState = [];
|
export const initialState: JSCollectionDataState = [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import type { ModuleInstance } from "ee/constants/ModuleInstanceConstants";
|
import type { ModuleInstance } from "ee/constants/ModuleInstanceConstants";
|
||||||
import type { EntityNavigationData } from "selectors/navigationSelectors";
|
import type { EntityNavigationData } from "entities/DataTree/dataTreeTypes";
|
||||||
|
|
||||||
export const getModuleInstanceNavigationData = (
|
export const getModuleInstanceNavigationData = (
|
||||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
import type CodeMirror from "codemirror";
|
import type CodeMirror from "codemirror";
|
||||||
import type { EntityTypeValue } from "ee/entities/DataTree/types";
|
import type { EntityTypeValue } from "ee/entities/DataTree/types";
|
||||||
import type { DataTree } from "entities/DataTree/dataTreeTypes";
|
import type {
|
||||||
|
DataTree,
|
||||||
|
EntityNavigationData,
|
||||||
|
} from "entities/DataTree/dataTreeTypes";
|
||||||
import type { AutocompleteDataType } from "utils/autocomplete/AutocompleteDataType";
|
import type { AutocompleteDataType } from "utils/autocomplete/AutocompleteDataType";
|
||||||
import type { EntityNavigationData } from "selectors/navigationSelectors";
|
|
||||||
import type { ExpectedValueExample } from "utils/validation/common";
|
import type { ExpectedValueExample } from "utils/validation/common";
|
||||||
|
|
||||||
import { editorSQLModes } from "./sql/config";
|
import { editorSQLModes } from "./sql/config";
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import type {
|
import type {
|
||||||
EntityNavigationData,
|
EntityNavigationData,
|
||||||
NavigationData,
|
NavigationData,
|
||||||
} from "selectors/navigationSelectors";
|
} from "entities/DataTree/dataTreeTypes";
|
||||||
import type { MarkHelper } from "../EditorConfig";
|
import type { MarkHelper } from "../EditorConfig";
|
||||||
|
|
||||||
export const NAVIGATE_TO_ATTRIBUTE = "data-navigate-to";
|
export const NAVIGATE_TO_ATTRIBUTE = "data-navigate-to";
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import type { FeatureFlags } from "ee/entities/FeatureFlag";
|
||||||
import type {
|
import type {
|
||||||
EntityNavigationData,
|
EntityNavigationData,
|
||||||
NavigationData,
|
NavigationData,
|
||||||
} from "selectors/navigationSelectors";
|
} from "entities/DataTree/dataTreeTypes";
|
||||||
import { getAIContext } from "ee/components/editorComponents/GPT/trigger";
|
import { getAIContext } from "ee/components/editorComponents/GPT/trigger";
|
||||||
import type { Plugin } from "entities/Plugin";
|
import type { Plugin } from "entities/Plugin";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import { APPSMITH_AI } from "ee/components/editorComponents/GPT/trigger";
|
||||||
import { DatasourceCreateEntryPoints } from "constants/Datasource";
|
import { DatasourceCreateEntryPoints } from "constants/Datasource";
|
||||||
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
|
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
|
||||||
import BetaCard from "../BetaCard";
|
import BetaCard from "../BetaCard";
|
||||||
import type { NavigationData } from "selectors/navigationSelectors";
|
import type { NavigationData } from "entities/DataTree/dataTreeTypes";
|
||||||
import type { AIEditorContext } from "ee/components/editorComponents/GPT";
|
import type { AIEditorContext } from "ee/components/editorComponents/GPT";
|
||||||
import type { EntityTypeValue } from "ee/entities/DataTree/types";
|
import type { EntityTypeValue } from "ee/entities/DataTree/types";
|
||||||
import history, { NavigationMethod } from "utils/history";
|
import history, { NavigationMethod } from "utils/history";
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ import { updateCustomDef } from "utils/autocomplete/customDefUtils";
|
||||||
import { shouldFocusOnPropertyControl } from "utils/editorContextUtils";
|
import { shouldFocusOnPropertyControl } from "utils/editorContextUtils";
|
||||||
import { getEntityLintErrors } from "selectors/lintingSelectors";
|
import { getEntityLintErrors } from "selectors/lintingSelectors";
|
||||||
import { getCodeCommentKeyMap, handleCodeComment } from "./utils/codeComment";
|
import { getCodeCommentKeyMap, handleCodeComment } from "./utils/codeComment";
|
||||||
import type { EntityNavigationData } from "selectors/navigationSelectors";
|
import type { EntityNavigationData } from "entities/DataTree/dataTreeTypes";
|
||||||
import { getEntitiesForNavigation } from "selectors/navigationSelectors";
|
import { getEntitiesForNavigation } from "selectors/navigationSelectors";
|
||||||
import history, { NavigationMethod } from "utils/history";
|
import history, { NavigationMethod } from "utils/history";
|
||||||
import { CursorPositionOrigin } from "ee/reducers/uiReducers/editorContextReducer";
|
import { CursorPositionOrigin } from "ee/reducers/uiReducers/editorContextReducer";
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { getJSResponseViewState, JSResponseState } from "./utils";
|
import { getJSResponseViewState, JSResponseState } from "./utils";
|
||||||
import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants";
|
import { ActionRunBehaviour } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
const TEST_JS_FUNCTION_ID = "627ccff468e1fa5185b7f901";
|
const TEST_JS_FUNCTION_ID = "627ccff468e1fa5185b7f901";
|
||||||
const TEST_JS_FUNCTION_BASE_ID = "627ccff468e1fa5185b7f912";
|
const TEST_JS_FUNCTION_BASE_ID = "627ccff468e1fa5185b7f912";
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import {
|
||||||
import {
|
import {
|
||||||
RUN_BEHAVIOR,
|
RUN_BEHAVIOR,
|
||||||
RUN_BEHAVIOR_VALUES,
|
RUN_BEHAVIOR_VALUES,
|
||||||
} from "PluginActionEditor/constants/PluginActionConstants";
|
} from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
RUN_BEHAVIOR,
|
RUN_BEHAVIOR,
|
||||||
RUN_BEHAVIOR_VALUES,
|
RUN_BEHAVIOR_VALUES,
|
||||||
} from "PluginActionEditor/constants/PluginActionConstants";
|
} from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
RUN_BEHAVIOR,
|
RUN_BEHAVIOR,
|
||||||
RUN_BEHAVIOR_VALUES,
|
RUN_BEHAVIOR_VALUES,
|
||||||
} from "PluginActionEditor/constants/PluginActionConstants";
|
} from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import {
|
||||||
type Plugin,
|
type Plugin,
|
||||||
type PluginName,
|
type PluginName,
|
||||||
} from "../Plugin";
|
} from "../Plugin";
|
||||||
import type { ActionRunBehaviourType } from "PluginActionEditor/constants/PluginActionConstants";
|
import type { ActionRunBehaviourType } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
export enum PaginationType {
|
export enum PaginationType {
|
||||||
NONE = "NONE",
|
NONE = "NONE",
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import type {
|
||||||
DataTreeEntityObject,
|
DataTreeEntityObject,
|
||||||
UnEvalTreeEntityObject,
|
UnEvalTreeEntityObject,
|
||||||
AppsmithEntity,
|
AppsmithEntity,
|
||||||
|
EntityTypeValue,
|
||||||
} from "ee/entities/DataTree/types";
|
} from "ee/entities/DataTree/types";
|
||||||
|
|
||||||
export interface unEvalAndConfigTree {
|
export interface unEvalAndConfigTree {
|
||||||
|
|
@ -23,3 +24,23 @@ export type UnEvalTreeEntity = UnEvalTreeEntityObject | AppsmithEntity;
|
||||||
export interface UnEvalTree {
|
export interface UnEvalTree {
|
||||||
[entityName: string]: UnEvalTreeEntity;
|
[entityName: string]: UnEvalTreeEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface NavigationData {
|
||||||
|
name: string;
|
||||||
|
id: string;
|
||||||
|
type: EntityTypeValue;
|
||||||
|
isfunction?: boolean;
|
||||||
|
url: string | undefined;
|
||||||
|
navigable: boolean;
|
||||||
|
children: EntityNavigationData;
|
||||||
|
key?: string;
|
||||||
|
pluginName?: string;
|
||||||
|
pluginId?: string;
|
||||||
|
isMock?: boolean;
|
||||||
|
datasourceId?: string;
|
||||||
|
actionType?: string;
|
||||||
|
widgetType?: string;
|
||||||
|
value?: boolean | string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type EntityNavigationData = Record<string, NavigationData>;
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,8 @@ import React from "react";
|
||||||
import "@testing-library/jest-dom";
|
import "@testing-library/jest-dom";
|
||||||
import { render, screen } from "test/testUtils";
|
import { render, screen } from "test/testUtils";
|
||||||
import { JSFunctionSettings } from "./JSFunctionSettings";
|
import { JSFunctionSettings } from "./JSFunctionSettings";
|
||||||
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
|
|
||||||
import { JSObjectFactory } from "test/factories/Actions/JSObject";
|
import { JSObjectFactory } from "test/factories/Actions/JSObject";
|
||||||
import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants";
|
import { ActionRunBehaviour } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
// Mock the useFeatureFlag hook
|
|
||||||
jest.mock("utils/hooks/useFeatureFlag");
|
|
||||||
const mockUseFeatureFlag = useFeatureFlag as jest.Mock;
|
|
||||||
|
|
||||||
const JSObject = JSObjectFactory.build();
|
const JSObject = JSObjectFactory.build();
|
||||||
|
|
||||||
|
|
@ -21,9 +16,7 @@ describe("JSFunctionSettings", () => {
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("disables the switch when the component is disabled", () => {
|
it("disables the run behavior when the component is disabled", () => {
|
||||||
mockUseFeatureFlag.mockReturnValue(true);
|
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<JSFunctionSettings
|
<JSFunctionSettings
|
||||||
actions={actions}
|
actions={actions}
|
||||||
|
|
@ -35,9 +28,7 @@ describe("JSFunctionSettings", () => {
|
||||||
expect(screen.getByLabelText(actions[0].name)).toBeDisabled();
|
expect(screen.getByLabelText(actions[0].name)).toBeDisabled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders the correct number of switches for the actions", () => {
|
it("renders the correct number of dropdowns for the actions", () => {
|
||||||
mockUseFeatureFlag.mockReturnValue(true);
|
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<JSFunctionSettings
|
<JSFunctionSettings
|
||||||
actions={actions}
|
actions={actions}
|
||||||
|
|
@ -46,12 +37,10 @@ describe("JSFunctionSettings", () => {
|
||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(screen.getAllByRole("switch")).toHaveLength(actions.length);
|
expect(screen.getAllByRole(`combobox`)).toHaveLength(actions.length);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders the switch state correctly", () => {
|
it("renders the run behavior correctly", () => {
|
||||||
mockUseFeatureFlag.mockReturnValue(true);
|
|
||||||
|
|
||||||
const updatedJSActions = [
|
const updatedJSActions = [
|
||||||
{
|
{
|
||||||
...actions[0],
|
...actions[0],
|
||||||
|
|
@ -71,10 +60,14 @@ describe("JSFunctionSettings", () => {
|
||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
const switchElement1 = screen.getByLabelText(updatedJSActions[0].name);
|
const selectedItem1 = screen.getByText("On page load", {
|
||||||
const switchElement2 = screen.getByLabelText(updatedJSActions[1].name);
|
selector: ".myFun1-run-behavior-setting .rc-select-selection-item",
|
||||||
|
});
|
||||||
|
const selectedItem2 = screen.getByText("Manual", {
|
||||||
|
selector: ".myFun2-run-behavior-setting .rc-select-selection-item",
|
||||||
|
});
|
||||||
|
|
||||||
expect(switchElement1).toBeChecked();
|
expect(selectedItem1).toBeInTheDocument();
|
||||||
expect(switchElement2).not.toBeChecked();
|
expect(selectedItem2).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,10 @@ import {
|
||||||
} from "ee/constants/messages";
|
} from "ee/constants/messages";
|
||||||
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
|
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
|
||||||
import type { OnUpdateSettingsProps } from "../types";
|
import type { OnUpdateSettingsProps } from "../types";
|
||||||
import type { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants";
|
import {
|
||||||
import { RUN_BEHAVIOR_VALUES } from "PluginActionEditor/constants/PluginActionConstants";
|
RUN_BEHAVIOR_VALUES,
|
||||||
|
type ActionRunBehaviourType,
|
||||||
|
} from "PluginActionEditor/types/PluginActionTypes";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
const OptionLabel = styled(Text)`
|
const OptionLabel = styled(Text)`
|
||||||
|
|
@ -45,10 +47,11 @@ interface FunctionSettingsRowProps extends Omit<Props, "actions"> {
|
||||||
|
|
||||||
const FunctionSettingRow = (props: FunctionSettingsRowProps) => {
|
const FunctionSettingRow = (props: FunctionSettingsRowProps) => {
|
||||||
const [runBehavior, setRunBehavior] = useState(props.action.runBehavior);
|
const [runBehavior, setRunBehavior] = useState(props.action.runBehavior);
|
||||||
const options = RUN_BEHAVIOR_VALUES as Omit<SelectOptionProps, "children">[];
|
const options = RUN_BEHAVIOR_VALUES as SelectOptionProps[];
|
||||||
|
const selectedValue = options.find((opt) => opt.value === runBehavior);
|
||||||
|
|
||||||
const onSelectOptions = useCallback(
|
const onSelectOptions = useCallback(
|
||||||
(newRunBehavior: ActionRunBehaviour) => {
|
(newRunBehavior: ActionRunBehaviourType) => {
|
||||||
setRunBehavior(newRunBehavior);
|
setRunBehavior(newRunBehavior);
|
||||||
props.onUpdateSettings?.({
|
props.onUpdateSettings?.({
|
||||||
value: newRunBehavior,
|
value: newRunBehavior,
|
||||||
|
|
@ -67,29 +70,30 @@ const FunctionSettingRow = (props: FunctionSettingsRowProps) => {
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
className={`t--async-js-function-settings ${props.action.name}-on-page-load-setting`}
|
className={`t--async-js-function-settings ${props.action.name}-run-behavior-setting`}
|
||||||
gap="spaces-4"
|
gap="spaces-4"
|
||||||
id={`${props.action.name}-settings`}
|
id={`${props.action.name}-settings`}
|
||||||
justifyContent="space-between"
|
justifyContent="space-between"
|
||||||
key={props.action.id}
|
key={props.action.id}
|
||||||
w="100%"
|
w="100%"
|
||||||
>
|
>
|
||||||
<Text renderAs="label">{props.action.name}</Text>
|
<Text htmlFor={props.action.id} renderAs="label">
|
||||||
|
{props.action.name}
|
||||||
|
</Text>
|
||||||
<StyledSelect
|
<StyledSelect
|
||||||
data-testid={`execute-on-page-load-${props.action.id}`}
|
data-testid={`execute-on-page-load-${props.action.id}`}
|
||||||
defaultValue={runBehavior}
|
defaultValue={selectedValue}
|
||||||
|
id={props.action.id}
|
||||||
isDisabled={props.disabled}
|
isDisabled={props.disabled}
|
||||||
listHeight={240}
|
listHeight={240}
|
||||||
onSelect={onSelectOptions}
|
onSelect={onSelectOptions}
|
||||||
size="sm"
|
size="sm"
|
||||||
value={runBehavior}
|
value={selectedValue}
|
||||||
virtual
|
|
||||||
>
|
>
|
||||||
{options.map((option) => (
|
{options.map((option) => (
|
||||||
<Option
|
<Option
|
||||||
aria-label={option.label}
|
aria-label={option.label}
|
||||||
disabled={option.disabled}
|
disabled={option.disabled}
|
||||||
isDisabled={option.isDisabled}
|
|
||||||
key={option.value}
|
key={option.value}
|
||||||
label={option.label}
|
label={option.label}
|
||||||
value={option.value}
|
value={option.value}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import type { JSAction } from "entities/JSCollection";
|
import type { JSAction } from "entities/JSCollection";
|
||||||
import type { DropdownOption } from "@appsmith/ads-old";
|
import type { DropdownOption } from "@appsmith/ads-old";
|
||||||
import type { ActionRunBehaviourType } from "PluginActionEditor/constants/PluginActionConstants";
|
import type { ActionRunBehaviourType } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
export interface OnUpdateSettingsProps {
|
export interface OnUpdateSettingsProps {
|
||||||
value: ActionRunBehaviourType;
|
value: ActionRunBehaviourType;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import {
|
||||||
getJSActionOption,
|
getJSActionOption,
|
||||||
} from "./JSEditorToolbar/utils";
|
} from "./JSEditorToolbar/utils";
|
||||||
import { NO_FUNCTION_DROPDOWN_OPTION } from "./JSEditorToolbar/constants";
|
import { NO_FUNCTION_DROPDOWN_OPTION } from "./JSEditorToolbar/constants";
|
||||||
import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants";
|
import { ActionRunBehaviour } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
const BASE_JS_OBJECT_BODY = `export default {
|
const BASE_JS_OBJECT_BODY = `export default {
|
||||||
myVar1: [],
|
myVar1: [],
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ import {
|
||||||
selectGitOpsModalOpen,
|
selectGitOpsModalOpen,
|
||||||
} from "selectors/gitModSelectors";
|
} from "selectors/gitModSelectors";
|
||||||
import { createActionExecutionResponse } from "./PluginActionSagaUtils";
|
import { createActionExecutionResponse } from "./PluginActionSagaUtils";
|
||||||
import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants";
|
import { ActionRunBehaviour } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
import { appsmithTelemetry } from "instrumentation";
|
import { appsmithTelemetry } from "instrumentation";
|
||||||
|
|
||||||
interface FilePickerInstumentationObject {
|
interface FilePickerInstumentationObject {
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ import {
|
||||||
import { handleQueryEntityRedirect } from "./IDESaga";
|
import { handleQueryEntityRedirect } from "./IDESaga";
|
||||||
import type { EvaluationReduxAction } from "actions/EvaluationReduxActionTypes";
|
import type { EvaluationReduxAction } from "actions/EvaluationReduxActionTypes";
|
||||||
import { IDE_TYPE } from "ee/IDE/Interfaces/IDETypes";
|
import { IDE_TYPE } from "ee/IDE/Interfaces/IDETypes";
|
||||||
import type { ActionRunBehaviourType } from "PluginActionEditor/constants/PluginActionConstants";
|
import type { ActionRunBehaviourType } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
export const DEFAULT_PREFIX = {
|
export const DEFAULT_PREFIX = {
|
||||||
QUERY: "Query",
|
QUERY: "Query",
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ import { updateJSCollectionAPICall } from "ee/sagas/ApiCallerSagas";
|
||||||
import { convertToBasePageIdSelector } from "selectors/pageListSelectors";
|
import { convertToBasePageIdSelector } from "selectors/pageListSelectors";
|
||||||
import { getIsAnvilEnabledInCurrentApplication } from "layoutSystems/anvil/integrations/selectors";
|
import { getIsAnvilEnabledInCurrentApplication } from "layoutSystems/anvil/integrations/selectors";
|
||||||
import { fetchActionsForPage } from "actions/pluginActionActions";
|
import { fetchActionsForPage } from "actions/pluginActionActions";
|
||||||
import type { ActionRunBehaviourType } from "PluginActionEditor/constants/PluginActionConstants";
|
import type { ActionRunBehaviourType } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
export interface GenerateDefaultJSObjectProps {
|
export interface GenerateDefaultJSObjectProps {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import type { EntityTypeValue } from "ee/entities/DataTree/types";
|
|
||||||
import {
|
import {
|
||||||
ACTION_TYPE,
|
ACTION_TYPE,
|
||||||
JSACTION_TYPE,
|
JSACTION_TYPE,
|
||||||
|
|
@ -34,26 +33,7 @@ import { PluginType } from "entities/Plugin";
|
||||||
import type { StoredDatasource } from "entities/Action";
|
import type { StoredDatasource } from "entities/Action";
|
||||||
import type { Datasource } from "entities/Datasource";
|
import type { Datasource } from "entities/Datasource";
|
||||||
import { getModuleInstanceNavigationData } from "ee/utils/moduleInstanceNavigationData";
|
import { getModuleInstanceNavigationData } from "ee/utils/moduleInstanceNavigationData";
|
||||||
|
import type { EntityNavigationData } from "entities/DataTree/dataTreeTypes";
|
||||||
export interface NavigationData {
|
|
||||||
name: string;
|
|
||||||
id: string;
|
|
||||||
type: EntityTypeValue;
|
|
||||||
isfunction?: boolean;
|
|
||||||
url: string | undefined;
|
|
||||||
navigable: boolean;
|
|
||||||
children: EntityNavigationData;
|
|
||||||
key?: string;
|
|
||||||
pluginName?: string;
|
|
||||||
pluginId?: string;
|
|
||||||
isMock?: boolean;
|
|
||||||
datasourceId?: string;
|
|
||||||
actionType?: string;
|
|
||||||
widgetType?: string;
|
|
||||||
value?: boolean | string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type EntityNavigationData = Record<string, NavigationData>;
|
|
||||||
|
|
||||||
export const getModulesData = createSelector(
|
export const getModulesData = createSelector(
|
||||||
getModuleInstances,
|
getModuleInstances,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import type { JSActionEntity } from "ee/entities/DataTree/types";
|
import type { JSActionEntity } from "ee/entities/DataTree/types";
|
||||||
import type { DataTree } from "entities/DataTree/dataTreeTypes";
|
import type { DataTree } from "entities/DataTree/dataTreeTypes";
|
||||||
import type { JSCollectionData } from "ee/reducers/entityReducers/jsActionsReducer";
|
import type { JSCollectionData } from "ee/reducers/entityReducers/jsActionsReducer";
|
||||||
import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants";
|
import { ActionRunBehaviour } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
export const getJsActionPeekData = (
|
export const getJsActionPeekData = (
|
||||||
jsAction: JSCollectionData,
|
jsAction: JSCollectionData,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import type { JSCollection, JSAction, Variable } from "entities/JSCollection";
|
||||||
import { ENTITY_TYPE } from "ee/entities/AppsmithConsole/utils";
|
import { ENTITY_TYPE } from "ee/entities/AppsmithConsole/utils";
|
||||||
import LOG_TYPE from "entities/AppsmithConsole/logtype";
|
import LOG_TYPE from "entities/AppsmithConsole/logtype";
|
||||||
import AppsmithConsole from "utils/AppsmithConsole";
|
import AppsmithConsole from "utils/AppsmithConsole";
|
||||||
import { ActionRunBehaviour } from "PluginActionEditor/constants/PluginActionConstants";
|
import { ActionRunBehaviour } from "PluginActionEditor/types/PluginActionTypes";
|
||||||
|
|
||||||
export interface ParsedJSSubAction {
|
export interface ParsedJSSubAction {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import { jsCollectionIdURL } from "ee/RouteBuilder";
|
||||||
import type {
|
import type {
|
||||||
EntityNavigationData,
|
EntityNavigationData,
|
||||||
NavigationData,
|
NavigationData,
|
||||||
} from "selectors/navigationSelectors";
|
} from "entities/DataTree/dataTreeTypes";
|
||||||
import { createNavData } from "./common";
|
import { createNavData } from "./common";
|
||||||
|
|
||||||
export const getJsChildrenNavData = (
|
export const getJsChildrenNavData = (
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import type { WidgetEntity } from "ee/entities/DataTree/types";
|
||||||
import type { DataTree } from "entities/DataTree/dataTreeTypes";
|
import type { DataTree } from "entities/DataTree/dataTreeTypes";
|
||||||
import { ENTITY_TYPE } from "ee/entities/DataTree/types";
|
import { ENTITY_TYPE } from "ee/entities/DataTree/types";
|
||||||
import { builderURL } from "ee/RouteBuilder";
|
import { builderURL } from "ee/RouteBuilder";
|
||||||
import type { EntityNavigationData } from "selectors/navigationSelectors";
|
import type { EntityNavigationData } from "entities/DataTree/dataTreeTypes";
|
||||||
import { createNavData } from "./common";
|
import { createNavData } from "./common";
|
||||||
|
|
||||||
export const getWidgetChildrenNavData = (
|
export const getWidgetChildrenNavData = (
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import type { EntityTypeValue } from "ee/entities/DataTree/types";
|
||||||
import type {
|
import type {
|
||||||
EntityNavigationData,
|
EntityNavigationData,
|
||||||
NavigationData,
|
NavigationData,
|
||||||
} from "selectors/navigationSelectors";
|
} from "entities/DataTree/dataTreeTypes";
|
||||||
|
|
||||||
export const createNavData = (general: {
|
export const createNavData = (general: {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user