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

@Component({
  selector: 'app-instance-details-info',
  templateUrl: './instance-details-info.component.html',
  styleUrls: ['./instance-details-info.component.scss']
})
export class InstanceDetailsInfoComponent extends DetailsComponentBase<IInstanceModel> implements OnInit {
  ramDisplay;
  constructor(public config: ConfigService) {
    super();
  }

  ngOnInit(refreshTimerInterval?: number) {
    super.ngOnInit(refreshTimerInterval);
    this.ramDisplay = OpenstackUtils.MiBToUserFriendly(this.object.flavor.memory_mb, true);
  }
}
