From 6dced92a6b8b2fb006702b61d7437a2013761c90 Mon Sep 17 00:00:00 2001 From: cnathe Date: Wed, 13 Dec 2023 10:32:30 -0600 Subject: [PATCH 01/21] update API call controller and actions and update params to match new moveRows API format --- packages/components/releaseNotes/components.md | 5 +++++ .../src/internal/components/entities/APIWrapper.ts | 1 + .../internal/components/entities/EntityMoveModal.tsx | 2 ++ .../src/internal/components/entities/actions.ts | 10 ++++++++-- .../src/internal/components/entities/constants.ts | 4 ++-- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/components/releaseNotes/components.md b/packages/components/releaseNotes/components.md index b998903473..c99b76a69a 100644 --- a/packages/components/releaseNotes/components.md +++ b/packages/components/releaseNotes/components.md @@ -1,6 +1,11 @@ # @labkey/components Components, models, actions, and utility functions for LabKey applications and pages. +### version TBD +*Released*: TBD +- Consolidate move entities to MoveRowsAction in query controller + - update API call controller and actions and update params to match new moveRows API format + ### version 2.396.3 *Released*: 12 December 2023 - Issue 49199: Field Editor name input fix for jumping cursor to end of input diff --git a/packages/components/src/internal/components/entities/APIWrapper.ts b/packages/components/src/internal/components/entities/APIWrapper.ts index 45b3ef11f3..98d20fc548 100644 --- a/packages/components/src/internal/components/entities/APIWrapper.ts +++ b/packages/components/src/internal/components/entities/APIWrapper.ts @@ -94,6 +94,7 @@ export interface EntityAPIWrapper { sourceContainer: Container, targetContainer: string, entityDataType: EntityDataType, + queryName: string, rowIds?: number[], selectionKey?: string, useSnapshotSelection?: boolean, diff --git a/packages/components/src/internal/components/entities/EntityMoveModal.tsx b/packages/components/src/internal/components/entities/EntityMoveModal.tsx index 9cda652aa6..18ca47714e 100644 --- a/packages/components/src/internal/components/entities/EntityMoveModal.tsx +++ b/packages/components/src/internal/components/entities/EntityMoveModal.tsx @@ -121,6 +121,7 @@ export const EntityMoveModal: FC = memo(props => { currentContainer, targetContainerPath, entityDataType, + queryModel.queryName, rowIds_, selectionKey, useSnapshotSelection, @@ -165,6 +166,7 @@ export const EntityMoveModal: FC = memo(props => { confirmationData, entityDataType, useSelected, + queryModel.queryName, queryModel.filterArray.length, selectionKey, targetAppURL, diff --git a/packages/components/src/internal/components/entities/actions.ts b/packages/components/src/internal/components/entities/actions.ts index ad6de765b1..70686db9af 100644 --- a/packages/components/src/internal/components/entities/actions.ts +++ b/packages/components/src/internal/components/entities/actions.ts @@ -819,6 +819,7 @@ export function moveEntities( sourceContainer: Container, targetContainer: string, entityDataType: EntityDataType, + queryName: string, rowIds?: number[], selectionKey?: string, useSnapshotSelection?: boolean, @@ -827,11 +828,16 @@ export function moveEntities( return new Promise((resolve, reject) => { const params = { auditBehavior: AuditBehaviorTypes.DETAILED, + schemaName: entityDataType.instanceSchemaName, + queryName, targetContainer, userComment, }; if (rowIds) { - params['rowIds'] = rowIds; + params['rows'] = rowIds.reduce((prev, curr) => { + prev.push({ rowId: curr }); + return prev; + }, []); } if (selectionKey) { params['dataRegionSelectionKey'] = selectionKey; @@ -843,7 +849,7 @@ export function moveEntities( container: sourceContainer?.path, }), method: 'POST', - params, + jsonData: params, success: Utils.getCallbackWrapper(response => { if (response.success) { resolve(response); diff --git a/packages/components/src/internal/components/entities/constants.ts b/packages/components/src/internal/components/entities/constants.ts index 0b1491468b..e52af213b3 100644 --- a/packages/components/src/internal/components/entities/constants.ts +++ b/packages/components/src/internal/components/entities/constants.ts @@ -114,8 +114,8 @@ export const SampleTypeDataType: EntityDataType = { appUrlPrefixParts: ['samples'], operationConfirmationControllerName: 'experiment', operationConfirmationActionName: SAMPLE_OPERATION_CONFIRMATION_ACTION, - moveActionName: 'moveSamples.api', - moveControllerName: 'experiment', + moveActionName: 'moveRows.api', + moveControllerName: 'query', nounSingular: 'sample', nounPlural: 'samples', nounAsParentSingular: 'Parent', From 779674cb0b4abf21d294346d91c41b619a555e6d Mon Sep 17 00:00:00 2001 From: cnathe Date: Wed, 13 Dec 2023 10:33:24 -0600 Subject: [PATCH 02/21] 2.396.3-fb-moveRowsAPI.0 --- packages/components/package-lock.json | 4 ++-- packages/components/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/components/package-lock.json b/packages/components/package-lock.json index 9a32ba9227..86a0de25c3 100644 --- a/packages/components/package-lock.json +++ b/packages/components/package-lock.json @@ -1,12 +1,12 @@ { "name": "@labkey/components", - "version": "2.396.3", + "version": "2.396.3-fb-moveRowsAPI.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@labkey/components", - "version": "2.396.3", + "version": "2.396.3-fb-moveRowsAPI.0", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@labkey/api": "1.27.0", diff --git a/packages/components/package.json b/packages/components/package.json index 22eecb3a92..b577b65966 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@labkey/components", - "version": "2.396.3", + "version": "2.396.3-fb-moveRowsAPI.0", "description": "Components, models, actions, and utility functions for LabKey applications and pages", "sideEffects": false, "files": [ From d2608428171034b38bdb57e4912ac4bf7b6881a6 Mon Sep 17 00:00:00 2001 From: cnathe Date: Wed, 13 Dec 2023 10:33:35 -0600 Subject: [PATCH 03/21] jest snapshot update --- .../__snapshots__/SampleTypeDesigner.spec.tsx.snap | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/components/src/internal/components/domainproperties/samples/__snapshots__/SampleTypeDesigner.spec.tsx.snap b/packages/components/src/internal/components/domainproperties/samples/__snapshots__/SampleTypeDesigner.spec.tsx.snap index 06376c57d0..aff5f44c9a 100644 --- a/packages/components/src/internal/components/domainproperties/samples/__snapshots__/SampleTypeDesigner.spec.tsx.snap +++ b/packages/components/src/internal/components/domainproperties/samples/__snapshots__/SampleTypeDesigner.spec.tsx.snap @@ -540,8 +540,8 @@ exports[`SampleTypeDesigner default properties 1`] = ` "schemaName": "exp", "viewName": undefined, }, - "moveActionName": "moveSamples.api", - "moveControllerName": "experiment", + "moveActionName": "moveRows.api", + "moveControllerName": "query", "nounAsParentPlural": "Parents", "nounAsParentSingular": "Parent", "nounPlural": "samples", @@ -1119,8 +1119,8 @@ exports[`SampleTypeDesigner initModel with name URL props 1`] = ` "schemaName": "exp", "viewName": undefined, }, - "moveActionName": "moveSamples.api", - "moveControllerName": "experiment", + "moveActionName": "moveRows.api", + "moveControllerName": "query", "nounAsParentPlural": "Parents", "nounAsParentSingular": "Parent", "nounPlural": "samples", From 26b3ea8a2d126fac25295da382c956e42103cc1d Mon Sep 17 00:00:00 2001 From: cnathe Date: Wed, 13 Dec 2023 10:59:52 -0600 Subject: [PATCH 04/21] 2.397.1-fb-moveRowsAPI.0 --- packages/components/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/package.json b/packages/components/package.json index a5ab35d4ff..90f64fd815 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@labkey/components", - "version": "2.397.1", + "version": "2.397.1-fb-moveRowsAPI.0", "description": "Components, models, actions, and utility functions for LabKey applications and pages", "sideEffects": false, "files": [ From 4a9c319752a61cb0821478d4e26bd65b55f5c9e7 Mon Sep 17 00:00:00 2001 From: cnathe Date: Wed, 13 Dec 2023 11:00:18 -0600 Subject: [PATCH 05/21] 2.397.1-fb-moveRowsAPI.0 --- packages/components/package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/components/package-lock.json b/packages/components/package-lock.json index bd41cb1e80..c197a460fd 100644 --- a/packages/components/package-lock.json +++ b/packages/components/package-lock.json @@ -1,12 +1,12 @@ { "name": "@labkey/components", - "version": "2.397.1", + "version": "2.397.1-fb-moveRowsAPI.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@labkey/components", - "version": "2.397.1", + "version": "2.397.1-fb-moveRowsAPI.0", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@labkey/api": "1.27.0", From d02d2b0a1331b0da976cd40b21d0dc67a3da66aa Mon Sep 17 00:00:00 2001 From: cnathe Date: Wed, 13 Dec 2023 12:39:20 -0600 Subject: [PATCH 06/21] 2.397.2-fb-moveRowsAPI.0 --- packages/components/package-lock.json | 4 ++-- packages/components/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/components/package-lock.json b/packages/components/package-lock.json index 66f4ed5b0c..761fb5c06a 100644 --- a/packages/components/package-lock.json +++ b/packages/components/package-lock.json @@ -1,12 +1,12 @@ { "name": "@labkey/components", - "version": "2.397.2", + "version": "2.397.2-fb-moveRowsAPI.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@labkey/components", - "version": "2.397.2", + "version": "2.397.2-fb-moveRowsAPI.0", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@labkey/api": "1.27.0", diff --git a/packages/components/package.json b/packages/components/package.json index b512962194..117ea22d1d 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@labkey/components", - "version": "2.397.2", + "version": "2.397.2-fb-moveRowsAPI.0", "description": "Components, models, actions, and utility functions for LabKey applications and pages", "sideEffects": false, "files": [ From 0411497cdc9f91d23b0c50c4a869157387ea927f Mon Sep 17 00:00:00 2001 From: cnathe Date: Wed, 13 Dec 2023 13:29:33 -0600 Subject: [PATCH 07/21] Update move controller/action for data classes / sources --- .../dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap | 4 ++-- .../components/src/internal/components/entities/constants.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap b/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap index 45d8f689ab..0b729a05cd 100644 --- a/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap +++ b/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap @@ -232,8 +232,8 @@ exports[`DataClassDesigner custom properties 1`] = ` "schemaName": "exp", "viewName": undefined, }, - "moveActionName": "moveSources.api", - "moveControllerName": "experiment", + "moveActionName": "moveRows.api", + "moveControllerName": "query", "nounAsParentPlural": "Data Types", "nounAsParentSingular": "Parent", "nounPlural": "sources", diff --git a/packages/components/src/internal/components/entities/constants.ts b/packages/components/src/internal/components/entities/constants.ts index e52af213b3..21a219b467 100644 --- a/packages/components/src/internal/components/entities/constants.ts +++ b/packages/components/src/internal/components/entities/constants.ts @@ -145,8 +145,8 @@ export const DataClassDataType: EntityDataType = { typeListingSchemaQuery: SCHEMAS.EXP_TABLES.DATA_CLASSES, listingSchemaQuery: SCHEMAS.EXP_TABLES.DATA, instanceSchemaName: SCHEMAS.DATA_CLASSES.SCHEMA, - moveActionName: 'moveSources.api', - moveControllerName: 'experiment', + moveActionName: 'moveRows.api', + moveControllerName: 'query', operationConfirmationControllerName: 'experiment', operationConfirmationActionName: DATA_OPERATION_CONFIRMATION_ACTION, nounSingular: 'source', From b200d25ae306d852f511a0b93e73e033636424d4 Mon Sep 17 00:00:00 2001 From: cnathe Date: Wed, 13 Dec 2023 13:30:05 -0600 Subject: [PATCH 08/21] 2.397.2-fb-moveRowsAPI.1 --- packages/components/package-lock.json | 4 ++-- packages/components/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/components/package-lock.json b/packages/components/package-lock.json index 761fb5c06a..a5689e1718 100644 --- a/packages/components/package-lock.json +++ b/packages/components/package-lock.json @@ -1,12 +1,12 @@ { "name": "@labkey/components", - "version": "2.397.2-fb-moveRowsAPI.0", + "version": "2.397.2-fb-moveRowsAPI.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@labkey/components", - "version": "2.397.2-fb-moveRowsAPI.0", + "version": "2.397.2-fb-moveRowsAPI.1", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@labkey/api": "1.27.0", diff --git a/packages/components/package.json b/packages/components/package.json index 117ea22d1d..cc397a389e 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@labkey/components", - "version": "2.397.2-fb-moveRowsAPI.0", + "version": "2.397.2-fb-moveRowsAPI.1", "description": "Components, models, actions, and utility functions for LabKey applications and pages", "sideEffects": false, "files": [ From a0df35bdc1ee87d8108bc4e46c2536c7edfc71aa Mon Sep 17 00:00:00 2001 From: cnathe Date: Wed, 13 Dec 2023 15:10:20 -0600 Subject: [PATCH 09/21] Update move controller/action for assay runs --- .../assay/__snapshots__/AssayDesignerPanels.spec.tsx.snap | 8 ++++---- .../src/internal/components/entities/APIWrapper.ts | 1 + .../src/internal/components/entities/EntityMoveModal.tsx | 1 + .../src/internal/components/entities/actions.ts | 3 ++- .../src/internal/components/entities/constants.ts | 4 ++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/components/src/internal/components/domainproperties/assay/__snapshots__/AssayDesignerPanels.spec.tsx.snap b/packages/components/src/internal/components/domainproperties/assay/__snapshots__/AssayDesignerPanels.spec.tsx.snap index 401700aed6..d78140baf7 100644 --- a/packages/components/src/internal/components/domainproperties/assay/__snapshots__/AssayDesignerPanels.spec.tsx.snap +++ b/packages/components/src/internal/components/domainproperties/assay/__snapshots__/AssayDesignerPanels.spec.tsx.snap @@ -727,8 +727,8 @@ exports[`AssayDesignerPanels appPropertiesOnly for new assay 1`] = ` "schemaName": "exp", "viewName": undefined, }, - "moveActionName": "moveAssayRuns", - "moveControllerName": "assay", + "moveActionName": "moveRows", + "moveControllerName": "query", "nounAsParentPlural": "Assay Runs", "nounAsParentSingular": "Assay Run", "nounPlural": "runs", @@ -2564,8 +2564,8 @@ exports[`AssayDesignerPanels appPropertiesOnly with initModel 1`] = ` "schemaName": "exp", "viewName": undefined, }, - "moveActionName": "moveAssayRuns", - "moveControllerName": "assay", + "moveActionName": "moveRows", + "moveControllerName": "query", "nounAsParentPlural": "Assay Runs", "nounAsParentSingular": "Assay Run", "nounPlural": "runs", diff --git a/packages/components/src/internal/components/entities/APIWrapper.ts b/packages/components/src/internal/components/entities/APIWrapper.ts index 98d20fc548..368233c962 100644 --- a/packages/components/src/internal/components/entities/APIWrapper.ts +++ b/packages/components/src/internal/components/entities/APIWrapper.ts @@ -94,6 +94,7 @@ export interface EntityAPIWrapper { sourceContainer: Container, targetContainer: string, entityDataType: EntityDataType, + schemaName: string, queryName: string, rowIds?: number[], selectionKey?: string, diff --git a/packages/components/src/internal/components/entities/EntityMoveModal.tsx b/packages/components/src/internal/components/entities/EntityMoveModal.tsx index 18ca47714e..a6ac8e1168 100644 --- a/packages/components/src/internal/components/entities/EntityMoveModal.tsx +++ b/packages/components/src/internal/components/entities/EntityMoveModal.tsx @@ -121,6 +121,7 @@ export const EntityMoveModal: FC = memo(props => { currentContainer, targetContainerPath, entityDataType, + queryModel.schemaName, queryModel.queryName, rowIds_, selectionKey, diff --git a/packages/components/src/internal/components/entities/actions.ts b/packages/components/src/internal/components/entities/actions.ts index 70686db9af..21905b3b0c 100644 --- a/packages/components/src/internal/components/entities/actions.ts +++ b/packages/components/src/internal/components/entities/actions.ts @@ -819,6 +819,7 @@ export function moveEntities( sourceContainer: Container, targetContainer: string, entityDataType: EntityDataType, + schemaName: string, queryName: string, rowIds?: number[], selectionKey?: string, @@ -828,7 +829,7 @@ export function moveEntities( return new Promise((resolve, reject) => { const params = { auditBehavior: AuditBehaviorTypes.DETAILED, - schemaName: entityDataType.instanceSchemaName, + schemaName, queryName, targetContainer, userComment, diff --git a/packages/components/src/internal/components/entities/constants.ts b/packages/components/src/internal/components/entities/constants.ts index 21a219b467..d2702856c8 100644 --- a/packages/components/src/internal/components/entities/constants.ts +++ b/packages/components/src/internal/components/entities/constants.ts @@ -37,8 +37,8 @@ export const AssayRunDataType: EntityDataType = { uniqueFieldKey: 'RowId', dependencyText: undefined, projectConfigurableDataType: 'AssayDesign', - moveControllerName: 'assay', - moveActionName: 'moveAssayRuns', + moveControllerName: 'query', + moveActionName: 'moveRows', }; export const AssayResultDataType: EntityDataType = { From 36eabeca503bb6d15f1e3484353bc32bc934a6c3 Mon Sep 17 00:00:00 2001 From: cnathe Date: Wed, 13 Dec 2023 15:10:51 -0600 Subject: [PATCH 10/21] 2.397.2-fb-moveRowsAPI.2 --- packages/components/package-lock.json | 4 ++-- packages/components/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/components/package-lock.json b/packages/components/package-lock.json index a5689e1718..306dbdcd50 100644 --- a/packages/components/package-lock.json +++ b/packages/components/package-lock.json @@ -1,12 +1,12 @@ { "name": "@labkey/components", - "version": "2.397.2-fb-moveRowsAPI.1", + "version": "2.397.2-fb-moveRowsAPI.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@labkey/components", - "version": "2.397.2-fb-moveRowsAPI.1", + "version": "2.397.2-fb-moveRowsAPI.2", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@labkey/api": "1.27.0", diff --git a/packages/components/package.json b/packages/components/package.json index cc397a389e..598dda48ae 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@labkey/components", - "version": "2.397.2-fb-moveRowsAPI.1", + "version": "2.397.2-fb-moveRowsAPI.2", "description": "Components, models, actions, and utility functions for LabKey applications and pages", "sideEffects": false, "files": [ From 95647e1fc02dc5e2ab8c53b26dff44a63ba46fc6 Mon Sep 17 00:00:00 2001 From: cnathe Date: Wed, 13 Dec 2023 15:39:35 -0600 Subject: [PATCH 11/21] Remove EntityDataType moveControllerName and moveActionName --- .../assay/__snapshots__/AssayDesignerPanels.spec.tsx.snap | 4 ---- .../__snapshots__/DataClassDesigner.spec.tsx.snap | 2 -- .../samples/__snapshots__/SampleTypeDesigner.spec.tsx.snap | 4 ---- .../components/src/internal/components/entities/actions.ts | 2 +- .../src/internal/components/entities/constants.ts | 6 ------ .../components/src/internal/components/entities/models.ts | 4 +--- 6 files changed, 2 insertions(+), 20 deletions(-) diff --git a/packages/components/src/internal/components/domainproperties/assay/__snapshots__/AssayDesignerPanels.spec.tsx.snap b/packages/components/src/internal/components/domainproperties/assay/__snapshots__/AssayDesignerPanels.spec.tsx.snap index d78140baf7..6e09581ce0 100644 --- a/packages/components/src/internal/components/domainproperties/assay/__snapshots__/AssayDesignerPanels.spec.tsx.snap +++ b/packages/components/src/internal/components/domainproperties/assay/__snapshots__/AssayDesignerPanels.spec.tsx.snap @@ -727,8 +727,6 @@ exports[`AssayDesignerPanels appPropertiesOnly for new assay 1`] = ` "schemaName": "exp", "viewName": undefined, }, - "moveActionName": "moveRows", - "moveControllerName": "query", "nounAsParentPlural": "Assay Runs", "nounAsParentSingular": "Assay Run", "nounPlural": "runs", @@ -2564,8 +2562,6 @@ exports[`AssayDesignerPanels appPropertiesOnly with initModel 1`] = ` "schemaName": "exp", "viewName": undefined, }, - "moveActionName": "moveRows", - "moveControllerName": "query", "nounAsParentPlural": "Assay Runs", "nounAsParentSingular": "Assay Run", "nounPlural": "runs", diff --git a/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap b/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap index 0b729a05cd..0a96308850 100644 --- a/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap +++ b/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap @@ -232,8 +232,6 @@ exports[`DataClassDesigner custom properties 1`] = ` "schemaName": "exp", "viewName": undefined, }, - "moveActionName": "moveRows.api", - "moveControllerName": "query", "nounAsParentPlural": "Data Types", "nounAsParentSingular": "Parent", "nounPlural": "sources", diff --git a/packages/components/src/internal/components/domainproperties/samples/__snapshots__/SampleTypeDesigner.spec.tsx.snap b/packages/components/src/internal/components/domainproperties/samples/__snapshots__/SampleTypeDesigner.spec.tsx.snap index aff5f44c9a..b9a7568f76 100644 --- a/packages/components/src/internal/components/domainproperties/samples/__snapshots__/SampleTypeDesigner.spec.tsx.snap +++ b/packages/components/src/internal/components/domainproperties/samples/__snapshots__/SampleTypeDesigner.spec.tsx.snap @@ -540,8 +540,6 @@ exports[`SampleTypeDesigner default properties 1`] = ` "schemaName": "exp", "viewName": undefined, }, - "moveActionName": "moveRows.api", - "moveControllerName": "query", "nounAsParentPlural": "Parents", "nounAsParentSingular": "Parent", "nounPlural": "samples", @@ -1119,8 +1117,6 @@ exports[`SampleTypeDesigner initModel with name URL props 1`] = ` "schemaName": "exp", "viewName": undefined, }, - "moveActionName": "moveRows.api", - "moveControllerName": "query", "nounAsParentPlural": "Parents", "nounAsParentSingular": "Parent", "nounPlural": "samples", diff --git a/packages/components/src/internal/components/entities/actions.ts b/packages/components/src/internal/components/entities/actions.ts index 21905b3b0c..d282e36b8b 100644 --- a/packages/components/src/internal/components/entities/actions.ts +++ b/packages/components/src/internal/components/entities/actions.ts @@ -846,7 +846,7 @@ export function moveEntities( } return Ajax.request({ - url: buildURL(entityDataType.moveControllerName, entityDataType.moveActionName, undefined, { + url: buildURL('query', 'moveRows.api', undefined, { container: sourceContainer?.path, }), method: 'POST', diff --git a/packages/components/src/internal/components/entities/constants.ts b/packages/components/src/internal/components/entities/constants.ts index d2702856c8..ae1194d647 100644 --- a/packages/components/src/internal/components/entities/constants.ts +++ b/packages/components/src/internal/components/entities/constants.ts @@ -37,8 +37,6 @@ export const AssayRunDataType: EntityDataType = { uniqueFieldKey: 'RowId', dependencyText: undefined, projectConfigurableDataType: 'AssayDesign', - moveControllerName: 'query', - moveActionName: 'moveRows', }; export const AssayResultDataType: EntityDataType = { @@ -114,8 +112,6 @@ export const SampleTypeDataType: EntityDataType = { appUrlPrefixParts: ['samples'], operationConfirmationControllerName: 'experiment', operationConfirmationActionName: SAMPLE_OPERATION_CONFIRMATION_ACTION, - moveActionName: 'moveRows.api', - moveControllerName: 'query', nounSingular: 'sample', nounPlural: 'samples', nounAsParentSingular: 'Parent', @@ -145,8 +141,6 @@ export const DataClassDataType: EntityDataType = { typeListingSchemaQuery: SCHEMAS.EXP_TABLES.DATA_CLASSES, listingSchemaQuery: SCHEMAS.EXP_TABLES.DATA, instanceSchemaName: SCHEMAS.DATA_CLASSES.SCHEMA, - moveActionName: 'moveRows.api', - moveControllerName: 'query', operationConfirmationControllerName: 'experiment', operationConfirmationActionName: DATA_OPERATION_CONFIRMATION_ACTION, nounSingular: 'source', diff --git a/packages/components/src/internal/components/entities/models.ts b/packages/components/src/internal/components/entities/models.ts index 0d10cd456f..2037f79824 100644 --- a/packages/components/src/internal/components/entities/models.ts +++ b/packages/components/src/internal/components/entities/models.ts @@ -469,7 +469,7 @@ export type ProjectConfigurableDataType = 'SampleType' | 'DataClass' | 'AssayDes * instanceSchemaName: string; // (e.g., samples) Name of the schema associated with an individual instance that can be used in conjunction with a name returned from the typeListingSchemaQuery listing * isFromSharedContainer?: boolean; // if the data type is defined in /Shared project * listingSchemaQuery: SchemaQuery; // The schema query used to get the listing of all of the data instances (e.g., all the data class rows) available - * operationConfirmationActionName: string; // action in moveControllerName used to get the confirmation data for performing operations on entities + * operationConfirmationActionName: string; // action in query-moveRows.api used to get the confirmation data for performing operations on entities * typeListingSchemaQuery: SchemaQuery; // The schema query used to get the listing of all of the data type instances (e.g., all the data classes) available * projectConfigurableDataType?: string; // the DataTypeExclusion type */ @@ -499,8 +499,6 @@ export interface EntityDataType { isFromSharedContainer?: boolean; labelColorCol?: string; listingSchemaQuery: SchemaQuery; - moveActionName?: string; - moveControllerName?: string; nounAsParentPlural: string; nounAsParentSingular: string; nounPlural: string; From a63009b090e45a4b2d4137074bda54e68c0adc7b Mon Sep 17 00:00:00 2001 From: cnathe Date: Wed, 13 Dec 2023 15:40:52 -0600 Subject: [PATCH 12/21] 2.397.2-fb-moveRowsAPI.3 --- packages/components/package-lock.json | 4 ++-- packages/components/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/components/package-lock.json b/packages/components/package-lock.json index 306dbdcd50..7395dc3412 100644 --- a/packages/components/package-lock.json +++ b/packages/components/package-lock.json @@ -1,12 +1,12 @@ { "name": "@labkey/components", - "version": "2.397.2-fb-moveRowsAPI.2", + "version": "2.397.2-fb-moveRowsAPI.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@labkey/components", - "version": "2.397.2-fb-moveRowsAPI.2", + "version": "2.397.2-fb-moveRowsAPI.3", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@labkey/api": "1.27.0", diff --git a/packages/components/package.json b/packages/components/package.json index 598dda48ae..27ce24f1d8 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@labkey/components", - "version": "2.397.2-fb-moveRowsAPI.2", + "version": "2.397.2-fb-moveRowsAPI.3", "description": "Components, models, actions, and utility functions for LabKey applications and pages", "sideEffects": false, "files": [ From 39694143c2897aeaf4dccc41ccd9b90cbe70a727 Mon Sep 17 00:00:00 2001 From: cnathe Date: Thu, 14 Dec 2023 14:13:20 -0600 Subject: [PATCH 13/21] Convert DataClassDesigner jest test from enzyme to RTL --- .../dataclasses/DataClassDesigner.spec.tsx | 126 - .../dataclasses/DataClassDesigner.test.tsx | 125 + .../DataClassDesigner.spec.tsx.snap | 1556 -------- .../DataClassDesigner.test.tsx.snap | 3427 +++++++++++++++++ 4 files changed, 3552 insertions(+), 1682 deletions(-) delete mode 100644 packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.spec.tsx create mode 100644 packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.test.tsx delete mode 100644 packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap create mode 100644 packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.test.tsx.snap diff --git a/packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.spec.tsx b/packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.spec.tsx deleted file mode 100644 index 3795914ea4..0000000000 --- a/packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.spec.tsx +++ /dev/null @@ -1,126 +0,0 @@ -import React from 'react'; -import { mount, shallow } from 'enzyme'; - -import { List } from 'immutable'; -import { getTestAPIWrapper } from '../../../APIWrapper'; - -import { PROPERTIES_PANEL_ERROR_MSG } from '../constants'; -import getDomainDetailsJSON from '../../../../test/data/dataclass-getDomainDetails.json'; -import DomainForm from '../DomainForm'; - -import { waitForLifecycle } from '../../../test/enzymeTestHelpers'; - -import { FileAttachmentForm } from '../../../../public/files/FileAttachmentForm'; - -import { Alert } from '../../base/Alert'; - -import { SystemFields } from '../SystemFields'; - -import { DataClassPropertiesPanel } from './DataClassPropertiesPanel'; -import { DataClassModel } from './models'; -import { DataClassDesigner, DataClassDesignerImpl } from './DataClassDesigner'; - -const BASE_PROPS = { - api: getTestAPIWrapper(jest.fn), - onComplete: jest.fn(), - onCancel: jest.fn(), - loadNameExpressionOptions: jest.fn(async () => ({ prefix: '', allowUserSpecifiedNames: true })), - testMode: true, -}; - -describe('DataClassDesigner', () => { - test('default properties', async () => { - const form = ( - - ); - - const tree = shallow(form); - - await waitForLifecycle(tree); - - expect(tree).toMatchSnapshot(); - }); - - test('custom properties', async () => { - const form = ( - - ); - - const tree = shallow(form); - - await waitForLifecycle(tree); - - expect(tree).toMatchSnapshot(); - }); - - test('initModel', async () => { - const form = ( - - ); - const wrapped = shallow(form); - await waitForLifecycle(wrapped); - - expect(wrapped.find(DataClassPropertiesPanel)).toHaveLength(1); - expect(wrapped.find(DomainForm)).toHaveLength(1); - expect(wrapped.find(FileAttachmentForm)).toHaveLength(0); - expect(wrapped).toMatchSnapshot(); - wrapped.unmount(); - }); - - test('open fields panel', async () => { - const wrapped = mount(); - await waitForLifecycle(wrapped); - - const panelHeader = wrapped.find('div#domain-header'); - expect(wrapped.find('#domain-header').at(1).hasClass('domain-panel-header-collapsed')).toBeTruthy(); - panelHeader.simulate('click'); - expect(wrapped.find('#domain-header').at(1).hasClass('domain-panel-header-expanded')).toBeTruthy(); - expect(wrapped.find(FileAttachmentForm)).toHaveLength(1); - expect(wrapped.find(SystemFields)).toHaveLength(1); - - expect(wrapped.find(Alert)).toHaveLength(2); - expect(wrapped.find(Alert).at(0).text()).toEqual(PROPERTIES_PANEL_ERROR_MSG); - expect(wrapped.find(Alert).at(1).text()).toEqual( - 'Please correct errors in the properties panel before saving.' - ); - wrapped.unmount(); - }); -}); diff --git a/packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.test.tsx b/packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.test.tsx new file mode 100644 index 0000000000..c9dcd03557 --- /dev/null +++ b/packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.test.tsx @@ -0,0 +1,125 @@ +import React from 'react'; +import { act, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import { List } from 'immutable'; + +import { getTestAPIWrapper } from '../../../APIWrapper'; +import { renderWithAppContext } from '../../../test/reactTestLibraryHelpers'; + +import { PROPERTIES_PANEL_ERROR_MSG } from '../constants'; +import getDomainDetailsJSON from '../../../../test/data/dataclass-getDomainDetails.json'; + +import { DataClassModel } from './models'; +import { DataClassDesigner, DataClassDesignerImpl } from './DataClassDesigner'; + +const BASE_PROPS = { + api: getTestAPIWrapper(jest.fn), + onComplete: jest.fn(), + onCancel: jest.fn(), + loadNameExpressionOptions: jest.fn(async () => ({ prefix: '', allowUserSpecifiedNames: true })), + testMode: true, +}; + +describe('DataClassDesigner', () => { + test('default properties', async () => { + const component = ( + + ); + await act(async () => { + const { container } = renderWithAppContext(component); + expect(container).toMatchSnapshot(); + }); + + expect(document.querySelectorAll('#dataclass-properties-hdr').length).toBe(1); + expect(document.querySelectorAll('.domain-form-panel').length).toBe(2); + expect(screen.getByText('Import or infer fields from file')).toBeInTheDocument(); + }); + + test('custom properties', async () => { + const component = ( + + ); + await act(async () => { + const { container } = renderWithAppContext(component); + expect(container).toMatchSnapshot(); + }); + + expect(document.querySelectorAll('#dataclass-properties-hdr').length).toBe(1); + expect(document.querySelectorAll('.domain-form-panel').length).toBe(2); + expect(screen.getByText('Import or infer fields from file')).toBeInTheDocument(); + }); + + test('initModel', async () => { + const component = ( + + ); + await act(async () => { + const { container } = renderWithAppContext(component); + expect(container).toMatchSnapshot(); + }); + + expect(document.querySelectorAll('#dataclass-properties-hdr').length).toBe(1); + expect(document.querySelectorAll('.domain-form-panel').length).toBe(2); + expect(screen.queryByText('Import or infer fields from file')).not.toBeInTheDocument(); + }); + + test('open fields panel', async () => { + const component = ; + await act(async () => { + renderWithAppContext(component); + }); + + let panelHeader = document.querySelector('div#domain-header'); + expect(panelHeader?.classList.contains('domain-panel-header-collapsed')).toBeTruthy(); + expect(panelHeader?.classList.contains('domain-panel-header-expanded')).toBeFalsy(); + userEvent.click(panelHeader); + + panelHeader = document.querySelector('div#domain-header'); + expect(panelHeader?.classList.contains('domain-panel-header-collapsed')).toBeFalsy(); + expect(panelHeader?.classList.contains('domain-panel-header-expanded')).toBeTruthy(); + expect(screen.queryByText('Import or infer fields from file')).toBeInTheDocument(); + expect(document.querySelectorAll('.domain-system-fields').length).toBe(1); + + expect(document.querySelectorAll('.alert').length).toBe(2); + expect(screen.queryByText(PROPERTIES_PANEL_ERROR_MSG)).toBeInTheDocument(); + expect(screen.queryByText('Please correct errors in the properties panel before saving.')).toBeInTheDocument(); + }); +}); diff --git a/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap b/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap deleted file mode 100644 index 0a96308850..0000000000 --- a/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap +++ /dev/null @@ -1,1556 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`DataClassDesigner custom properties 1`] = ` - - - - - - -`; - -exports[`DataClassDesigner default properties 1`] = ` - - - - - -`; - -exports[`DataClassDesigner initModel 1`] = ` - - - - - -`; diff --git a/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.test.tsx.snap b/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.test.tsx.snap new file mode 100644 index 0000000000..08f9d633db --- /dev/null +++ b/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.test.tsx.snap @@ -0,0 +1,3427 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`DataClassDesigner custom properties 1`] = ` +
+
+
+
+ + Source Properties + + + + +
+
+
+
+
+
+ header text test +
+
+ +
+
+
+
+ + Name + * + +
+
+ +
+
+
+
+ + Description + + + + + +
+
+ +
+
+
+
+
+ Naming + + Pattern + + + + + +
+
+
+ +
+
+
+
+
+ + Category + + +
+
+
+
+
+ + +
+
+
+ Loading... +
+
+ +
+
+
+ + +
+
+
+
+
+
+
+
+
+ Sample + + Type + + + + + +
+
+
+
+
+ + +
+
+
+ Loading... +
+
+ +
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+ + + + + Fields + + + + + + 3 Fields Defined + +
+
+
+
+
+
+ +
+
+ Default System Fields +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Enabled + + Name + + Label + + Data Type + + Required + + Description +
+ + + Name + + Source ID + + Text + + + + Contains a short name for this data object +
+ + + Description + + Description + + Text + + + + Contains a description for this data object +
+
+
+
+ Custom Fields +
+
+
+
+
+ + + Add + Field + +
+
+
+
+ + + Delete + +
+
+
+
+ + + + Export + +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ 0 + + fields + selected + +
+
+
+
+
+
+ +
+
+
+
+
+ + Name * + +
+
+ + Data Type * + +
+
+ + Required + +
+
+
+ + Details + +
+
+
+
+
+
+
+
+
+
+ + +
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+ Text Options +
+
+
+
+
+
+ Maximum Text + + Length + + + + + +
+
+
+
+
+ +
+ Unlimited +
+
+
+
+
+ + + No longer than + + characters + +
+
+
+
+
+
+
+
+
+ Name and Linking Options +
+
+
+
+
+
+ Description +
+