fix(docker): surface node details docker error [EE-7054] (#11752)

Co-authored-by: testa113 <testa113>
pull/11604/merge
Ali 2024-05-09 12:01:13 +12:00 committed by GitHub
parent 014c491205
commit 6ae0a972d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 24 additions and 19 deletions

View File

@ -5,7 +5,8 @@ angular.module('portainer.docker').controller('NodeDetailsViewController', [
'StateManager',
'AgentService',
'Authentication',
function NodeDetailsViewController($q, $stateParams, NodeService, StateManager, AgentService, Authentication) {
'Notifications',
function NodeDetailsViewController($q, $stateParams, NodeService, StateManager, AgentService, Authentication, Notifications) {
var ctrl = this;
ctrl.$onInit = initView;
@ -24,25 +25,29 @@ angular.module('portainer.docker').controller('NodeDetailsViewController', [
var nodeId = $stateParams.id;
$q.all({
node: NodeService.node(nodeId),
}).then(function (data) {
var node = data.node;
ctrl.originalNode = node;
ctrl.hostDetails = buildHostDetails(node);
ctrl.engineDetails = buildEngineDetails(node);
ctrl.nodeDetails = buildNodeDetails(node);
if (ctrl.state.isAgent) {
var agentApiVersion = applicationState.endpoint.agentApiVersion;
ctrl.state.agentApiVersion = agentApiVersion;
if (agentApiVersion < 2 || !ctrl.state.enableHostManagementFeatures) {
return;
}
})
.then(function (data) {
var node = data.node;
ctrl.originalNode = node;
ctrl.hostDetails = buildHostDetails(node);
ctrl.engineDetails = buildEngineDetails(node);
ctrl.nodeDetails = buildNodeDetails(node);
if (ctrl.state.isAgent) {
var agentApiVersion = applicationState.endpoint.agentApiVersion;
ctrl.state.agentApiVersion = agentApiVersion;
if (agentApiVersion < 2 || !ctrl.state.enableHostManagementFeatures) {
return;
}
AgentService.hostInfo(ctrl.endpoint.Id, node.Hostname).then(function onHostInfoLoad(agentHostInfo) {
ctrl.devices = agentHostInfo.PCIDevices;
ctrl.disks = agentHostInfo.PhysicalDisks;
});
}
});
AgentService.hostInfo(ctrl.endpoint.Id, node.Hostname).then(function onHostInfoLoad(agentHostInfo) {
ctrl.devices = agentHostInfo.PCIDevices;
ctrl.disks = agentHostInfo.PhysicalDisks;
});
}
})
.catch(function (err) {
Notifications.error('Failure', err, 'Unable to retrieve node details');
});
}
function buildHostDetails(node) {