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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const commonlocators = require("../../../../../locators/commonlocators.json");
import {
agHelper,
apiPage,
entityExplorer,
propPane,
} from "../../../../../support/Objects/ObjectsCore";

Expand Down Expand Up @@ -115,38 +116,6 @@ describe(
// verify customColumn is visible in the table
cy.get(".draggable-header:contains('CustomColumn')").should("be.visible");
cy.closePropertyPane();
cy.deleteColumn("customColumn1");
});

it("5. Verify computed value with try-catch blocks handles missing nested properties", function () {
cy.openPropertyPane("tablewidgetv2");

// Set table data with nested object and missing property
propPane.UpdatePropertyFieldValue(
"Table data",
`{{[{"name": "Rahul", age: {value: 31}}, {"name": "Jacq", age: {}}, {"name": "John"}]}}`,
);

cy.editColumn("age");
propPane.UpdatePropertyFieldValue(
"Computed value",
"{{currentRow.age.value}}",
);

cy.readTableV2data(0, 1).then((val) => {
expect(val).to.equal("31");
});

cy.readTableV2data(1, 1).then((val) => {
expect(val).to.equal("");
});

cy.readTableV2data(2, 1).then((val) => {
expect(val).to.equal("");
});

// Clean up
cy.backFromPropertyPanel();
});
},
);
8 changes: 1 addition & 7 deletions app/client/packages/dsl/src/migrate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@ import { migrateTableServerSideFiltering } from "./migrations/086-migrate-table-
import { migrateChartwidgetCustomEchartConfig } from "./migrations/087-migrate-chart-widget-customechartdata";
import { migrateCustomWidgetDynamicHeight } from "./migrations/088-migrate-custom-widget-dynamic-height";
import { migrateTableWidgetV2CurrentRowInValidationsBinding } from "./migrations/089-migrage-table-widget-v2-currentRow-binding";
import { migrateTableWidgetV2ValidationTryCatch } from "./migrations/090-migrate-table-widget-v2-validation-try-catch";
import type { DSLWidget } from "./types";

export const LATEST_DSL_VERSION = 92;
export const LATEST_DSL_VERSION = 91;

export const calculateDynamicHeight = () => {
const DEFAULT_GRID_ROW_HEIGHT = 10;
Expand Down Expand Up @@ -625,11 +624,6 @@ const migrateVersionedDSL = async (currentDSL: DSLWidget, newPage = false) => {
* What we missed was that, the auto-commit does not handle clientVersion, which lead to this bug: https://github.com/appsmithorg/appsmith/issues/38511
* We are bumping this version to make sure that the auto-commit will handle this version bump.
*/
currentDSL.version = 91;
}

if (currentDSL.version === 91) {
currentDSL = migrateTableWidgetV2ValidationTryCatch(currentDSL);
currentDSL.version = LATEST_DSL_VERSION;
}

Expand Down

This file was deleted.

10 changes: 0 additions & 10 deletions app/client/packages/dsl/src/migrate/tests/DSLMigration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ import * as m86 from "../migrations/086-migrate-table-server-side-filtering";
import * as m87 from "../migrations/087-migrate-chart-widget-customechartdata";
import * as m88 from "../migrations/088-migrate-custom-widget-dynamic-height";
import * as m89 from "../migrations/089-migrage-table-widget-v2-currentRow-binding";
import * as m91 from "../migrations/090-migrate-table-widget-v2-validation-try-catch";

interface Migration {
functionLookup: {
Expand Down Expand Up @@ -935,15 +934,6 @@ const migrations: Migration[] = [
functionLookup: [],
version: 90,
},
{
functionLookup: [
{
moduleObj: m91,
functionName: "migrateTableWidgetV2ValidationTryCatch",
},
],
version: 91,
},
];

const mockFnObj: Record<number, any> = {};
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { useCallback, useEffect, useMemo } from "react";
import { IDEBottomView, ViewHideBehaviour } from "IDE";
import { PluginType } from "entities/Plugin";
import { getIsAnvilEnabledInCurrentApplication } from "layoutSystems/anvil/integrations/selectors";
import { ActionExecutionResizerHeight } from "./constants";
import EntityBottomTabs from "components/editorComponents/EntityBottomTabs";
import { useDispatch, useSelector } from "react-redux";
Expand All @@ -15,7 +17,8 @@ import { useDefaultTab } from "ee/PluginActionEditor/components/PluginActionResp

function PluginActionResponse() {
const dispatch = useDispatch();
const { actionResponse } = usePluginActionContext();
const { actionResponse, plugin } = usePluginActionContext();
const isAnvilEnabled = useSelector(getIsAnvilEnabledInCurrentApplication);

const tabs = usePluginActionResponseTabs();

Expand All @@ -36,6 +39,9 @@ function PluginActionResponse() {
// as for page load queries, query response is available and can be shown in response tab
useEffect(
function openResponseTabForPageLoadQueries() {
// disable the opening of RESPONSE_TAB for the AI plugin in Anvil
if (isAnvilEnabled && plugin.type === PluginType.AI) return;

// actionResponse and responseDisplayFormat is present only when query has response available
if (
!!responseDisplayFormat?.title &&
Expand All @@ -53,11 +59,16 @@ function PluginActionResponse() {
responseDisplayFormat?.title,
actionResponse?.isExecutionSuccess,
dispatch,
isAnvilEnabled,
plugin.type,
],
);

useEffect(
function openResponseTabOnError() {
// disable the opening of RESPONSE_TAB for the AI plugin in Anvil
if (isAnvilEnabled && plugin.type === PluginType.AI) return;

if (executionFailed) {
dispatch(
setPluginActionEditorDebuggerState({
Expand All @@ -67,7 +78,7 @@ function PluginActionResponse() {
);
}
},
[executionFailed, dispatch],
[executionFailed, dispatch, isAnvilEnabled, plugin.type],
);

useDefaultTab();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React, { useCallback } from "react";
import { IDEToolbar } from "IDE";
import { Button, Menu, MenuContent, MenuTrigger, Tooltip } from "@appsmith/ads";
import { modText } from "utils/helpers";
import { PluginType } from "../../entities/Plugin";
import { getIsAnvilEnabledInCurrentApplication } from "../../layoutSystems/anvil/integrations/selectors";
import { usePluginActionContext } from "../PluginActionContext";
import {
useBlockExecution,
Expand All @@ -20,17 +22,21 @@ interface PluginActionToolbarProps {
}

const PluginActionToolbar = (props: PluginActionToolbarProps) => {
const { action } = usePluginActionContext();
const { action, plugin } = usePluginActionContext();
const { handleRunClick } = useHandleRunClick();
const { callRunActionAnalytics } = useAnalyticsOnRunClick();
const [isMenuOpen, toggleMenuOpen] = useToggle([false, true]);
const blockExecution = useBlockExecution();
const isRunning = useSelector(isActionRunning(action.id));
const isAnvilEnabled = useSelector(getIsAnvilEnabledInCurrentApplication);

const onRunClick = useCallback(() => {
const isSkipOpeningDebugger =
isAnvilEnabled && plugin.type === PluginType.AI;

callRunActionAnalytics();
handleRunClick();
}, [callRunActionAnalytics, handleRunClick]);
handleRunClick(isSkipOpeningDebugger);
}, [callRunActionAnalytics, handleRunClick, isAnvilEnabled, plugin.type]);

return (
<IDEToolbar>
Expand Down
11 changes: 9 additions & 2 deletions app/client/src/PluginActionEditor/store/pluginEditorReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,17 @@ export const handlers = {
},
[ReduxActionTypes.RUN_ACTION_REQUEST]: (
state: PluginActionEditorState,
action: ReduxAction<{ id: string }>,
action: ReduxAction<{
skipOpeningDebugger: boolean;
id: string;
}>,
) => {
set(state, ["isRunning", action.payload.id], true);
set(state, ["debugger", "selectedTab"], DEBUGGER_TAB_KEYS.RESPONSE_TAB);

if (!action.payload.skipOpeningDebugger) {
set(state, ["debugger", "selectedTab"], DEBUGGER_TAB_KEYS.RESPONSE_TAB);
}

set(state, ["debugger", "open"], true);
},
[ReduxActionTypes.RUN_ACTION_CANCELLED]: (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { useCallback } from "react";
import { useDispatch } from "react-redux";
import { runAction } from "actions/pluginActionActions";
import type { PaginationField } from "api/ActionAPI";
import { usePluginActionContext } from "PluginActionEditor/PluginActionContext";

function useHandleRunClick() {
const { action } = usePluginActionContext();
const dispatch = useDispatch();

const handleRunClick = useCallback(
(paginationField?: PaginationField) => {
dispatch(runAction(action?.id ?? "", paginationField));
(skipOpeningDebugger = false) => {
dispatch(runAction(action?.id ?? "", undefined, skipOpeningDebugger));
},
[action.id, dispatch],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ function InputText(props: InputTextProp) {

class ComputeTablePropertyControlV2 extends BaseControl<ComputeTablePropertyControlPropsV2> {
static getBindingPrefix(tableName: string) {
return `{{${tableName}.processedTableData.map((currentRow, currentIndex) => { try { return ( `;
return `{{${tableName}.processedTableData.map((currentRow, currentIndex) => ( `;
}

static bindingSuffix = `); } catch (e) { return null; }})}}`;
static bindingSuffix = `))}}`;

render() {
const {
Expand Down
11 changes: 9 additions & 2 deletions app/client/src/sagas/ActionExecution/PluginActionSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ import {
findDatatype,
isTrueObject,
} from "ee/workers/Evaluation/evaluationUtils";
import type { Plugin } from "entities/Plugin";
import { type Plugin, PluginType } from "entities/Plugin";
import { getIsAnvilEnabledInCurrentApplication } from "../../layoutSystems/anvil/integrations/selectors";
import { setDefaultActionDisplayFormat } from "./PluginActionSagaUtils";
import { checkAndLogErrorsIfCyclicDependency } from "sagas/helper";
import { toast } from "@appsmith/ads";
Expand Down Expand Up @@ -1120,6 +1121,9 @@ function* executePageLoadAction(
const datasourceId: string = (action?.datasource as any)?.id;
const datasource: Datasource = yield select(getDatasource, datasourceId);
const plugin: Plugin = yield select(getPlugin, action?.pluginId);
const isAnvilEnabled: boolean = yield select(
getIsAnvilEnabledInCurrentApplication,
);

AnalyticsUtil.logEvent("EXECUTE_ACTION", {
type: pageAction.pluginType,
Expand Down Expand Up @@ -1179,7 +1183,10 @@ function* executePageLoadAction(

// open response tab in debugger on exection of action on page load.
// Only if current page is the page on which the action is executed.
if (window.location.pathname.includes(pageAction.id))
if (
window.location.pathname.includes(pageAction.id) &&
!(isAnvilEnabled && pageAction.pluginType === PluginType.AI)
)
yield put(
setPluginActionEditorDebuggerState({
open: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export const transformDataPureFn = (
): tableData => {
if (isArray(tableData)) {
return tableData.map((row, rowIndex) => {
const newRow: { [key: string]: unknown } = {};
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const newRow: { [key: string]: any } = {};

columns.forEach((column) => {
const { alias } = column;
Expand Down
Loading
Loading