Skip to content

Commit cfb984b

Browse files
committed
[O2B-1536] Keep EOR lastEditedName out of patch; preserve for UI
1 parent eaa4918 commit cfb984b

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export class RunDetailsModel extends Observable {
5353
this.editionTagPickerModel = new TagSelectionDropdownModel();
5454
this._runPatch = new RunPatch();
5555
this._runPatch.bubbleTo(this);
56+
this._eorReasonLastEditedNames = [];
5657

5758
this._tabbedPanelModel = new RunDetailsTabbedPanelModel();
5859
this._tabbedPanelModel.bubbleTo(this);
@@ -278,6 +279,14 @@ export class RunDetailsModel extends Observable {
278279
return this._runPatch;
279280
}
280281

282+
/**
283+
* Returns the list of last edited names for EOR reasons, to be displayed in the edit form so as not to get added to patch
284+
* @return {string[]} the list of last edited names for EOR reasons
285+
*/
286+
get eorReasonLastEditedNames() {
287+
return this._eorReasonLastEditedNames;
288+
}
289+
281290
/**
282291
* Returns the model for bottom-page tabs
283292
*
@@ -301,6 +310,8 @@ export class RunDetailsModel extends Observable {
301310
this._runPatch = new RunPatch(run);
302311
this._runPatch.bubbleTo(this);
303312

313+
this._eorReasonLastEditedNames = (run.eorReasons || []).map((eorReason) => eorReason.lastEditedName ?? null);
314+
304315
this.editionTagPickerModel = new TagSelectionDropdownModel({ defaultSelection: run.tags.map(tagToOption) });
305316
this._tabbedPanelModel.runNumber = run.runNumber;
306317
this._runNumber = run.runNumber;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,10 @@ export class RunPatch extends Observable {
126126
} = this._run || {};
127127

128128
this._runQuality = runQuality;
129-
this._eorReasons = eorReasons.map(({ id, description, reasonTypeId, lastEditedName }) => ({
129+
this._eorReasons = eorReasons.map(({ id, description, reasonTypeId }) => ({
130130
id,
131131
description,
132132
reasonTypeId,
133-
lastEditedName,
134133
}));
135134
this._tags = tags.map(({ text }) => text);
136135

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ export const editRunEorReasons = (runDetailsModel) => {
9393
* added EOR reason is still displayed
9494
*/
9595
runDetailsModel.runPatch.eorReasons.length > 0
96-
? runDetailsModel.runPatch.eorReasons.map((eorReason) => {
97-
const { reasonTypeId, description, lastEditedName } = eorReason;
96+
? runDetailsModel.runPatch.eorReasons.map((eorReason, index) => {
97+
const { reasonTypeId, description } = eorReason;
98+
const lastEditedName = runDetailsModel.eorReasonLastEditedNames[index];
9899
const { category = '-', title } = eorReasonTypes.find((eorReasonType) => eorReasonType.id === reasonTypeId) || {};
99100
const titleString = title ? ` - ${title}` : '';
100101
const descriptionString = description ? ` - ${description}` : '';
@@ -110,7 +111,7 @@ export const editRunEorReasons = (runDetailsModel) => {
110111
}, iconTrash()),
111112
h('.w-wrapped', `${category} ${titleString} ${descriptionString}`),
112113
]),
113-
h('.w-wrapped', `${lastEditedName}`),
114+
h('.w-wrapped', `${lastEditedName ? `${lastEditedName}` : ''}`),
114115
],
115116
);
116117
})

0 commit comments

Comments
 (0)