diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index 1723e2a9ae..a9e0541373 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -320,6 +320,7 @@ tabs: host_vms_tab: true host_wilds_tab: true host_esx_tab: true + host_pci_tab: true table_columns: - 0 # Checkbox - 1 # ID diff --git a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml index 0bea2fb07d..3586c21e0e 100644 --- a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml @@ -320,6 +320,7 @@ tabs: host_vms_tab: true host_wilds_tab: true host_esx_tab: true + host_pci_tab: true table_columns: - 0 # Checkbox - 1 # ID diff --git a/src/sunstone/etc/sunstone-views/user.yaml b/src/sunstone/etc/sunstone-views/user.yaml index d12b192d12..af022fb4ce 100644 --- a/src/sunstone/etc/sunstone-views/user.yaml +++ b/src/sunstone/etc/sunstone-views/user.yaml @@ -321,6 +321,7 @@ tabs: host_vms_tab: true host_wilds_tab: true host_esx_tab: true + host_pci_tab: true table_columns: - 0 # Checkbox - 1 # ID diff --git a/src/sunstone/public/app/tabs/hosts-tab.js b/src/sunstone/public/app/tabs/hosts-tab.js index 252f6aefbf..ce56413b61 100644 --- a/src/sunstone/public/app/tabs/hosts-tab.js +++ b/src/sunstone/public/app/tabs/hosts-tab.js @@ -17,7 +17,8 @@ define(function(require) { require('./hosts-tab/panels/monitor'), require('./hosts-tab/panels/vms'), require('./hosts-tab/panels/wilds'), - require('./hosts-tab/panels/esx') + require('./hosts-tab/panels/esx'), + require('./hosts-tab/panels/pci') ]; var _formPanels = [ diff --git a/src/sunstone/public/app/tabs/hosts-tab/panels/pci.js b/src/sunstone/public/app/tabs/hosts-tab/panels/pci.js new file mode 100644 index 0000000000..8a7d07b55d --- /dev/null +++ b/src/sunstone/public/app/tabs/hosts-tab/panels/pci.js @@ -0,0 +1,92 @@ +define(function(require) { + /* + DEPENDENCIES + */ + + var Locale = require('utils/locale'); + var DomDataTable = require('utils/dom-datatable'); + + /* + TEMPLATES + */ + + var TemplateHTML = require('hbs!./pci/html'); + + /* + CONSTANTS + */ + + var TAB_ID = require('../tabId'); + var PANEL_ID = require('./pci/panelId'); + var RESOURCE = "Host" + var XML_ROOT = "HOST" + + /* + CONSTRUCTOR + */ + + function Panel(info) { + this.title = Locale.tr("PCI"); + this.icon = "fa-list-ul"; + + this.element = info[XML_ROOT]; + + this.panelId = PANEL_ID; + + // Do not create an instance of this panel if no pci devices are found + if (this.element.HOST_SHARE.PCI_DEVICES.PCI == undefined) { + throw "Panel not available for this element"; + } + + return this; + } + + Panel.PANEL_ID = PANEL_ID; + Panel.prototype.html = _html; + Panel.prototype.setup = _setup; + + return Panel; + + /* + FUNCTION DEFINITIONS + */ + + function _html() { + 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(){ + if(this.VMID == "-1"){ + this.VMID = ""; + } + }); + } + + return TemplateHTML({ + 'element': this.element, + 'panelId': this.panelId + }); + } + + function _setup(context) { + this.pciDataTable = new DomDataTable( + 'datatable_pci_'+this.panelId, + { + actions: false, + info: false, + dataTableOptions: { + "bAutoWidth": false, + "bSortClasses" : false, + "bDeferRender": true, + "ordering": false, + "aoColumnDefs": [ + ] + } + }); + + this.pciDataTable.initialize(); + + return false; + } +}); 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 new file mode 100644 index 0000000000..a2d4ecc116 --- /dev/null +++ b/src/sunstone/public/app/tabs/hosts-tab/panels/pci/html.hbs @@ -0,0 +1,28 @@ +
| {{tr "VM"}} | +{{tr "PCI Address"}} | +{{tr "Type"}} | +{{tr "Class"}} | +{{tr "Name"}} | +{{tr "Vendor"}} | +
|---|---|---|---|---|---|
| {{VMID}} | +{{SHORT_ADDRESS}} | +{{TYPE}} | +{{CLASS_NAME}} | +{{DEVICE_NAME}} | +{{VENDOR_NAME}} | +