ngOnInit()

in src/app/components/nodes-view/nodes-view.component.ts [65:132]


  ngOnInit() {
    this.nodeDataSource.paginator = this.nodePaginator;
    this.allocDataSource.paginator = this.allocPaginator;
    this.nodeDataSource.sort = this.nodeSort;
    this.allocDataSource.sort = this.allocSort;

    this.nodeColumnDef = [
      { colId: 'nodeId', colName: 'Node ID' },
      { colId: 'attributes', colName: 'Attributes' },
      { colId: 'capacity', colName: 'Capacity', colFormatter: CommonUtil.resourceColumnFormatter },
      { colId: 'occupied', colName: 'Used', colFormatter: CommonUtil.resourceColumnFormatter },
      {
        colId: 'allocated',
        colName: 'Allocated',
        colFormatter: CommonUtil.resourceColumnFormatter,
      },
      {
        colId: 'available',
        colName: 'Available',
        colFormatter: CommonUtil.resourceColumnFormatter,
      },
      {
        colId: 'utilized',
        colName: 'Utilized',
        colFormatter: CommonUtil.resourceColumnFormatter,
      },
    ];

    this.nodeColumnIds = this.nodeColumnDef
      .filter(col=> !['attributes'].includes(col.colId))
      .map((col) => col.colId)
      .concat('indicatorIcon');

    this.allocColumnDef = [
      { colId: 'displayName', colName: 'Display Name' },
      { colId: 'allocationKey', colName: 'Allocation Key' },
      { colId: 'resource', colName: 'Resource', colFormatter: CommonUtil.resourceColumnFormatter },
      { colId: 'priority', colName: 'Priority' },
      { colId: 'applicationId', colName: 'Application ID' },
    ];

    this.allocColumnIds = this.allocColumnDef.map((col) => col.colId);

    this.spinner.show();

    this.scheduler
      .fetchPartitionList()
      .pipe(
        finalize(() => {
          this.spinner.hide();
        })
      )
      .subscribe((list) => {
        if (list && list.length > 0) {
          list.forEach((part) => {
            this.partitionList.push(new PartitionInfo(part.name, part.name));
          });

          this.partitionSelected = CommonUtil.getStoredPartition(list[0].name);
          this.fetchNodeListForPartition(this.partitionSelected);
        } else {
          this.partitionList = [new PartitionInfo('-- Select --', '')];
          this.partitionSelected = '';
          this.nodeDataSource.data = [];
          CommonUtil.setStoredQueueAndPartition('');
        }
      });
  }