1 import { Component, Input, OnChanges, OnInit } from '@angular/core';
3 import { OrchestratorService } from '../../../shared/api/orchestrator.service';
4 import { Icons } from '../../../shared/enum/icons.enum';
5 import { InventoryDevice } from './inventory-devices/inventory-device.model';
8 selector: 'cd-inventory',
9 templateUrl: './inventory.component.html',
10 styleUrls: ['./inventory.component.scss']
12 export class InventoryComponent implements OnChanges, OnInit {
13 // Display inventory page only for this hostname, ignore to display all.
14 @Input() hostname?: string;
18 hasOrchestrator = false;
21 devices: Array<InventoryDevice> = [];
23 constructor(private orchService: OrchestratorService) {}
26 this.orchService.status().subscribe((status) => {
27 this.hasOrchestrator = status.available;
28 if (status.available) {
35 if (this.hasOrchestrator) {
42 if (this.hostname === '') {
45 this.orchService.inventoryDeviceList(this.hostname).subscribe(
46 (devices: InventoryDevice[]) => {
47 this.devices = devices;