Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/components/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@labkey/components",
"version": "7.55.0",
"version": "7.55.1",
"description": "Components, models, actions, and utility functions for LabKey applications and pages",
"sideEffects": false,
"files": [
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/internal/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export type DataTypeRowIdsFromTransactionIds = {
dataTypes?: string[];
rowIds: string[];
typeNameRowCounts?: Record<string, number>;
typeNameRows?: Record<string, any[]>;
};

type GetTransactionRowIdsResponse = {
Expand All @@ -73,9 +74,8 @@ export async function getGridIdsFromTransactionId(
const errorLogMsg = `${failureMsg} (transactionAuditId = ${transactionAuditId})`;

const response = await request<GetTransactionRowIdsResponse>({
url: ActionURL.buildURL('audit', 'getTransactionRowIds.api'),
url: ActionURL.buildURL('audit', 'getTransactionRowIds.api', containerPath),
params: {
containerFilter: getContainerFilterForFolder(containerPath),
dataType,
transactionAuditId,
},
Expand Down
28 changes: 25 additions & 3 deletions packages/components/src/internal/components/entities/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,8 @@ export function getSampleTypesFromTransactionIds(
}

export async function getDataClassesFromTransactionIds(
transactionAuditId: number | string
transactionAuditId: number | string,
includeDataRows?: boolean,
): Promise<DataTypeRowIdsFromTransactionIds> {
const results = await getDataTypesFromTransactionId(
transactionAuditId,
Expand All @@ -1572,7 +1573,7 @@ export async function getDataClassesFromTransactionIds(

if (!results.rowIds.length) return { ...results, typeNameRowCounts: {} };

const { dataTypeRowCounts, dataTypes } = results;
const { dataTypeRowCounts, dataTypes, rowIds } = results;
const dataTypeLcMap = Object.fromEntries((dataTypes ?? []).map(dt => [dt.toLowerCase(), dt]));

const typeNameRowCounts: Record<string, number> = {};
Expand All @@ -1591,5 +1592,26 @@ export async function getDataClassesFromTransactionIds(
});
}

return { ...results, typeNameRowCounts };
if (!includeDataRows)
return { ...results, typeNameRowCounts };

const typeNameRows: Record<string, any[]> = {};
const dataRows = await selectRows({
schemaQuery: SCHEMAS.EXP_TABLES.DATA.detailView,
columns: ['DataClass/Name', 'RowId'],
filterArray: [Filter.create('rowId', rowIds, Filter.Types.IN)],
containerFilter: Query.containerFilter.currentPlusProjectAndShared,
});

dataRows.rows.forEach(row => {
const dataClass = caseInsensitive(row, 'DataClass/Name')?.value;
if (dataClass) {
const rowId = caseInsensitive(row, 'RowId').value;
if (!typeNameRows[dataClass])
typeNameRows[dataClass] = [];
typeNameRows[dataClass].push({ rowId });
}
});

return { ...results, typeNameRowCounts, typeNameRows };
}
1 change: 1 addition & 0 deletions packages/components/src/internal/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export const SAMPLE_SETS = {
const SAMPLE_MANAGEMENT_SCHEMA = 'samplemanagement';
export const SAMPLE_MANAGEMENT = {
SCHEMA: SAMPLE_MANAGEMENT_SCHEMA,
ALL_SOURCES: new SchemaQuery(SAMPLE_MANAGEMENT_SCHEMA, 'AllSources'),
SAMPLE_TYPE_INSIGHTS: new SchemaQuery(SAMPLE_MANAGEMENT_SCHEMA, 'SampleTypeInsights'),
SAMPLE_STATUS_COUNTS: new SchemaQuery(SAMPLE_MANAGEMENT_SCHEMA, 'SampleStatusCounts'),
SOURCE_SAMPLES: new SchemaQuery(SAMPLE_MANAGEMENT_SCHEMA, 'SourceSamples'),
Expand Down