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