diff --git a/packages/components/package-lock.json b/packages/components/package-lock.json
index 38b86638ce..d8cb7dee95 100644
--- a/packages/components/package-lock.json
+++ b/packages/components/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@labkey/components",
- "version": "2.398.0",
+ "version": "2.399.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@labkey/components",
- "version": "2.398.0",
+ "version": "2.399.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 7179663212..e9d3de104f 100644
--- a/packages/components/package.json
+++ b/packages/components/package.json
@@ -1,6 +1,6 @@
{
"name": "@labkey/components",
- "version": "2.398.0",
+ "version": "2.399.0",
"description": "Components, models, actions, and utility functions for LabKey applications and pages",
"sideEffects": false,
"files": [
diff --git a/packages/components/releaseNotes/components.md b/packages/components/releaseNotes/components.md
index bb703ffb41..7b2229795d 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 2.399.0
+*Released*: 15 December 2023
+- 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.398.0
*Released*: 14 December 2023
- In-app messaging for product updates
diff --git a/packages/components/src/internal/components/base/Grid.test.tsx b/packages/components/src/internal/components/base/Grid.test.tsx
index 84f68307fd..8c3527afb2 100644
--- a/packages/components/src/internal/components/base/Grid.test.tsx
+++ b/packages/components/src/internal/components/base/Grid.test.tsx
@@ -280,6 +280,10 @@ describe('Grid', () => {
});
describe('GridHeader', () => {
+ beforeAll(() => {
+ global.console.error = jest.fn();
+ });
+
const DEFAULT_PROPS = {
showHeader: true,
columns: List.of(
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..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": "moveAssayRuns",
- "moveControllerName": "assay",
"nounAsParentPlural": "Assay Runs",
"nounAsParentSingular": "Assay Run",
"nounPlural": "runs",
@@ -2564,8 +2562,6 @@ exports[`AssayDesignerPanels appPropertiesOnly with initModel 1`] = `
"schemaName": "exp",
"viewName": undefined,
},
- "moveActionName": "moveAssayRuns",
- "moveControllerName": "assay",
"nounAsParentPlural": "Assay Runs",
"nounAsParentSingular": "Assay Run",
"nounPlural": "runs",
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..90fdb2ff12
--- /dev/null
+++ b/packages/components/src/internal/components/domainproperties/dataclasses/DataClassDesigner.test.tsx
@@ -0,0 +1,129 @@
+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', () => {
+ beforeAll(() => {
+ global.console.error = jest.fn();
+ });
+
+ 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 45d8f689ab..0000000000
--- a/packages/components/src/internal/components/domainproperties/dataclasses/__snapshots__/DataClassDesigner.spec.tsx.snap
+++ /dev/null
@@ -1,1558 +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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Fields
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default System Fields
+
+
+
+
+
+ Custom Fields
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Supported formats include:
+
+ .csv, .tsv, .txt, .xls, .xlsx, .json
+
+
+
+
+
+
+
+
+
+
+
+`;
+
+exports[`DataClassDesigner default properties 1`] = `
+
+
+
+
+
+ Data Class Properties
+
+
+
+
+
+
+
+
+
+
+
+
+ Sample
+
+ Type
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Fields
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default System Fields
+
+
+
+
+
+ Custom Fields
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Supported formats include:
+
+ .csv, .tsv, .txt, .xls, .xlsx, .json
+
+
+
+
+
+
+
+
+
+
+
+`;
+
+exports[`DataClassDesigner initModel 1`] = `
+
+
+
+
+
+
+
+
+ Data Class Properties
+
+
+
+
+
+
+
+
+
+
+
+
+ Sample
+
+ Type
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Fields
+
+
+
+
+
+ 3 Fields Defined
+
+
+
+
+
+
+
+
+
+
+ Default System Fields
+
+
+
+
+
+ Custom Fields
+
+
+
+
+
+
+ 0
+
+ fields
+ selected
+
+
+
+
+
+
+
+
+
+
+ Name *
+
+
+
+
+ Data Type *
+
+
+
+
+ Required
+
+
+
+
+
+ Details
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Add
+ Field
+
+
+
+
+
+
+
+
+
+
+
+`;
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..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": "moveSamples.api",
- "moveControllerName": "experiment",
"nounAsParentPlural": "Parents",
"nounAsParentSingular": "Parent",
"nounPlural": "samples",
@@ -1119,8 +1117,6 @@ exports[`SampleTypeDesigner initModel with name URL props 1`] = `
"schemaName": "exp",
"viewName": undefined,
},
- "moveActionName": "moveSamples.api",
- "moveControllerName": "experiment",
"nounAsParentPlural": "Parents",
"nounAsParentSingular": "Parent",
"nounPlural": "samples",
diff --git a/packages/components/src/internal/components/editable/actions.test.ts b/packages/components/src/internal/components/editable/actions.test.ts
index af58e03c1c..10b06db7db 100644
--- a/packages/components/src/internal/components/editable/actions.test.ts
+++ b/packages/components/src/internal/components/editable/actions.test.ts
@@ -480,6 +480,10 @@ describe('fillColumnCells', () => {
lookup: undefined,
});
+ beforeAll(() => {
+ global.console.warn = jest.fn();
+ });
+
test('single initialSelection', async () => {
const { cellValues } = await fillColumnCells(
editorModel,
diff --git a/packages/components/src/internal/components/entities/APIWrapper.ts b/packages/components/src/internal/components/entities/APIWrapper.ts
index 45b3ef11f3..368233c962 100644
--- a/packages/components/src/internal/components/entities/APIWrapper.ts
+++ b/packages/components/src/internal/components/entities/APIWrapper.ts
@@ -94,6 +94,8 @@ export interface EntityAPIWrapper {
sourceContainer: Container,
targetContainer: string,
entityDataType: EntityDataType,
+ schemaName: string,
+ 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..a6ac8e1168 100644
--- a/packages/components/src/internal/components/entities/EntityMoveModal.tsx
+++ b/packages/components/src/internal/components/entities/EntityMoveModal.tsx
@@ -121,6 +121,8 @@ export const EntityMoveModal: FC = memo(props => {
currentContainer,
targetContainerPath,
entityDataType,
+ queryModel.schemaName,
+ queryModel.queryName,
rowIds_,
selectionKey,
useSnapshotSelection,
@@ -165,6 +167,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..1759446d5e 100644
--- a/packages/components/src/internal/components/entities/actions.ts
+++ b/packages/components/src/internal/components/entities/actions.ts
@@ -123,7 +123,9 @@ export function getDeleteConfirmationData(
? {
dataOperation: DataOperation.Delete,
}
- : isAssayDesignEntity(dataType) ? { dataOperation: AssayRunOperation.Delete } : undefined
+ : isAssayDesignEntity(dataType)
+ ? { dataOperation: AssayRunOperation.Delete }
+ : undefined
);
}
@@ -297,9 +299,8 @@ function resolveEntityParentTypeFromIds(
// The transformation done here makes the entities compatible with the editable grid
let data: DisplayObject[] = response.rows
.map(row => extractEntityTypeOptionFromRow(row))
- .map(({ label, rowId }) => ({ displayValue: label, value: rowId }))
- if (orderedRowIds?.length > 1)
- data = data.sort(_getEntitySort(orderedRowIds));
+ .map(({ label, rowId }) => ({ displayValue: label, value: rowId }));
+ if (orderedRowIds?.length > 1) data = data.sort(_getEntitySort(orderedRowIds));
return List([
EntityParentType.create({
@@ -811,7 +812,9 @@ export function getMoveConfirmationData(
? {
dataOperation: DataOperation.Move,
}
- : isAssayDesignEntity(dataType) ? { dataOperation: AssayRunOperation.Move } : undefined
+ : isAssayDesignEntity(dataType)
+ ? { dataOperation: AssayRunOperation.Move }
+ : undefined
);
}
@@ -819,6 +822,8 @@ export function moveEntities(
sourceContainer: Container,
targetContainer: string,
entityDataType: EntityDataType,
+ schemaName: string,
+ queryName: string,
rowIds?: number[],
selectionKey?: string,
useSnapshotSelection?: boolean,
@@ -827,11 +832,16 @@ export function moveEntities(
return new Promise((resolve, reject) => {
const params = {
auditBehavior: AuditBehaviorTypes.DETAILED,
- targetContainer,
- userComment,
+ auditUserComment: userComment,
+ targetContainerPath: targetContainer,
+ schemaName,
+ queryName,
};
if (rowIds) {
- params['rowIds'] = rowIds;
+ params['rows'] = rowIds.reduce((prev, curr) => {
+ prev.push({ rowId: curr });
+ return prev;
+ }, []);
}
if (selectionKey) {
params['dataRegionSelectionKey'] = selectionKey;
@@ -839,11 +849,11 @@ export function moveEntities(
}
return Ajax.request({
- url: buildURL(entityDataType.moveControllerName, entityDataType.moveActionName, undefined, {
+ url: buildURL('query', 'moveRows.api', undefined, {
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..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: 'assay',
- moveActionName: 'moveAssayRuns',
};
export const AssayResultDataType: EntityDataType = {
@@ -114,8 +112,6 @@ export const SampleTypeDataType: EntityDataType = {
appUrlPrefixParts: ['samples'],
operationConfirmationControllerName: 'experiment',
operationConfirmationActionName: SAMPLE_OPERATION_CONFIRMATION_ACTION,
- moveActionName: 'moveSamples.api',
- moveControllerName: 'experiment',
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: 'moveSources.api',
- moveControllerName: 'experiment',
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..6f5969563c 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 operationConfirmationControllerName 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;
diff --git a/packages/components/src/internal/components/samples/utils.test.ts b/packages/components/src/internal/components/samples/utils.test.ts
index 809183f00a..a59b5e3db9 100644
--- a/packages/components/src/internal/components/samples/utils.test.ts
+++ b/packages/components/src/internal/components/samples/utils.test.ts
@@ -319,7 +319,7 @@ describe('getSampleStatus', () => {
});
const TEST_SQ = new SchemaQuery('schema', 'query');
-const TEST_QUERY_INFO = new QueryInfo({ schemaQuery: TEST_SQ });
+const TEST_QUERY_INFO = new QueryInfo({ schemaQuery: TEST_SQ, pkCols: ['RowId'] });
const TEST_MODEL = makeTestQueryModel(TEST_SQ, TEST_QUERY_INFO).mutate({ id: 'model-id' });
describe('getURLParamsForSampleSelectionKey', () => {
@@ -346,92 +346,130 @@ describe('getURLParamsForSampleSelectionKey', () => {
test('keyValue', () => {
const model = TEST_MODEL.mutate({ keyValue: 123 });
expect(getURLParamsForSampleSelectionKey(model)).toStrictEqual({
+ 'query.RowId~eq': 123,
selectionKey: 'appkey|schema/query|123',
});
});
});
-describe("getSampleStatusLockedMessage", () => {
- test("no state", () => {
+describe('getSampleStatusLockedMessage', () => {
+ test('no state', () => {
expect(getSampleStatusLockedMessage(undefined, false)).toBeUndefined();
});
- test("not locked", () => {
- expect(getSampleStatusLockedMessage(new SampleState({
- rowId: 1,
- label: 'Available',
- stateType: SampleStateType.Available,
- inUse: false,
- containerPath: "/Test Project",
- isLocal: true
- }), false)).toBeUndefined();
- });
-
- test("saving but not in use", () => {
- expect(getSampleStatusLockedMessage(new SampleState({
- rowId: 1,
- label: 'Available',
- stateType: SampleStateType.Available,
- inUse: false,
- containerPath: "/Test Project",
- isLocal: true
- }), true)).toBe("This sample status cannot change status type or be deleted because it is in use.");
- });
-
- test("in use", () => {
- expect(getSampleStatusLockedMessage(new SampleState({
- rowId: 1,
- label: 'Available',
- stateType: SampleStateType.Available,
- inUse: true,
- containerPath: "/Test Project",
- isLocal: true
- }), false)).toBe("This sample status cannot change status type or be deleted because it is in use.");
-
- });
-
- test("in use and saving", () => {
- expect(getSampleStatusLockedMessage(new SampleState({
- rowId: 1,
- label: 'Available',
- stateType: SampleStateType.Available,
- inUse: true,
- containerPath: "/Test Project",
- isLocal: true
- }), true)).toBe("This sample status cannot change status type or be deleted because it is in use.");
- });
-
- test("not in use, not local", () => {
- expect(getSampleStatusLockedMessage(new SampleState({
- rowId: 1,
- label: 'Available',
- stateType: SampleStateType.Available,
- inUse: false,
- containerPath: "/Test Project",
- isLocal: false
- }), false)).toBe("This sample status can be changed only in the Test Project project.");
-
- });
-
- test("in use and not local", () => {
- expect(getSampleStatusLockedMessage(new SampleState({
- rowId: 1,
- label: 'Available',
- stateType: SampleStateType.Available,
- inUse: true,
- containerPath: "/Test Project",
- isLocal: false
- }), false)).toBe("This sample status cannot change status type or be deleted because it is in use and can be changed only in the Test Project project.");
- });
-
- test("in use, saving, and not local", () => {
- expect(getSampleStatusLockedMessage(new SampleState({
- rowId: 1,
- label: 'Available',
- stateType: SampleStateType.Available,
- inUse: true,
- containerPath: "/Test Project",
- isLocal: false
- }), true)).toBe("This sample status cannot change status type or be deleted because it is in use and can be changed only in the Test Project project.");
+ test('not locked', () => {
+ expect(
+ getSampleStatusLockedMessage(
+ new SampleState({
+ rowId: 1,
+ label: 'Available',
+ stateType: SampleStateType.Available,
+ inUse: false,
+ containerPath: '/Test Project',
+ isLocal: true,
+ }),
+ false
+ )
+ ).toBeUndefined();
+ });
+
+ test('saving but not in use', () => {
+ expect(
+ getSampleStatusLockedMessage(
+ new SampleState({
+ rowId: 1,
+ label: 'Available',
+ stateType: SampleStateType.Available,
+ inUse: false,
+ containerPath: '/Test Project',
+ isLocal: true,
+ }),
+ true
+ )
+ ).toBe('This sample status cannot change status type or be deleted because it is in use.');
+ });
+
+ test('in use', () => {
+ expect(
+ getSampleStatusLockedMessage(
+ new SampleState({
+ rowId: 1,
+ label: 'Available',
+ stateType: SampleStateType.Available,
+ inUse: true,
+ containerPath: '/Test Project',
+ isLocal: true,
+ }),
+ false
+ )
+ ).toBe('This sample status cannot change status type or be deleted because it is in use.');
+ });
+
+ test('in use and saving', () => {
+ expect(
+ getSampleStatusLockedMessage(
+ new SampleState({
+ rowId: 1,
+ label: 'Available',
+ stateType: SampleStateType.Available,
+ inUse: true,
+ containerPath: '/Test Project',
+ isLocal: true,
+ }),
+ true
+ )
+ ).toBe('This sample status cannot change status type or be deleted because it is in use.');
+ });
+
+ test('not in use, not local', () => {
+ expect(
+ getSampleStatusLockedMessage(
+ new SampleState({
+ rowId: 1,
+ label: 'Available',
+ stateType: SampleStateType.Available,
+ inUse: false,
+ containerPath: '/Test Project',
+ isLocal: false,
+ }),
+ false
+ )
+ ).toBe('This sample status can be changed only in the Test Project project.');
+ });
+
+ test('in use and not local', () => {
+ expect(
+ getSampleStatusLockedMessage(
+ new SampleState({
+ rowId: 1,
+ label: 'Available',
+ stateType: SampleStateType.Available,
+ inUse: true,
+ containerPath: '/Test Project',
+ isLocal: false,
+ }),
+ false
+ )
+ ).toBe(
+ 'This sample status cannot change status type or be deleted because it is in use and can be changed only in the Test Project project.'
+ );
+ });
+
+ test('in use, saving, and not local', () => {
+ expect(
+ getSampleStatusLockedMessage(
+ new SampleState({
+ rowId: 1,
+ label: 'Available',
+ stateType: SampleStateType.Available,
+ inUse: true,
+ containerPath: '/Test Project',
+ isLocal: false,
+ }),
+ true
+ )
+ ).toBe(
+ 'This sample status cannot change status type or be deleted because it is in use and can be changed only in the Test Project project.'
+ );
});
});
diff --git a/packages/components/src/internal/util/Date.test.ts b/packages/components/src/internal/util/Date.test.ts
index 79bc68fd60..a706582dab 100644
--- a/packages/components/src/internal/util/Date.test.ts
+++ b/packages/components/src/internal/util/Date.test.ts
@@ -221,6 +221,7 @@ describe('Date Utilities', () => {
});
test('invalid date', () => {
+ global.console.warn = jest.fn();
expect(parseDate('test')).toBe(null);
expect(parseDate('test', 'yyyy-MM-dd')).toBe(null);
});