From 6dd908baf4b2d571cae2dd0bf72643bda528aba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 27 Aug 2015 16:55:35 +0200 Subject: [PATCH] Feature #3028: Fix pci table for 1 element, remove table columns --- src/sunstone/public/app/tabs/hosts-tab/panels/pci.js | 12 ++++++++++-- .../public/app/tabs/hosts-tab/panels/pci/html.hbs | 6 +----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/sunstone/public/app/tabs/hosts-tab/panels/pci.js b/src/sunstone/public/app/tabs/hosts-tab/panels/pci.js index 8a7d07b55d..d99dd89892 100644 --- a/src/sunstone/public/app/tabs/hosts-tab/panels/pci.js +++ b/src/sunstone/public/app/tabs/hosts-tab/panels/pci.js @@ -52,11 +52,19 @@ define(function(require) { */ function _html() { + var pcis = []; + if(this.element.HOST_SHARE && this.element.HOST_SHARE.PCI_DEVICES && this.element.HOST_SHARE.PCI_DEVICES.PCI){ - $.each(this.element.HOST_SHARE.PCI_DEVICES.PCI, function(){ + pcis = this.element.HOST_SHARE.PCI_DEVICES.PCI; + + if (!$.isArray(pcis)){ // If only 1 convert to array + pcis = [pcis]; + } + + $.each(pcis, function(){ if(this.VMID == "-1"){ this.VMID = ""; } @@ -64,7 +72,7 @@ define(function(require) { } return TemplateHTML({ - 'element': this.element, + 'pcis': pcis, 'panelId': this.panelId }); } diff --git a/src/sunstone/public/app/tabs/hosts-tab/panels/pci/html.hbs b/src/sunstone/public/app/tabs/hosts-tab/panels/pci/html.hbs index a2d4ecc116..6b99e22b56 100644 --- a/src/sunstone/public/app/tabs/hosts-tab/panels/pci/html.hbs +++ b/src/sunstone/public/app/tabs/hosts-tab/panels/pci/html.hbs @@ -6,20 +6,16 @@ {{tr "VM"}} {{tr "PCI Address"}} {{tr "Type"}} - {{tr "Class"}} {{tr "Name"}} - {{tr "Vendor"}} - {{#each element.HOST_SHARE.PCI_DEVICES.PCI}} + {{#each pcis}} {{VMID}} {{SHORT_ADDRESS}} {{TYPE}} - {{CLASS_NAME}} {{DEVICE_NAME}} - {{VENDOR_NAME}} {{/each}}