import { Component, OnInit } from '@angular/core';
import { DetailsComponentBase } from '@objects-view/details-component-base';
import { IClusterModel } from '@fleio-api/openstack/model/cluster.model';
import { ConfigService } from '@shared/config/config.service';

@Component({
  selector: 'app-cluster-details-info',
  templateUrl: './cluster-details-info.component.html',
  styleUrls: ['./cluster-details-info.component.scss']
})
export class ClusterDetailsInfoComponent extends DetailsComponentBase<IClusterModel> implements OnInit{
  hasFaults = false;

  constructor(
    public config: ConfigService,
  ) {
    super();
  }

  ngOnInit(refreshTimerInterval?: number) {
    super.ngOnInit(refreshTimerInterval);
    this.hasFaults = (this.object.faults && typeof this.object.faults === 'object' &&
      Object.keys(this.object.faults).length > 0);
  }
}
