feat(host-details): show disk/devices info for agent

pull/2255/head
Chaim Lev-Ari 2018-09-25 10:39:55 +03:00
parent db0fc1382d
commit fe73fe616d
7 changed files with 68 additions and 27 deletions

View File

@ -0,0 +1,23 @@
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<rd-widget>
<rd-widget-header icon="fa-code" title-text="PCI Devices"></rd-widget-header>
<rd-widget-body classes="no-padding">
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Vendor</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="device in $ctrl.devices">
<td>{{device.Name}}</td>
<td>{{device.Vendor}}</td>
</tr>
</tbody>
</table>
</rd-widget-body>
</rd-widget>
</div>
</div>

View File

@ -0,0 +1,8 @@
angular.module('portainer.docker').component('devicesPanel', {
templateUrl:
'app/docker/components/host-view-panels/devices-panel/devices-panel.html',
// controller: 'DevicesPanelController'
bindings: {
devices: '<'
}
});

View File

@ -0,0 +1,23 @@
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<rd-widget>
<rd-widget-header icon="fa-code" title-text="Physical Disks"></rd-widget-header>
<rd-widget-body classes="no-padding">
<table class="table">
<thead>
<tr>
<th>Vendor</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="disk in $ctrl.disks">
<td>{{disk.Vendor}}</td>
<td>{{disk.Size | humansize}}</td>
</tr>
</tbody>
</table>
</rd-widget-body>
</rd-widget>
</div>
</div>

View File

@ -0,0 +1,8 @@
angular.module('portainer.docker').component('disksPanel', {
templateUrl:
'app/docker/components/host-view-panels/disks-panel/disks-panel.html',
// controller: 'DisksPanelController'
bindings: {
disks: '<'
}
});

View File

@ -11,7 +11,8 @@
</tr> </tr>
<tr ng-if="$ctrl.host.os"> <tr ng-if="$ctrl.host.os">
<td>OS Information</td> <td>OS Information</td>
<td>{{ $ctrl.host.os.type }} {{$ctrl.host.os.arch}} {{$ctrl.host.os.name}}</td> <td>{{ $ctrl.host.os.type }} {{$ctrl.host.os.arch}}
{{$ctrl.host.os.name}}</td>
</tr> </tr>
<tr ng-if="$ctrl.host.kernelVersion"> <tr ng-if="$ctrl.host.kernelVersion">
<td>Kernel Version</td> <td>Kernel Version</td>
@ -25,18 +26,6 @@
<td>Total memory</td> <td>Total memory</td>
<td>{{ $ctrl.host.totalMemory | humansize }}</td> <td>{{ $ctrl.host.totalMemory | humansize }}</td>
</tr> </tr>
<tr ng-if="$ctrl.host.physicalDeviceInfo">
<td>Physical device information</td>
<td>{{ $ctrl.host.physicalDeviceInfo }}</td>
</tr>
<tr ng-if="$ctrl.host.pciDevices">
<td>Installed PCI devices</td>
<td>{{ $ctrl.host.pciDevices |commaSeparated }}</td>
</tr>
<tr ng-if="$ctrl.host.physicalDisk">
<td>Physical disk</td>
<td>{{ $ctrl.host.physicalDisk }}</td>
</tr>
</tbody> </tbody>
</table> </table>
</rd-widget-body> </rd-widget-body>

View File

@ -21,29 +21,21 @@ angular.module('portainer.docker').controller('NodeDetailsViewController', [
ctrl.nodeDetails = buildNodeDetails(node); ctrl.nodeDetails = buildNodeDetails(node);
if (ctrl.state.isAgent) { if (ctrl.state.isAgent) {
AgentService.hostInfo(node.Hostname).then(function onHostInfoLoad(agentHostInfo) { AgentService.hostInfo(node.Hostname).then(function onHostInfoLoad(agentHostInfo) {
enhanceHostDetails(ctrl.hostDetails, agentHostInfo); ctrl.devices = agentHostInfo.PCIDevices;
ctrl.disks = agentHostInfo.PhysicalDisks;
}); });
} }
}); });
} }
function enhanceHostDetails(hostDetails, agentHostInfo) {
hostDetails.physicalDeviceInfo = agentHostInfo.PhysicalDeviceInfo;
hostDetails.pciDevices = agentHostInfo.InstalledPCIDevices;
hostDetails.physicalDisk = agentHostInfo.PhysicalDisk;
}
function buildHostDetails(node) { function buildHostDetails(node) {
return { return {
os: { os: {
arch: node.PlatformArchitecture, arch: node.PlatformArchitecture,
type: node.PlatformOS type: node.PlatformOS
// name: node.OperatingSystem TODO
}, },
name: node.Hostname, name: node.Hostname,
// kernelVersion: node.KernelVersion,
totalCPU: node.CPUs / 1e9, totalCPU: node.CPUs / 1e9,
totalMemory: node.Memory totalMemory: node.Memory
}; };
@ -52,10 +44,6 @@ angular.module('portainer.docker').controller('NodeDetailsViewController', [
function buildEngineDetails(node) { function buildEngineDetails(node) {
return { return {
releaseVersion: node.EngineVersion, releaseVersion: node.EngineVersion,
// apiVersion: versionDetails.ApiVersion, TODO
// rootDirectory: node.DockerRootDir, TODO
// storageDriver: node.Driver,
// loggingDriver: node.LoggingDriver,
volumePlugins: transformPlugins(node.Plugins, 'Volume'), volumePlugins: transformPlugins(node.Plugins, 'Volume'),
networkPlugins: transformPlugins(node.Plugins, 'Network') networkPlugins: transformPlugins(node.Plugins, 'Network')
}; };

View File

@ -4,6 +4,8 @@
engine-details="$ctrl.engineDetails" engine-details="$ctrl.engineDetails"
refresh-url="docker.nodes.node" refresh-url="docker.nodes.node"
> >
<devices-panel ng-if="$ctrl.state.isAgent" devices="$ctrl.devices"></devices-panel>
<disks-panel ng-if="$ctrl.state.isAgent" disks="$ctrl.disks"></disks-panel>
<swarm-node-details-panel <swarm-node-details-panel
details="$ctrl.nodeDetails" details="$ctrl.nodeDetails"
original-node="$ctrl.originalNode" original-node="$ctrl.originalNode"