Skip to content

Commit 3fd5820

Browse files
committed
Issue 53036: LKSM: Aliquot registration event in timeline polish
1 parent 559557c commit 3fd5820

9 files changed

Lines changed: 62 additions & 41 deletions

File tree

packages/components/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@labkey/components",
3-
"version": "6.62.3",
3+
"version": "6.62.4-fb-issue53036.1",
44
"description": "Components, models, actions, and utility functions for LabKey applications and pages",
55
"sideEffects": false,
66
"files": [

packages/components/src/internal/components/auditlog/AuditDetails.test.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ describe('AuditDetails', () => {
166166
<AuditDetails
167167
changeDetails={AuditDetailsModel.create({
168168
newData: { a: AUDIT_DETAIL_FIELD_VALUE_INHERITED },
169-
oldData: {}
169+
oldData: {},
170170
})}
171171
inheritedFieldMsg="This value is inherited from a parent folder."
172172
rowId={1}
@@ -183,7 +183,7 @@ describe('AuditDetails', () => {
183183
<AuditDetails
184184
changeDetails={AuditDetailsModel.create({
185185
newData: { a: AUDIT_DETAIL_FIELD_VALUE_INHERITED },
186-
oldData: {}
186+
oldData: {},
187187
})}
188188
rowId={1}
189189
user={TEST_USER_APP_ADMIN}
@@ -227,5 +227,4 @@ describe('AuditDetails', () => {
227227
expect(document.querySelector('.panel-body').textContent).toBe('aInherited1');
228228
expect(document.querySelectorAll('.fa-info-circle')).toHaveLength(0);
229229
});
230-
231230
});

packages/components/src/internal/components/auditlog/AuditDetails.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ interface Props extends PropsWithChildren {
2323
fieldValueRenderer?: (label, value, displayValue, hasProvidedValue?: boolean) => any;
2424
gridColumnRenderer?: (data: any, row: any, displayValue: any) => any;
2525
gridData?: List<Map<string, any>>;
26+
inheritedFieldMsg?: string;
2627
rowId?: number;
2728
summary?: string;
2829
title?: string;
2930
user: User;
30-
inheritedFieldMsg?: string;
3131
}
3232

3333
export class AuditDetails extends Component<Props> {
@@ -43,8 +43,7 @@ export class AuditDetails extends Component<Props> {
4343
getValueDisplay = (field: string, value: string, hasProvidedValues: boolean, isInherited?: boolean): any => {
4444
const { fieldValueRenderer } = this.props;
4545

46-
if (isInherited)
47-
return <span className="timeline-inherited-data display-light">Inherited</span>;
46+
if (isInherited) return <span className="timeline-inherited-data display-light">Inherited</span>;
4847

4948
let displayVal: any = value;
5049
if (value == null || value === '') displayVal = 'NA';
@@ -71,7 +70,12 @@ export class AuditDetails extends Component<Props> {
7170

7271
if (!user.isSignedIn && AuditDetails.isUserFieldLabel(field)) return null;
7372

74-
const oldValue = this.getValueDisplay(field, oldVal, !!(providedVal || providedDeltaVal), oldVal === AUDIT_DETAIL_FIELD_VALUE_INHERITED);
73+
const oldValue = this.getValueDisplay(
74+
field,
75+
oldVal,
76+
!!(providedVal || providedDeltaVal),
77+
oldVal === AUDIT_DETAIL_FIELD_VALUE_INHERITED
78+
);
7579

7680
const isInherited = newVal === AUDIT_DETAIL_FIELD_VALUE_INHERITED;
7781

@@ -97,7 +101,7 @@ export class AuditDetails extends Component<Props> {
97101
<div className="ws-pre-wrap">{providedVals}</div>
98102
</LabelHelpTip>
99103
)}
100-
{(isInherited && !!inheritedFieldMsg )&& (
104+
{isInherited && !!inheritedFieldMsg && (
101105
<LabelHelpTip
102106
iconComponent={<i className="fa fa-info-circle left-padding" />}
103107
placement="top"

packages/components/src/internal/components/auditlog/models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class TimelineEventModel extends Record({
9393
declare providedDeltaValues?: Map<string, string>;
9494
declare userComment?: string;
9595

96-
constructor(values?: { [key: string]: any }) {
96+
constructor(values?: Record<string, any>) {
9797
super(values);
9898
}
9999

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import {
1616
import { getAuditDetailMap, getAuditQueries, getEventDataValueDisplay, getTimelineEntityUrl } from './utils';
1717
import {
1818
ASSAY_AUDIT_QUERY,
19-
ASSAY_RESULT_AUDIT_QUERY, AUDIT_DETAIL_FIELD_VALUE_INHERITED,
19+
ASSAY_RESULT_AUDIT_QUERY,
20+
AUDIT_DETAIL_FIELD_VALUE_INHERITED,
2021
DATACLASS_DATA_UPDATE_AUDIT_QUERY,
2122
INVENTORY_AUDIT_QUERY,
2223
NOTEBOOK_AUDIT_QUERY,
@@ -68,7 +69,12 @@ describe('getAuditQueries', () => {
6869
inventory: {},
6970
biologics: {},
7071
core: {
71-
productFeatures: [ProductFeature.Workflow, ProductFeature.ELN, ProductFeature.Assay, ProductFeature.BiologicsRegistry],
72+
productFeatures: [
73+
ProductFeature.Workflow,
74+
ProductFeature.ELN,
75+
ProductFeature.Assay,
76+
ProductFeature.BiologicsRegistry,
77+
],
7278
},
7379
};
7480
const auditQueries = getAuditQueries(moduleContext);
@@ -158,7 +164,9 @@ describe('utils', () => {
158164
expect(getTimelineEntityUrl({ urlType: 'inventoryLocation', value: ['freezer1', 101] }).toHref()).toEqual(
159165
'#/rd/freezerLocation/101'
160166
);
161-
expect(getTimelineEntityUrl({ urlType: 'inventoryBox', value: 101 }).toHref()).toEqual('/labkey/DefaultTestContainer/freezermanager-app.view#/boxes/101');
167+
expect(getTimelineEntityUrl({ urlType: 'inventoryBox', value: 101 }).toHref()).toEqual(
168+
'/labkey/DefaultTestContainer/freezermanager-app.view#/boxes/101'
169+
);
162170
});
163171

164172
describe('getAuditDetailMap', () => {
@@ -204,5 +212,4 @@ describe('utils', () => {
204212
expect(result.toJS()).toEqual(data);
205213
});
206214
});
207-
208215
});

packages/components/src/internal/components/auditlog/utils.ts

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,18 @@ import { ModuleContext } from '../base/ServerContext';
2222

2323
import {
2424
ASSAY_AUDIT_QUERY,
25+
ASSAY_RESULT_AUDIT_QUERY,
26+
AUDIT_DETAIL_FIELD_VALUE_INHERITED,
2527
AuditQuery,
2628
COMMON_AUDIT_QUERIES,
29+
CONTAINER_AUDIT_QUERY,
2730
DATACLASS_DATA_UPDATE_AUDIT_QUERY,
2831
NOTEBOOK_AUDIT_QUERY,
2932
NOTEBOOK_REVIEW_AUDIT_QUERY,
30-
CONTAINER_AUDIT_QUERY,
3133
REGISTRY_AUDIT_QUERY,
34+
REPORT_AUDIT_QUERY,
3235
SOURCE_AUDIT_QUERY,
3336
WORKFLOW_AUDIT_QUERY,
34-
REPORT_AUDIT_QUERY,
35-
ASSAY_RESULT_AUDIT_QUERY, AUDIT_DETAIL_FIELD_VALUE_INHERITED,
3637
} from './constants';
3738
import { QueryKey } from '@labkey/api';
3839

@@ -110,33 +111,33 @@ export function getTimelineEntityUrl(d: Record<string, any>): AppURL {
110111
const { urlType, value } = d;
111112

112113
switch (urlType) {
113-
case SAMPLES_KEY:
114-
url = AppURL.create('rd', SAMPLES_KEY, value);
115-
break;
116-
case WORKFLOW_KEY:
117-
url = AppURL.create(WORKFLOW_KEY, value);
118-
break;
119-
case ASSAYS_KEY:
120-
url = AppURL.create(ASSAYS_KEY, 'general', value);
121-
break;
122-
case 'workflowTemplate':
123-
url = AppURL.create(WORKFLOW_KEY, 'template', value);
124-
break;
125-
case USER_KEY:
126-
url = undefined; // handle display render via UserLink
127-
break;
128114
case 'assayRun':
129115
if (Array.isArray(value) && value.length > 1) {
130116
url = AppURL.create(ASSAYS_KEY, 'general', value[0], 'runs', value[1]);
131117
}
132118
break;
119+
case ASSAYS_KEY:
120+
url = AppURL.create(ASSAYS_KEY, 'general', value);
121+
break;
122+
case 'inventoryBox':
123+
url = AppURL.create(BOXES_KEY, value).setProductId(FREEZER_MANAGER_PRODUCT_ID);
124+
break;
133125
case 'inventoryLocation':
134126
if (Array.isArray(value) && value.length > 1) {
135127
url = AppURL.create('rd', 'freezerLocation', value[1]);
136128
}
137129
break;
138-
case 'inventoryBox':
139-
url = AppURL.create(BOXES_KEY, value).setProductId(FREEZER_MANAGER_PRODUCT_ID);
130+
case SAMPLES_KEY:
131+
url = AppURL.create('rd', SAMPLES_KEY, value);
132+
break;
133+
case USER_KEY:
134+
url = undefined; // handle display render via UserLink
135+
break;
136+
case WORKFLOW_KEY:
137+
url = AppURL.create(WORKFLOW_KEY, value);
138+
break;
139+
case 'workflowTemplate':
140+
url = AppURL.create(WORKFLOW_KEY, 'template', value);
140141
break;
141142
default:
142143
break;
@@ -146,7 +147,10 @@ export function getTimelineEntityUrl(d: Record<string, any>): AppURL {
146147
return url;
147148
}
148149

149-
export function getAuditDetailMap(data: Record<string, string>, inheritedFields?: string[]): OrderedMap<string, string> {
150+
export function getAuditDetailMap(
151+
data: Record<string, string>,
152+
inheritedFields?: string[]
153+
): OrderedMap<string, string> {
150154
if (inheritedFields?.length > 0) {
151155
// sort fields.newData so that inherited fields are at the bottom
152156
const inheritedFieldsLc = inheritedFields.map(f => f.toLowerCase());
@@ -156,8 +160,7 @@ export function getAuditDetailMap(data: Record<string, string>, inheritedFields?
156160
for (const field of Object.keys(newData)) {
157161
if (!newData[field] && inheritedFieldsLc.indexOf(QueryKey.encodePart(field).toLowerCase()) > -1) {
158162
last[field] = AUDIT_DETAIL_FIELD_VALUE_INHERITED;
159-
}
160-
else {
163+
} else {
161164
sortedNewData[field] = newData[field];
162165
}
163166
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ export interface SamplesAPIWrapper {
8383
sort: string | undefined
8484
) => Promise<ISelectRowsResult>;
8585

86-
getTimelineEvents: (sampleId: number, timezone?: string, inheritedFields?: string[]) => Promise<TimelineEventModel[]>;
86+
getTimelineEvents: (
87+
sampleId: number,
88+
timezone?: string,
89+
inheritedFields?: string[]
90+
) => Promise<TimelineEventModel[]>;
8791

8892
hasExistingSamples: (isRoot?: boolean, containerPath?: string) => Promise<boolean>;
8993

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,11 @@ export async function getLookupRowIdsFromSelection(
506506
}
507507

508508
// optional timezone param used for teamcity jest test only
509-
export function getTimelineEvents(sampleId: number, timezone?: string, inheritedFields?: string[]): Promise<TimelineEventModel[]> {
509+
export function getTimelineEvents(
510+
sampleId: number,
511+
timezone?: string,
512+
inheritedFields?: string[]
513+
): Promise<TimelineEventModel[]> {
510514
return new Promise((resolve, reject) => {
511515
Ajax.request({
512516
url: ActionURL.buildURL(SAMPLE_MANAGER_APP_PROPERTIES.controllerName, 'getTimeline.api'),

0 commit comments

Comments
 (0)