-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat: Update TableWidgetV2 to include customIsLoading property #36857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f43cdff
refactor: Update TableWidgetV2 to include userDefinedIsLoading property
rahulbarwal 4c5948a
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
rahulbarwal 62b1a90
Refactor TableWidgetV2 to handle user-defined loading state
rahulbarwal ae0416e
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
rahulbarwal 615573e
Refactor TableWidgetV2 loading state properties
rahulbarwal f4385af
Refactor FeatureFlag and TableWidgetV2 loading state properties
rahulbarwal 4020ea7
Refactor FeatureFlag and TableWidgetV2 loading state properties
rahulbarwal dcab58c
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
rahulbarwal 1c6f4f9
Adds unit test for custom loading flag.
rahulbarwal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
181 changes: 181 additions & 0 deletions
181
app/client/src/widgets/TableWidgetV2/widget/TableRendered.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,181 @@ | ||
| import { ResponsiveBehavior } from "layoutSystems/common/utils/constants"; | ||
| import TableWidgetV2 from "."; | ||
| import type { TableWidgetProps } from "../constants"; | ||
|
|
||
| describe("TableWidgetV2 getWidgetView", () => { | ||
| const tableWidgetProps: TableWidgetProps = { | ||
| customIsLoading: false, | ||
| customIsLoadingValue: false, | ||
| delimiter: ",", | ||
| filteredTableData: [], | ||
| isVisibleDownload: true, | ||
| isVisibleFilters: true, | ||
| isVisiblePagination: true, | ||
| isVisibleSearch: true, | ||
| pageSize: 10, | ||
| primaryColumns: {}, | ||
| totalRecordsCount: 100, | ||
| accentColor: "#000000", | ||
| borderColor: "#000000", | ||
| borderRadius: "40px", | ||
| borderWidth: "1px", | ||
| boxShadow: "none", | ||
| canFreezeColumn: true, | ||
| columnWidthMap: {}, | ||
| compactMode: "DEFAULT", | ||
| filters: [], | ||
| isAddRowInProgress: false, | ||
| isEditableCellsValid: {}, | ||
| isLoading: false, | ||
| isSortable: true, | ||
| multiRowSelection: false, | ||
| pageNo: 1, | ||
| renderMode: "CANVAS", | ||
| searchText: "", | ||
| selectedRowIndex: -1, | ||
| selectedRowIndices: [], | ||
| serverSidePaginationEnabled: false, | ||
| tableData: [], | ||
| widgetId: "widgetId", | ||
| widgetName: "TableWidget", | ||
| componentWidth: 800, | ||
| componentHeight: 600, | ||
| onPageChange: "", | ||
| onSearchTextChanged: "", | ||
| onSort: "", | ||
| onRowSelected: "", | ||
| onAddNewRowSave: "", | ||
| onAddNewRowDiscard: "", | ||
| onBulkSave: "", | ||
| onBulkDiscard: "", | ||
| onPageSizeChange: "", | ||
| commitBatchMetaUpdates: jest.fn(), | ||
| pushBatchMetaUpdates: jest.fn(), | ||
| updateWidgetMetaProperty: jest.fn(), | ||
| updateWidgetProperty: "", | ||
| updateOneClickBindingOptionsVisibility: "", | ||
| // Added missing properties | ||
| primaryColumnId: "", | ||
| columnOrder: [], | ||
| derivedColumns: {}, | ||
| dynamicPropertyPathList: [], | ||
| dynamicTriggerPathList: [], | ||
| dynamicBindingPathList: [], | ||
| childStylesheet: {}, | ||
| isVisible: true, | ||
| version: 1, | ||
| parentColumnSpace: 1, | ||
| parentRowSpace: 1, | ||
| leftColumn: 0, | ||
| rightColumn: 0, | ||
| topRow: 0, | ||
| bottomRow: 0, | ||
| parentId: "", | ||
| responsiveBehavior: ResponsiveBehavior.Hug, | ||
| minWidth: 0, | ||
| minHeight: 0, | ||
| isDisabled: false, | ||
| animateLoading: false, | ||
| primaryColor: "", | ||
| backgroundColor: "", | ||
| textColor: "", | ||
| fontFamily: "", | ||
| fontSize: "", | ||
| fontStyle: "", | ||
| textAlign: "", | ||
| textDecoration: "", | ||
| textTransform: "", | ||
| letterSpacing: "", | ||
| lineHeight: "", | ||
| whiteSpace: "", | ||
| overflow: "", | ||
| textOverflow: "", | ||
| wordBreak: "", | ||
| wordWrap: "", | ||
| cursor: "", | ||
| zIndex: 0, | ||
| pristine: true, | ||
| label: "TableWidget", | ||
| defaultSearchText: "", | ||
| sortOrder: { column: "", order: null }, | ||
| transientTableData: { data: { name: "name" } }, | ||
| newRow: {}, | ||
| firstEditableColumnIdByOrder: "", | ||
| enableServerSideFiltering: false, | ||
| onTableFilterUpdate: "", | ||
| type: "", | ||
| allowAddNewRow: false, | ||
| defaultNewRow: {}, | ||
| frozenColumnIndices: { a: 1 }, | ||
| }; | ||
|
|
||
| describe("TableWidgetV2 loading checks", () => { | ||
| describe("When custom loading logic is not provided", () => { | ||
| it("Should not be loading with built-in property isLoading is set to false", () => { | ||
| const tableWidget = new TableWidgetV2(tableWidgetProps); | ||
| const widgetView = tableWidget.getWidgetView(); | ||
|
|
||
| expect(widgetView.props.children.props.isLoading).toBe(false); | ||
| }); | ||
| it("Should be loading with built-in property isLoading is set to true", () => { | ||
| const tableWidget = new TableWidgetV2({ | ||
| ...tableWidgetProps, | ||
| isLoading: true, | ||
| }); | ||
| const widgetView = tableWidget.getWidgetView(); | ||
|
|
||
| expect(widgetView.props.children.props.isLoading).toBe(true); | ||
| }); | ||
| }); | ||
| describe("When custom loading logic is provided", () => { | ||
| describe("When isLoading is false", () => { | ||
| it("Should not be loading with isLoading: false, customIsLoading: true and customIsLoadingTrue: true", () => { | ||
| const tableWidget = new TableWidgetV2({ | ||
| ...tableWidgetProps, | ||
| customIsLoading: true, | ||
| customIsLoadingValue: false, | ||
| isLoading: false, | ||
| }); | ||
| const widgetView = tableWidget.getWidgetView(); | ||
|
|
||
| expect(widgetView.props.children.props.isLoading).toBe(false); | ||
| }); | ||
| it("Should be loading with customIsLoading set to true and customIsLoadingTrue set to true", () => { | ||
| const tableWidget = new TableWidgetV2({ | ||
| ...tableWidgetProps, | ||
| customIsLoading: true, | ||
| customIsLoadingValue: true, | ||
| isLoading: false, | ||
| }); | ||
| const widgetView = tableWidget.getWidgetView(); | ||
|
|
||
| expect(widgetView.props.children.props.isLoading).toBe(true); | ||
| }); | ||
| }); | ||
| describe("When isLoading is true", () => { | ||
| it("Should be loading with customIsLoading set to true and customIsLoadingTrue set to false", () => { | ||
| const tableWidget = new TableWidgetV2({ | ||
| ...tableWidgetProps, | ||
| customIsLoading: true, | ||
| customIsLoadingValue: false, | ||
| isLoading: true, | ||
| }); | ||
| const widgetView = tableWidget.getWidgetView(); | ||
|
|
||
| expect(widgetView.props.children.props.isLoading).toBe(true); | ||
| }); | ||
| it("Should be loading with customIsLoading set to true and customIsLoadingTrue set to true, even if in built loading is false", () => { | ||
| const tableWidget = new TableWidgetV2({ | ||
| ...tableWidgetProps, | ||
| customIsLoading: true, | ||
| customIsLoadingValue: true, | ||
| isLoading: true, | ||
| }); | ||
| const widgetView = tableWidget.getWidgetView(); | ||
|
|
||
| expect(widgetView.props.children.props.isLoading).toBe(true); | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mismatch between
controlTypeandvalidationforcustomIsLoadingValue.The
controlTypeis set to"INPUT_TEXT"but the validation expects aBOOLEAN. Consider updating thecontrolTypeto"SWITCH"or adjusting the validation accordingly.Apply this diff to resolve the mismatch:
propertyName: "customIsLoadingValue", label: "isLoading value", - controlType: "INPUT_TEXT", + controlType: "SWITCH", defaultValue: "", isBindProperty: true, isTriggerProperty: false, validation: { type: ValidationTypes.BOOLEAN }, hidden: (props: TableWidgetProps) => !props.customIsLoading, dependencies: ["customIsLoading"],📝 Committable suggestion