chore: Add sourceData of select and multi select widgets to dynamiPro… (#26308)
…pertyPathList > Pull Request Template > > Use this template to quickly create a well written pull request. Delete all quotes before creating the pull request. > ## Description > Add a TL;DR when description is extra long (helps content team) > > Please include a summary of the changes and which issue has been fixed. Please also include relevant motivation > and context. List any dependencies that are required for this change > > Links to Notion, Figma or any other documents that might be relevant to the PR > > #### PR fixes following issue(s) Fixes https://github.com/appsmithorg/appsmith/issues/26307 > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
This commit is contained in:
parent
79d2d2f98c
commit
f2ceaca664
|
|
@ -71,7 +71,7 @@ export const layoutConfigurations: LayoutConfigurations = {
|
||||||
FLUID: { minWidth: -1, maxWidth: -1 },
|
FLUID: { minWidth: -1, maxWidth: -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
export const LATEST_PAGE_VERSION = 84;
|
export const LATEST_PAGE_VERSION = 85;
|
||||||
|
|
||||||
export const GridDefaults = {
|
export const GridDefaults = {
|
||||||
DEFAULT_CELL_SIZE: 1,
|
DEFAULT_CELL_SIZE: 1,
|
||||||
|
|
|
||||||
|
|
@ -810,6 +810,15 @@ const migrations: Migration[] = [
|
||||||
],
|
],
|
||||||
version: 83,
|
version: 83,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
functionLookup: [
|
||||||
|
{
|
||||||
|
moduleObj: selectWidgetMigration,
|
||||||
|
functionName: "migrateSelectWidgetAddSourceDataPropertyPathList",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
version: 84,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const mockFnObj: Record<number, any> = {};
|
const mockFnObj: Record<number, any> = {};
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ import { migrateCheckboxSwitchProperty } from "./migrations/PropertyPaneMigratio
|
||||||
import { migrateChartWidgetReskinningData } from "./migrations/ChartWidgetReskinningMigrations";
|
import { migrateChartWidgetReskinningData } from "./migrations/ChartWidgetReskinningMigrations";
|
||||||
import {
|
import {
|
||||||
MigrateSelectTypeWidgetDefaultValue,
|
MigrateSelectTypeWidgetDefaultValue,
|
||||||
|
migrateSelectWidgetAddSourceDataPropertyPathList,
|
||||||
migrateSelectWidgetOptionToSourceData,
|
migrateSelectWidgetOptionToSourceData,
|
||||||
migrateSelectWidgetSourceDataBindingPathList,
|
migrateSelectWidgetSourceDataBindingPathList,
|
||||||
} from "./migrations/SelectWidget";
|
} from "./migrations/SelectWidget";
|
||||||
|
|
@ -1215,6 +1216,11 @@ export const transformDSL = (currentDSL: DSLWidget, newPage = false) => {
|
||||||
|
|
||||||
if (currentDSL.version == 83) {
|
if (currentDSL.version == 83) {
|
||||||
currentDSL = migrateAddShowHideDataPointLabels(currentDSL);
|
currentDSL = migrateAddShowHideDataPointLabels(currentDSL);
|
||||||
|
currentDSL.version = 84;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentDSL.version === 84) {
|
||||||
|
currentDSL = migrateSelectWidgetAddSourceDataPropertyPathList(currentDSL);
|
||||||
currentDSL.version = LATEST_PAGE_VERSION;
|
currentDSL.version = LATEST_PAGE_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import type { DSLWidget } from "widgets/constants";
|
import type { DSLWidget } from "widgets/constants";
|
||||||
import {
|
import {
|
||||||
MigrateSelectTypeWidgetDefaultValue,
|
MigrateSelectTypeWidgetDefaultValue,
|
||||||
|
migrateSelectWidgetAddSourceDataPropertyPathList,
|
||||||
migrateSelectWidgetSourceDataBindingPathList,
|
migrateSelectWidgetSourceDataBindingPathList,
|
||||||
} from "./SelectWidget";
|
} from "./SelectWidget";
|
||||||
|
|
||||||
|
|
@ -1965,3 +1966,206 @@ describe("migrateSelectWidgetSourceDataBindingPathList", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("migrateSelectWidgetAddSourceDataPropertyPathList", () => {
|
||||||
|
test("should test that sourceData is added to the dynamicPropertyPathList", () => {
|
||||||
|
const result = migrateSelectWidgetAddSourceDataPropertyPathList({
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
type: "TABLE_WIDGET_V2",
|
||||||
|
options: [],
|
||||||
|
dynamicPropertyPathList: [
|
||||||
|
{
|
||||||
|
key: "optionValue",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "sourceData",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "optionLabel",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "TABLE_WIDGET_V2",
|
||||||
|
options: [],
|
||||||
|
dynamicPropertyPathList: [
|
||||||
|
{
|
||||||
|
key: "optionValue",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "optionLabel",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "TABLE_WIDGET_V2",
|
||||||
|
options: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "SELECT_WIDGET",
|
||||||
|
options: [],
|
||||||
|
dynamicPropertyPathList: [
|
||||||
|
{
|
||||||
|
key: "optionValue",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "sourceData",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "optionLabel",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "SELECT_WIDGET",
|
||||||
|
options: [],
|
||||||
|
dynamicPropertyPathList: [
|
||||||
|
{
|
||||||
|
key: "optionValue",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "optionLabel",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "MULTI_SELECT_WIDGET_V2",
|
||||||
|
options: [],
|
||||||
|
dynamicPropertyPathList: [
|
||||||
|
{
|
||||||
|
key: "optionLabel",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "sourceData",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "optionValue",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "MULTI_SELECT_WIDGET_V2",
|
||||||
|
options: [],
|
||||||
|
dynamicPropertyPathList: [
|
||||||
|
{
|
||||||
|
key: "optionLabel",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "optionValue",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "MULTI_SELECT_WIDGET_V2",
|
||||||
|
options: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
} as any as DSLWidget);
|
||||||
|
|
||||||
|
expect(result).toEqual({
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
type: "TABLE_WIDGET_V2",
|
||||||
|
options: [],
|
||||||
|
dynamicPropertyPathList: [
|
||||||
|
{
|
||||||
|
key: "optionValue",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "sourceData",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "optionLabel",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "TABLE_WIDGET_V2",
|
||||||
|
options: [],
|
||||||
|
dynamicPropertyPathList: [
|
||||||
|
{
|
||||||
|
key: "optionValue",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "optionLabel",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "TABLE_WIDGET_V2",
|
||||||
|
options: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "SELECT_WIDGET",
|
||||||
|
options: [],
|
||||||
|
dynamicPropertyPathList: [
|
||||||
|
{
|
||||||
|
key: "optionValue",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "sourceData",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "optionLabel",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "SELECT_WIDGET",
|
||||||
|
options: [],
|
||||||
|
dynamicPropertyPathList: [
|
||||||
|
{
|
||||||
|
key: "optionValue",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "optionLabel",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "sourceData",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "MULTI_SELECT_WIDGET_V2",
|
||||||
|
options: [],
|
||||||
|
dynamicPropertyPathList: [
|
||||||
|
{
|
||||||
|
key: "optionLabel",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "sourceData",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "optionValue",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "MULTI_SELECT_WIDGET_V2",
|
||||||
|
options: [],
|
||||||
|
dynamicPropertyPathList: [
|
||||||
|
{
|
||||||
|
key: "optionLabel",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "optionValue",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "sourceData",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "MULTI_SELECT_WIDGET_V2",
|
||||||
|
options: [],
|
||||||
|
dynamicPropertyPathList: [
|
||||||
|
{
|
||||||
|
key: "sourceData",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -74,3 +74,32 @@ export function migrateSelectWidgetSourceDataBindingPathList(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Migration to add sourceData to the dynamicPropertyPathList
|
||||||
|
*/
|
||||||
|
export function migrateSelectWidgetAddSourceDataPropertyPathList(
|
||||||
|
currentDSL: DSLWidget,
|
||||||
|
) {
|
||||||
|
return traverseDSLAndMigrate(currentDSL, (widget: WidgetProps) => {
|
||||||
|
if (["SELECT_WIDGET", "MULTI_SELECT_WIDGET_V2"].includes(widget.type)) {
|
||||||
|
const dynamicPropertyPathList = widget.dynamicPropertyPathList;
|
||||||
|
|
||||||
|
const sourceDataIndex = dynamicPropertyPathList
|
||||||
|
?.map((d) => d.key)
|
||||||
|
.indexOf("sourceData");
|
||||||
|
|
||||||
|
if (sourceDataIndex && sourceDataIndex === -1) {
|
||||||
|
dynamicPropertyPathList?.push({
|
||||||
|
key: "sourceData",
|
||||||
|
});
|
||||||
|
} else if (!Array.isArray(dynamicPropertyPathList)) {
|
||||||
|
widget.dynamicPropertyPathList = [
|
||||||
|
{
|
||||||
|
key: "sourceData",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user