Skip to content

Commit 5578d92

Browse files
committed
[O2B-1536] Show lastEditedName for EOR reasons
Now display the lastEditedName for EOR reasons on `run-detail` page. `formatEorReason` also renders a tooltip above the `lastEditedName` to make clear who it refers to.
1 parent 55062b6 commit 5578d92

5 files changed

Lines changed: 36 additions & 14 deletions

File tree

lib/public/views/Runs/Details/RunDetailsModel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,15 @@ export class RunDetailsModel extends Observable {
238238
* @return {void}
239239
*/
240240
addNewEorReason() {
241-
const { category, title, description } = this.newEorReason;
241+
const { category, title, description, lastEditedName } = this.newEorReason;
242242
const reasonType = this._eorReasonTypes.match({
243243
Success: (eorReasonTypes) => eorReasonTypes
244244
.find((eorReasonType) => eorReasonType.category === category && eorReasonType.title === title),
245245
Other: () => null,
246246
});
247247

248248
if (reasonType) {
249-
this.runPatch.addEorReason({ reasonTypeId: reasonType.id, description });
249+
this.runPatch.addEorReason({ reasonTypeId: reasonType.id, description, lastEditedName });
250250
}
251251
}
252252

lib/public/views/Runs/Details/RunPatch.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ export class RunPatch extends Observable {
126126
} = this._run || {};
127127

128128
this._runQuality = runQuality;
129-
this._eorReasons = eorReasons.map(({ id, description, reasonTypeId }) => ({ id, description, reasonTypeId }));
129+
this._eorReasons = eorReasons.map(({ id, description, reasonTypeId, lastEditedName }) => ({
130+
id,
131+
description,
132+
reasonTypeId,
133+
lastEditedName,
134+
}));
130135
this._tags = tags.map(({ text }) => text);
131136

132137
this.formData = {

lib/public/views/Runs/Details/runDetailsComponent.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,10 @@ export const runDetailsComponent = (runDetailsModel, router) => runDetailsModel.
533533
h('#eor-reasons.flex-row', [
534534
runDetailsModel.isEditModeEnabled
535535
? editRunEorReasons(runDetailsModel)
536-
: h('.flex-column.g2', run.eorReasons.map((eorReason) => h('.eor-reason', formatEorReason(eorReason)))),
536+
: h(
537+
'.flex-column.g2.w-100',
538+
run.eorReasons.map((eorReason) => h('.eor-reason', formatEorReason(eorReason))),
539+
),
537540
]),
538541
]),
539542
]),

lib/public/views/Runs/format/editRunEorReasons.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,23 @@ export const editRunEorReasons = (runDetailsModel) => {
9494
*/
9595
runDetailsModel.runPatch.eorReasons.length > 0
9696
? runDetailsModel.runPatch.eorReasons.map((eorReason) => {
97-
const { reasonTypeId, description } = eorReason;
97+
const { reasonTypeId, description, lastEditedName } = eorReason;
9898
const { category = '-', title } = eorReasonTypes.find((eorReasonType) => eorReasonType.id === reasonTypeId) || {};
9999
const titleString = title ? ` - ${title}` : '';
100100
const descriptionString = description ? ` - ${description}` : '';
101101
return h(
102-
'.flex-row.items-center',
102+
'.flex-row.justify-between',
103103
{
104104
key: `${category} ${titleString} ${descriptionString}`,
105105
},
106106
[
107-
h('label.remove-eor-reason.danger.ph1.actionable-icon', {
108-
onclick: () => runDetailsModel.runPatch.removeEorReason(eorReason),
109-
}, iconTrash()),
110-
h('.w-wrapped', `${category} ${titleString} ${descriptionString}`),
107+
h('.flex-row.items-center', [
108+
h('label.remove-eor-reason.danger.ph1.actionable-icon', {
109+
onclick: () => runDetailsModel.runPatch.removeEorReason(eorReason),
110+
}, iconTrash()),
111+
h('.w-wrapped', `${category} ${titleString} ${descriptionString}`),
112+
]),
113+
h('.w-wrapped', `${lastEditedName}`),
111114
],
112115
);
113116
})

lib/public/views/Runs/format/formatEorReason.mjs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,25 @@
1111
* or submit itself to any jurisdiction.
1212
*/
1313

14+
import { h } from '/js/src/index.js';
15+
import { tooltip } from '../../../../components/common/popover/tooltip.js';
16+
1417
/**
1518
* Format the given EoR reason to string
1619
*
17-
* @param {Partial<{category: string, title: string, description: string}>} eorReason the EoR reason to
18-
* format
20+
* @param {Partial<{
21+
* category: string,
22+
* title: string,
23+
* description: string,
24+
* lastEditedName: string,
25+
* }>} eorReason the EoR reason to format
1926
* @return {string} the result
2027
*/
2128
export const formatEorReason = (eorReason) => {
22-
const { category, title, description } = eorReason;
23-
return [category, title, description].filter((item) => item).join(' - ');
29+
const { category, title, description, lastEditedName } = eorReason;
30+
const reasonText = [category, title, description].filter((item) => item).join(' - ');
31+
return h('.w-100.flex-row.justify-between', [
32+
h('', reasonText),
33+
tooltip(h('.w-wrapped', `${lastEditedName}`), 'Last edited by'),
34+
]);
2435
};

0 commit comments

Comments
 (0)