portainer/app/docker/components/host-view-panels/node-labels-table/node-labels-table-controlle...

21 lines
588 B
JavaScript

angular.module('portainer.docker').controller('NodeLabelsTableController', [
function NodeLabelsTableController() {
var ctrl = this;
ctrl.removeLabel = removeLabel;
ctrl.updateLabel = updateLabel;
function removeLabel(index) {
var label = ctrl.labels.splice(index, 1);
if (label !== null) {
ctrl.onChangedLabels({ labels: ctrl.labels });
}
}
function updateLabel(label) {
if (label.value !== label.originalValue || label.key !== label.originalKey) {
ctrl.onChangedLabels({ labels: ctrl.labels });
}
}
},
]);