This is an automated email from the ASF dual-hosted git repository.
wilfreds pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-web.git
The following commit(s) were added to refs/heads/master by this push:
new 9bbe0dd [YUNIKORN-2008] Hide empty columns in node view (#148)
9bbe0dd is described below
commit 9bbe0dd1f7fb69f2ef019d0d5e7fd71b3b8c5688
Author: wusamzong <[email protected]>
AuthorDate: Thu Jan 25 15:47:00 2024 +1100
[YUNIKORN-2008] Hide empty columns in node view (#148)
Columns that only contain empty ivalues or have all 'n/a' values are no
longer rendered in the table for nodes.
Closes: #148
Signed-off-by: Wilfred Spiegelenburg <[email protected]>
---
.../components/nodes-view/nodes-view.component.ts | 31 +++++++++++++---------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/src/app/components/nodes-view/nodes-view.component.ts
b/src/app/components/nodes-view/nodes-view.component.ts
index a9c77d7..9bcf58a 100644
--- a/src/app/components/nodes-view/nodes-view.component.ts
+++ b/src/app/components/nodes-view/nodes-view.component.ts
@@ -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");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]