Skip to content

Commit

Permalink
[YUNIKORN-2008] Hide empty columns in node view (apache#148)
Browse files Browse the repository at this point in the history
Columns that only contain empty ivalues or have all 'n/a' values are no
longer rendered in the table for nodes.

Closes: apache#148

Signed-off-by: Wilfred Spiegelenburg <[email protected]>
  • Loading branch information
wusamzong authored and wilfred-s committed Jan 25, 2024
1 parent 1a51966 commit 9bbe0dd
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/app/components/nodes-view/nodes-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,21 +193,26 @@ export class NodesViewComponent implements OnInit {
}

formatColumn(){
if(this.nodeDataSource.data.length==0){
return
if(this.nodeDataSource.data.length===0){
return;
}
this.nodeColumnIds.forEach((colId)=>{
let emptyCell=this.nodeDataSource.data.filter((node: NodeInfo)=>{
if (colId === 'indicatorIcon'){
return false;
}
if (!(colId in node)) {
console.error(`Property '${colId}' does not exist on Node.`);
return false;
}
return (node as any)[colId]==="" || (node as any)[colId]==="n/a";
})
if (emptyCell.length==this.nodeDataSource.data.length){
if (colId==='indicatorIcon'){
return;
}

// Verify whether all cells in the column are empty.
let isEmpty:boolean = true;
Object.values(this.nodeDataSource.data).forEach((node) => {
Object.entries(node).forEach(entry => {
const [key, value] = entry;
if (key===colId && !(value==='' || value==='n/a')){
isEmpty=false;
}
});
});

if (isEmpty){
this.nodeColumnIds = this.nodeColumnIds.filter(el => el!==colId);
this.nodeColumnIds = this.nodeColumnIds.filter(colId => colId!=="attributes");
}
Expand Down

0 comments on commit 9bbe0dd

Please sign in to comment.