Skip to content

Commit b7ff10c

Browse files
committed
Remove getSelectedSampleIdsFromSelectionKey, getURLParamsForSampleSelectionKey
1 parent 5e29c4c commit b7ff10c

5 files changed

Lines changed: 2 additions & 142 deletions

File tree

packages/components/releaseNotes/components.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Components, models, actions, and utility functions for LabKey applications and p
77
- moved to ui-premium
88
- Add createSnapshotSelectionKeyStr
99
- Remove getJobCreationHref
10+
- Remove getSelectedSampleIdsFromSelectionKey
11+
- Remove getURLParamsForSampleSelectionKey
1012

1113
### version 6.52.4
1214
*Released*: 30 June 2025

packages/components/src/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ import {
389389
getLookupRowIdsFromSelection,
390390
getSampleSet,
391391
getSampleTypeDetails,
392-
getSelectedSampleIdsFromSelectionKey,
393392
getSelectionLineageData,
394393
updateSampleStorageData,
395394
} from './internal/components/samples/actions';
@@ -412,7 +411,6 @@ import {
412411
getSampleStatusColor,
413412
getSampleStatusContainerFilter,
414413
getSampleStatusType,
415-
getURLParamsForSampleSelectionKey,
416414
isAllSamplesSchema,
417415
isSampleOperationPermitted,
418416
isSamplesSchema,
@@ -1442,14 +1440,12 @@ export {
14421440
getSelectedDataDeprecated,
14431441
getSelectedPicklistSamples,
14441442
getSelectedRows,
1445-
getSelectedSampleIdsFromSelectionKey,
14461443
getSelectionLineageData,
14471444
getSourceDomainDefaultSystemFields,
14481445
getStoredAmountDisplay,
14491446
getTestAPIWrapper,
14501447
getTimelineEntityUrl,
14511448
getUniqueIdColumnMetadata,
1452-
getURLParamsForSampleSelectionKey,
14531449
getUserProperties,
14541450
getUserRoleDisplay,
14551451
getUsersWithPermissions,

packages/components/src/internal/components/samples/actions.ts

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -144,55 +144,6 @@ export async function fetchSamples(
144144
return data.asImmutable();
145145
}
146146

147-
/**
148-
* Get an array of sample RowIds from a URL selectionKey for the following scenarios:
149-
* - sample grid
150-
* - picklist
151-
* - assay
152-
* - storage items
153-
*/
154-
export async function getSelectedSampleIdsFromSelectionKey(searchParams: URLSearchParams): Promise<number[]> {
155-
const key = searchParams.get('selectionKey');
156-
let sampleIds;
157-
const selectionType = searchParams.get('selectionKeyType');
158-
const isSnapshot = selectionType === SELECTION_KEY_TYPE.snapshot;
159-
160-
if (selectionType === SELECTION_KEY_TYPE.inventoryItems) {
161-
const response = await getSnapshotSelections(key);
162-
sampleIds = await getSelectedItemSamples(response.selected);
163-
} else if (searchParams.get('isAssay')) {
164-
const schemaName = searchParams.get('assayProtocol');
165-
const sampleFieldKey = searchParams.get('sampleFieldKey');
166-
const queryName = SCHEMAS.ASSAY_TABLES.RESULTS_QUERYNAME;
167-
let response;
168-
169-
if (isSnapshot) {
170-
response = await getSnapshotSelections(key);
171-
} else {
172-
response = await getSelection(searchParams, schemaName, queryName);
173-
}
174-
175-
sampleIds = await getLookupRowIdsFromSelection(schemaName, queryName, response?.selected, sampleFieldKey);
176-
} else {
177-
const picklistName = searchParams.get('picklistName');
178-
let response;
179-
180-
if (isSnapshot && key) {
181-
response = await getSnapshotSelections(key);
182-
} else {
183-
response = await getSelection(searchParams, SCHEMAS.PICKLIST_TABLES.SCHEMA, picklistName);
184-
}
185-
186-
if (picklistName) {
187-
sampleIds = await getSelectedPicklistSamples(picklistName, response.selected, false, undefined);
188-
} else {
189-
sampleIds = response.selected.map(Number);
190-
}
191-
}
192-
193-
return sampleIds;
194-
}
195-
196147
export async function getGroupedSampleDomainFields(sampleType: string): Promise<GroupedSampleFields> {
197148
// use domain fields as we only want to include fields defined by the user, but use queryInfo to map to fieldKey
198149
const sampleTypeDomain = await getSampleTypeDetails(new SchemaQuery(SCHEMAS.SAMPLE_SETS.SCHEMA, sampleType));

packages/components/src/internal/components/samples/utils.test.ts

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ import { SCHEMAS } from '../../schemas';
1010
import { OperationConfirmationData } from '../entities/models';
1111
import { SchemaQuery } from '../../../public/SchemaQuery';
1212

13-
import { makeTestQueryModel } from '../../../public/QueryModel/testUtils';
14-
15-
import { QueryInfo } from '../../../public/QueryInfo';
16-
1713
import {
1814
DEFAULT_AVAILABLE_STATUS_COLOR,
1915
DEFAULT_CONSUMED_STATUS_COLOR,
@@ -30,7 +26,6 @@ import {
3026
getSampleStatusColor,
3127
getSampleStatusLockedMessage,
3228
getSampleStatusType,
33-
getURLParamsForSampleSelectionKey,
3429
isSampleOperationPermitted,
3530
isSamplesSchema,
3631
} from './utils';
@@ -347,40 +342,6 @@ describe('getSampleStatus', () => {
347342
});
348343
});
349344

350-
const TEST_SQ = new SchemaQuery('schema', 'query');
351-
const TEST_QUERY_INFO = new QueryInfo({ schemaQuery: TEST_SQ, pkCols: ['RowId'] });
352-
const TEST_MODEL = makeTestQueryModel(TEST_SQ, TEST_QUERY_INFO).mutate({ id: 'model-id' });
353-
354-
describe('getURLParamsForSampleSelectionKey', () => {
355-
test('default props', () => {
356-
expect(getURLParamsForSampleSelectionKey(TEST_MODEL)).toStrictEqual({ selectionKey: 'model-id' });
357-
});
358-
359-
test('picklist', () => {
360-
expect(getURLParamsForSampleSelectionKey(TEST_MODEL, 'picklist1')).toStrictEqual({
361-
selectionKey: 'model-id',
362-
picklistName: 'picklist1',
363-
});
364-
});
365-
366-
test('assay', () => {
367-
expect(getURLParamsForSampleSelectionKey(TEST_MODEL, undefined, true, 'Name')).toStrictEqual({
368-
selectionKey: 'model-id',
369-
assayProtocol: 'schema',
370-
isAssay: true,
371-
sampleFieldKey: 'Name',
372-
});
373-
});
374-
375-
test('keyValue', () => {
376-
const model = TEST_MODEL.mutate({ keyValue: 123 });
377-
expect(getURLParamsForSampleSelectionKey(model)).toStrictEqual({
378-
'query.RowId~eq': 123,
379-
selectionKey: 'appkey|schema/query|123',
380-
});
381-
});
382-
});
383-
384345
describe('getSampleStatusLockedMessage', () => {
385346
test('no state', () => {
386347
expect(getSampleStatusLockedMessage(undefined, false)).toBeUndefined();

packages/components/src/internal/components/samples/utils.tsx

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@ import { caseInsensitive } from '../../util/utils';
1313
import { ModuleContext } from '../base/ServerContext';
1414

1515
import { SchemaQuery } from '../../../public/SchemaQuery';
16-
import { QueryModel } from '../../../public/QueryModel/QueryModel';
17-
import { PICKLIST_SAMPLES_FILTER } from '../picklist/models';
1816
import { SystemField } from '../domainproperties/models';
1917

20-
import { BOX_SAMPLES_FILTER, LOCATION_SAMPLES_FILTER } from '../../query/filter';
21-
2218
import {
2319
DEFAULT_AVAILABLE_STATUS_COLOR,
2420
DEFAULT_CONSUMED_STATUS_COLOR,
@@ -270,52 +266,6 @@ export function isAllSamplesSchema(schemaQuery: SchemaQuery): boolean {
270266
return false;
271267
}
272268

273-
export function getURLParamsForSampleSelectionKey(
274-
model: QueryModel,
275-
picklistName?: string,
276-
isAssay?: boolean,
277-
sampleFieldKey?: string,
278-
ignoreFilter?: boolean
279-
): Record<string, any> {
280-
const { keyValue, queryInfo, selectionKey } = model;
281-
let params = {};
282-
283-
if (queryInfo) {
284-
const singleSelect = keyValue !== undefined;
285-
const { schemaQuery } = queryInfo;
286-
params['selectionKey'] = singleSelect
287-
? SchemaQuery.createAppSelectionKey(schemaQuery, [keyValue])
288-
: selectionKey;
289-
290-
if (!ignoreFilter) {
291-
model.filters.forEach(filter => {
292-
const filterURLSuffix = filter.getFilterType().getURLSuffix();
293-
// We don't need the picklist IN clause here since we're dealing with the samples selected in the grid
294-
const isPicklistFilterType = filterURLSuffix === PICKLIST_SAMPLES_FILTER.getURLSuffix();
295-
// and we don't need the LSID LineageOf clause either
296-
const isLineageOfFilterType = filterURLSuffix === Filter.Types.EXP_LINEAGE_OF.getURLSuffix();
297-
const isSampleInLocationFilterType =
298-
filterURLSuffix === LOCATION_SAMPLES_FILTER.getURLSuffix() ||
299-
filterURLSuffix === BOX_SAMPLES_FILTER.getURLSuffix();
300-
301-
if (!isPicklistFilterType && !isLineageOfFilterType && !isSampleInLocationFilterType) {
302-
params[filter.getURLParameterName()] = filter.getURLParameterValue();
303-
}
304-
});
305-
}
306-
307-
if (picklistName) {
308-
params['picklistName'] = picklistName;
309-
}
310-
311-
if (isAssay && sampleFieldKey) {
312-
params = { ...params, ...{ assayProtocol: schemaQuery.schemaName, isAssay: true, sampleFieldKey } };
313-
}
314-
}
315-
316-
return params;
317-
}
318-
319269
export function getSampleDomainDefaultSystemFields(moduleContext?: ModuleContext): SystemField[] {
320270
return isFreezerManagementEnabled(moduleContext)
321271
? SAMPLE_DOMAIN_DEFAULT_SYSTEM_FIELDS.concat(SAMPLE_DOMAIN_INVENTORY_SYSTEM_FIELDS)

0 commit comments

Comments
 (0)