Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release' into chore/ga-autocommit
Browse files Browse the repository at this point in the history
  • Loading branch information
sondermanish committed Sep 23, 2024
2 parents d370a43 + cd3472a commit 42b43f1
Show file tree
Hide file tree
Showing 77 changed files with 238 additions and 6,086 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import commonlocators from "../../../../../../locators/commonlocators.json";
import {
agHelper,
entityExplorer,
locators,
propPane,
table,
} from "../../../../../../support/Objects/ObjectsCore";
import EditorNavigation, {
EntityType,
} from "../../../../../../support/Pages/EditorNavigation";

const TABLE_SELECT_WIDGET_ERROR_BORDER = "rgb(217, 25, 33)";
const TABLE_SELECT_WIDGET_VALID_BORDER = "rgb(85, 61, 233)";

describe(
"Table widget - Select column validation",
{ tags: ["@tag.Widget", "@tag.Table", "@tag.Select"] },
() => {
before(() => {
entityExplorer.DragNDropWidget("tablewidgetv2", 350, 500);
table.AddSampleTableData();
});
it("1. should prevent adding a row when a required select column has no data", () => {
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget);

// Allow adding a row in table
propPane.TogglePropertyState("Allow adding a row", "On");

// Edit step column to select type
table.ChangeColumnType("step", "Select", "v2");
table.EditColumn("step", "v2");

// Add data to select options
agHelper.UpdateCodeInput(
locators._controlOption,
`
[
{
"label": "#1",
"value": "#1"
},
{
"label": "#2",
"value": "#2"
},
{
"label": "#3",
"value": "#3"
}
]
`,
);

// Set step column to editable
propPane.TogglePropertyState("Editable", "On");

// Set step column to required
propPane.TogglePropertyState("Required", "On");

// Click add a new row
table.AddNewRow();

// Expect the save row button to be disabled
agHelper.GetElement(table._saveNewRow).should("be.disabled");

// Expect select to have an error color
agHelper
.GetElement(commonlocators.singleSelectWidgetButtonControl)
.should("have.css", "border-color", TABLE_SELECT_WIDGET_ERROR_BORDER);

// Select a valid option from the select table cell
agHelper.GetNClick(commonlocators.singleSelectWidgetButtonControl);
agHelper
.GetElement(commonlocators.singleSelectWidgetMenuItem)
.contains("#1")
.click();

// Expect the save row option to be enabled
agHelper.GetElement(table._saveNewRow).should("be.enabled");

// Expect button to have a valid color
agHelper
.GetElement(commonlocators.singleSelectWidgetButtonControl)
.should("have.css", "border-color", TABLE_SELECT_WIDGET_VALID_BORDER);

// Discard save new row
agHelper.GetElement(table._discardRow).click({ force: true });
});

it("2. should display an error when inline editing a required select cell in a table with no data", () => {
// Update table data to create emtpy cell in step column
propPane.NavigateBackToPropertyPane();
propPane.UpdatePropertyFieldValue(
"Table data",
`
[
{
"task": "Drop a table",
"status": "✅",
"action": ""
},
{
"step": "#2",
"task": "Create a query fetch_users with the Mock DB",
"status": "--",
"action": ""
},
{
"step": "#3",
"task": "Bind the query using => fetch_users.data",
"status": "--",
"action": ""
}
]
`,
);

// Click the first cell in the step column
table.ClickOnEditIcon(0, 0, true);

// Exect the select to have an error color
agHelper
.GetElement(commonlocators.singleSelectWidgetButtonControl)
.should("have.css", "border-color", TABLE_SELECT_WIDGET_ERROR_BORDER);
});
},
);
1 change: 1 addition & 0 deletions app/client/cypress/locators/commonlocators.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"callApi": ".t--property-control-onpagechange .t--open-dropdown-Select-Action",
"singleSelectMenuItem": ".bp3-menu-item.single-select div",
"singleSelectWidgetMenuItem": ".menu-item-link",
"singleSelectWidgetButtonControl": ".bp3-button.select-button",
"singleSelectActiveMenuItem": ".menu-item-active div",
"selectInputSearch": ".select-popover-wrapper .bp3-input",
"multiSelectMenuItem": "rc-select-item.rc-select-item-option div",
Expand Down
18 changes: 12 additions & 6 deletions app/client/cypress/support/Pages/Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,18 +638,24 @@ export class Table {
this.agHelper.GetNClick(colSettings);
}

public ClickOnEditIcon(rowIndex: number, colIndex: number) {
public ClickOnEditIcon(
rowIndex: number,
colIndex: number,
isSelectColumn: boolean = false,
) {
this.agHelper.HoverElement(this._tableRow(rowIndex, colIndex, "v2"));
this.agHelper.GetNClick(
this._tableRow(rowIndex, colIndex, "v2") + " " + this._editCellIconDiv,
0,
true,
);
this.agHelper.AssertElementVisibility(
this._tableRow(rowIndex, colIndex, "v2") +
" " +
this._editCellEditorInput,
);
if (!isSelectColumn) {
this.agHelper.AssertElementVisibility(
this._tableRow(rowIndex, colIndex, "v2") +
" " +
this._editCellEditorInput,
);
}
}

public EditTableCell(
Expand Down
14 changes: 12 additions & 2 deletions app/client/knip.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"entry": ["src/index.tsx"],
"project": ["src/**/*.tsx"],
"project": ["src/**/*.{tsx,ts,js}"],
"ignore": [
"packages/**/stories/**",
"packages/**/chromatic/**",
Expand All @@ -9,6 +9,16 @@
"packages/rts/build.js",
"packages/design-system/ads/src/Documentation/**",
"src/components/designSystems/blueprintjs/**",
"packages/design-system/ads/plopfile.mjs"
"packages/design-system/ads/plopfile.mjs",
"src/plugins/Linting/**",
"src/ee/plugins/Linting/**",
"src/ce/plugins/Linting/**",
"src/workers/Evaluation/**",
"src/widgets/ExternalWidget/component/script.js",
"src/widgets/ListWidgetV2/widget/derived.js",
"src/workers/Tern/tern.worker.ts",
"src/widgets/CustomWidget/component/appsmithConsole.js",
"src/serviceWorker.ts",
"src/ee/utils/serviceWorkerUtils.ts"
]
}
6 changes: 2 additions & 4 deletions app/client/src/PluginActionEditor/PluginActionEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
getDatasource,
getEditorConfig,
getPlugin,
getPluginSettingConfigs,
} from "ee/selectors/entitiesSelector";
import { PluginActionContextProvider } from "./PluginActionContext";
import { get } from "lodash";
Expand All @@ -16,6 +15,7 @@ import Spinner from "components/editorComponents/Spinner";
import CenteredWrapper from "components/designSystems/appsmith/CenteredWrapper";
import { Text } from "@appsmith/ads";
import { useIsEditorInitialised } from "IDE/hooks";
import { useActionSettingsConfig } from "./hooks";

interface ChildrenProps {
children: React.ReactNode | React.ReactNode[];
Expand All @@ -35,9 +35,7 @@ const PluginActionEditor = (props: ChildrenProps) => {
const datasourceId = get(action, "datasource.id", "");
const datasource = useSelector((state) => getDatasource(state, datasourceId));

const settingsConfig = useSelector((state) =>
getPluginSettingConfigs(state, pluginId),
);
const settingsConfig = useActionSettingsConfig(action);

const editorConfig = useSelector((state) => getEditorConfig(state, pluginId));

Expand Down
1 change: 1 addition & 0 deletions app/client/src/PluginActionEditor/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useActionSettingsConfig } from "ee/PluginActionEditor/hooks/useActionSettingsConfig";
14 changes: 8 additions & 6 deletions app/client/src/UITelemetry/PageLoadInstrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,12 @@ export class PageLoadInstrumentation extends InstrumentationBase {
this.ignoreResourceUrls = ignoreResourceUrls;
// Start the root span for the page load
this.rootSpan = startRootSpan("PAGE_LOAD", {}, 0);
}

init() {
// init method is present in the base class and needs to be implemented
// This is method is never called by the OpenTelemetry SDK
// Leaving it empty as it is done by other OpenTelemetry instrumentation classes
// Initialize the instrumentation after starting the root span
this.init();
}

enable(): void {
init() {
// Register connection change listener
this.addConnectionAttributes();

Expand All @@ -71,6 +68,11 @@ export class PageLoadInstrumentation extends InstrumentationBase {
}
}

enable() {
// enable method is present in the base class and needs to be implemented
// Leaving it empty as there is no need to do anything here
}

private addDeviceAttributes() {
this.rootSpan.setAttributes({
deviceMemory: (navigator as TNavigator).deviceMemory,
Expand Down
14 changes: 0 additions & 14 deletions app/client/src/actions/helpActions.ts

This file was deleted.

22 changes: 0 additions & 22 deletions app/client/src/actions/tourActions.ts

This file was deleted.

25 changes: 0 additions & 25 deletions app/client/src/api/SaasApi.ts

This file was deleted.

24 changes: 0 additions & 24 deletions app/client/src/assets/icons/blueprintjs/svgo.config.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useSelector } from "react-redux";
import { getPluginSettingConfigs } from "ee/selectors/entitiesSelector";
import type { Action } from "entities/Action";

function useActionSettingsConfig(action?: Action) {
return useSelector((state) =>
getPluginSettingConfigs(state, action?.pluginId || ""),
);
}

export { useActionSettingsConfig };
15 changes: 0 additions & 15 deletions app/client/src/ce/actions/auditLogsAction.ts

This file was deleted.

12 changes: 0 additions & 12 deletions app/client/src/ce/api/GitExtendedApi.ts

This file was deleted.

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 @@ -825,6 +825,7 @@ export const GIT_DISCONNECT_POPUP_MAIN_HEADING = () => `Are you sure?`;
export const CONFIGURE_GIT = () => "Configure Git";
export const IMPORT_APP = () => "Import app via Git";
export const SETTINGS_GIT = () => "Settings";
export const IMPORT_APP_CTA = () => "Import app";

export const GIT_CONNECTION = () => "Git connection";
export const GIT_IMPORT = () => "Git import";
Expand Down
Loading

0 comments on commit 42b43f1

Please sign in to comment.