Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
@@ -0,0 +1,77 @@
import * as _ from "../../../../../support/Objects/ObjectsCore";
const dynamicInputLocators = require("../../../../../locators/DynamicInput.json");

const tableData = `[
{
"id": 1,
"date": "2023-06-01T12:00:00-06:30",
"email": "test1@gmail.com",
"userName": "test1",
"department": "Marketing"
},
{
"id": 2,
"date": "2023-06-02T12:00:00-06:30",
"email": "test2@gmail.com",
"userName": "test2",
"department": "Marketing"
},
{
"id": 3,
"date": "2023-06-03T12:00:00-06:30",
"email": "test3@gmail.com",
"userName": "test3",
"department": "HR"
},
{
"id": 4,
"date": "2023-06-04T12:00:00-06:30",
"email": "test4@gmail.com",
"userName": "test4",
"department": "HR"
},
{
"id": 5,
"date": "2023-06-05T12:00:00-06:30",
"email": "test5@gmail.com",
"userName": "test5",
"department": "IT"
},
{
"id": 6,
"email": "test6@gmail.com",
"userName": "test6",
"date": "2023-06-06T12:00:00-06:30",
"department": "IT"
},
{
"id": 7,
"date": "2023-06-07T12:00:00-06:30",
"email": "test7@gmail.com",
"userName": "test7",
"department": "Customer Service"
}
]`;
describe(
"filteredTableData property in autocomplete suggestions of table widget",
{ tags: ["@tag.Widget", "@tag.Table"] },
() => {
it("check 'filteredTableData' property in autocomplete suggestions",()=>{
_.agHelper.AddDsl("tableV2NewDsl");
cy.openPropertyPane("tablewidgetv2");
_.propPane.EnterJSContext("Table data", tableData);
_.propPane.TogglePropertyState("Allow filtering", "On");

_.table.OpenNFilterTable("department", "contains", "Marketing");
_.table.CloseFilter();

cy.openPropertyPane("textwidget");
cy.testCodeMirror("/")
cy.get(`${dynamicInputLocators.hints} li`)
.eq(0)
.should("have.text", "Add a binding").click();
_.propPane.TypeTextIntoField("Text", "Table1.",false);
cy.get(`${dynamicInputLocators.hints} li`).contains("filteredTableData").should('be.visible').click();

})
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this red changes. Linter error. Kindly run linter.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sagar-qa007 How to run linter

Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
import { dataTreeTypeDefCreator } from "utils/autocomplete/dataTreeTypeDefCreator";
import type {
DataTreeEntityObject,
WidgetEntityConfig,
} from "ee/entities/DataTree/types";
import {
ENTITY_TYPE,
EvaluationSubstitutionType,
} from "entities/DataTree/dataTreeFactory";

import TableWidget from "widgets/TableWidgetV2";
import { registerWidgets } from "WidgetProvider/factory/registrationHelper";
import type { TableWidgetProps } from "../constants";
import type { batchUpdateWidgetMetaPropertyType, DebouncedExecuteActionPayload } from "widgets/MetaHOC";
describe("Bug: check filteredTableData property in autocomplete definitions of table widget", () => {
it("check filteredTableData property", () => {
registerWidgets([TableWidget]);
const tableWidgetProps:TableWidgetProps={
pristine: false,
label: "data",
searchText: "",
type: "TABLE_WIDGET_V2",
defaultSearchText: "",
tableData: [
{
"id": 1,
"name": "pavan"
},
{
"id": 2,
"name": "anil"
},
{
"id": 3,
"name": "radha"
}
],
pageSize: 0,
onSearchTextChanged: "",
onSort: "",
selectedRowIndices: [],
frozenColumnIndices: {
"id":1
},
primaryColumns: {
id:{
"allowCellWrapping": false,
"allowSameOptionsInNewRow": true,
"index": 0,
"width": 150,
"originalId": "id",
"id": "id",
"alias": "id",
"horizontalAlignment": "LEFT",
"verticalAlignment": "CENTER",
"columnType": "number",
"textSize": "0.875rem",
"enableFilter": true,
"enableSort": true,
"isVisible": true,
"isDisabled": false,
"isCellEditable": false,
"isEditable": false,
"isCellVisible": true,
"isDerived": false,
"label": "id",
"isSaveVisible": true,
"isDiscardVisible": true,
"validation": {},
"currencyCode": "USD",
"decimals": 0,
"thousandSeparator": true,
"notation": "standard",
"fontStyle": "",
"cellBackground": "",
"textColor": "",
computedValue: ""
}
},
derivedColumns: {
id:{
id: "",
originalId: "",
columnType: "",
isVisible: false,
index: 0,
isDerived: false,
computedValue: "",
alias: "",
allowCellWrapping: false,
width: 0,
isCellEditable: false,
isEditable: false
}
},
sortOrder: {
column: "",
order: null
},
transientTableData: {},
primaryColor: "",
borderRadius: "",
isEditableCellsValid: {},
isAddRowInProgress: false,
newRow: {},
firstEditableColumnIdByOrder: "",
enableServerSideFiltering: false,
onTableFilterUpdate: "",
hoverValue: "",
onHoverTable: "",
widgetId: "",
widgetName: "",
Comment thread
rahulbarwal marked this conversation as resolved.
Outdated
renderMode: "CANVAS",
version: 0,
parentColumnSpace: 0,
parentRowSpace: 0,
leftColumn: 0,
rightColumn: 0,
topRow: 0,
bottomRow: 0,
isLoading: false,
commitBatchMetaUpdates: function (): void {
throw new Error("Function not implemented.");
},
pushBatchMetaUpdates: function (propertyName: string | batchUpdateWidgetMetaPropertyType, propertyValue?: unknown, actionExecution?: DebouncedExecuteActionPayload | undefined): void {
throw new Error("Function not implemented.");
},
updateWidgetMetaProperty: function (propertyName: string, propertyValue: unknown, actionExecution?: DebouncedExecuteActionPayload | undefined): void {
throw new Error("Function not implemented.");
},
Comment thread
rahulbarwal marked this conversation as resolved.
Outdated
allowAddNewRow: false,
onAddNewRowSave: "",
onAddNewRowDiscard: "",
defaultNewRow: {},
"filteredTableData": [
{
"id": 1,
"name": "pavan",
"__originalIndex__": 0,
"__primaryKey__": 1,
"EditActions1": ""
},
{
"id": 2,
"name": "anil",
"__originalIndex__": 1,
"__primaryKey__": 2,
"EditActions1": ""
},
{
"id": 3,
"name": "radha",
"__originalIndex__": 2,
"__primaryKey__": 3,
"EditActions1": ""
}
],
Comment thread
rahulbarwal marked this conversation as resolved.
Outdated
}
const dataTreeEntity: DataTreeEntityObject = {
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
meta: {},
...tableWidgetProps

};
const dataTreeEntityConfig: WidgetEntityConfig = {
bindingPaths: {
defaultText: EvaluationSubstitutionType.TEMPLATE,
},
reactivePaths: {
defaultText: EvaluationSubstitutionType.TEMPLATE,
},
triggerPaths: {
onTextChange: true,
},
validationPaths: {},
logBlackList: {},
propertyOverrideDependency: {},
overridingPropertyPaths: {},
privateWidgets: {},
defaultMetaProps: [],
widgetId: "yolo",
widgetName: "Table1",
type: "TABLE_WIDGET_V2",
ENTITY_TYPE: ENTITY_TYPE.WIDGET,
};
const { def, entityInfo } = dataTreeTypeDefCreator(
{
Table1: dataTreeEntity,
},
{},
dataTreeEntityConfig,
);

expect(def).toHaveProperty("Table1.filteredTableData");
expect(entityInfo.get("Table1")).toStrictEqual({
type: ENTITY_TYPE.WIDGET,
subType: "TABLE_WIDGET_V2",
});
});
});
1 change: 1 addition & 0 deletions app/client/src/widgets/TableWidgetV2/widget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ class TableWidgetV2 extends BaseWidget<TableWidgetProps, WidgetState> {
isAddRowInProgress: "bool",
previousPageVisited: generateTypeDef(widget.previousPageVisited),
nextPageVisited: generateTypeDef(widget.nextPageButtonClicked),
filteredTableData: generateTypeDef(widget.filteredTableData)
};

if (this.getFeatureFlag(ALLOW_TABLE_WIDGET_SERVER_SIDE_FILTERING)) {
Expand Down