Skip to content
Merged
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
28 changes: 25 additions & 3 deletions src/components/projectList/List.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class List extends Component {
dir: 1,
projectTab: 'own',
name:'',
dirname:'asc'
dirname:'desc'
}
}

Expand Down Expand Up @@ -171,7 +171,10 @@ class List extends Component {
rowObject[modifiedField] = listItem.modified_at

rowObject.pino_number = listItem.pino_number


for (const [key, val] of Object.entries(rowObject)) {
rowObject[key] = {index: rows.length, value: val}
}
rows.push(rowObject)
let rowObject2 = {}

Expand All @@ -181,10 +184,29 @@ class List extends Component {
</span>
)
rowObject2.pino_number = `${listItem.pino_number}-graph`
for (const [key, val] of Object.entries(rowObject2)) {
rowObject2[key] = {index: rows.length, value: val}
}
for (const key of Object.keys(rowObject)) {
if (!(key in rowObject2)) {
rowObject2[key] = {index: rows.length, value: null}
}
}
rows.push(rowObject2)
}
)

// Workaround to prevent default HDS Table sort; rows are already sorted by backend
const preventSort = (a, b) => {
if(this.state.dirname === "asc")
return a.index - b.index;
return b.index - a.index;
}
this.headerItems.forEach(item => item.customSortCompareFunction = preventSort);
this.headerItems.forEach(headerItem => headerItem.transform = (item) => {
return item[headerItem.key].value
});

let showGraphStyle = this.props.showGraph ? "project-list showGraph" : "project-list"
return (
<>
Expand All @@ -193,7 +215,7 @@ class List extends Component {
ariaLabelSortButtonUnset="Not sorted"
ariaLabelSortButtonAscending="Sorted in ascending order"
ariaLabelSortButtonDescending="Sorted in descending order"
indexKey="pino_number"
indexKey="pino_number.value"
renderIndexCol={true}
cols={this.headerItems}
rows={rows}
Expand Down