Skip to content

Commit

Permalink
remove redundant render table uuids (#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Dec 6, 2022
1 parent dfd8100 commit 3c217d2
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 105 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Changed
- Update backend iRODS connection handling (#909, #1542)
- **Samplesheets**
- Upgrade ``loader-utils`` in Vue app (#1527)
- Remove redundant node UUIDs from render tables (#708)

Fixed
-----
Expand Down
6 changes: 4 additions & 2 deletions samplesheets/rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,10 @@ def _add_cell(

# Add extra data for editing
if self._edit:
cell['uuid'] = str(obj.sodar_uuid) # Node UUID
# Object reference UUID for special cases
# Only add object UUID for name and protocol headers
if header_type in ['name', 'protocol']:
cell['uuid'] = str(obj.sodar_uuid)
# Reference UUID to another object for special cases
if header_type == 'protocol':
cell['uuid_ref'] = str(obj.protocol.sodar_uuid)
self._row.append(cell)
Expand Down
7 changes: 4 additions & 3 deletions samplesheets/vueapp/src/utils/gridUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,29 +490,30 @@ export function buildRowData (params) {
for (let i = 0; i < params.table.table_data.length; i++) {
const rowCells = params.table.table_data[i]
const row = { rowNum: i + 1 }
let nodeUuid = null
for (let j = 0; j < rowCells.length; j++) {
const cellVal = rowCells[j]
if ('uuid' in cellVal && cellVal.uuid) {
nodeUuid = cellVal.uuid // Get node UUID from first node cell
} else cellVal.uuid = nodeUuid // Set node UUID to other cells
// Copy col_type info to each cell (comparator can't access colDef)
cellVal.colType = params.table.field_header[j].col_type
row['col' + j.toString()] = cellVal
}

// Add study shortcut field
if (!params.editMode &&
!params.assayMode &&
'shortcuts' in params.table &&
params.table.shortcuts) {
row.shortcutLinks = params.table.shortcuts.data[i]
}

// Add iRODS field
if (!params.editMode &&
params.sodarContext.irods_status &&
'irods_paths' in params.table &&
params.table.irods_paths.length > 0) {
row.irodsLinks = params.table.irods_paths[i]
}

rowData.push(row)
}
return rowData
Expand Down
Loading

0 comments on commit 3c217d2

Please sign in to comment.