1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

#414 feat(node-details): add ability to view and edit Swarm mode nodes (#417)

This commit is contained in:
Glowbal 2017-01-25 22:12:04 +01:00 committed by Anthony Lapenna
parent e6dee37af0
commit fa9ba303aa
7 changed files with 464 additions and 5 deletions

View file

@ -29,6 +29,28 @@ angular.module('portainer.helpers', [])
return mode;
}
};
}])
.factory('LabelHelper', [function LabelHelperFactory() {
'use strict';
return {
fromLabelHashToKeyValue: function(labels) {
if (labels) {
return Object.keys(labels).map(function(key) {
return {key: key, value: labels[key], originalKey: key, originalValue: labels[key], added: true};
});
}
return [];
},
fromKeyValueToLabelHash: function(labelKV) {
var labels = {};
if (labelKV) {
labelKV.forEach(function(label) {
labels[label.key] = label.value;
});
}
return labels;
}
};
}])
.factory('ImageHelper', [function ImageHelperFactory() {
'use strict';
@ -94,6 +116,19 @@ angular.module('portainer.helpers', [])
}
};
}])
.factory('NodeHelper', [function NodeHelperFactory() {
'use strict';
return {
nodeToConfig: function(node) {
return {
Name: node.Spec.Name,
Role: node.Spec.Role,
Labels: node.Spec.Labels,
Availability: node.Spec.Availability
};
}
};
}])
.factory('TemplateHelper', [function TemplateHelperFactory() {
'use strict';
return {