initial import for Open Source 🎉

This commit is contained in:
Jimmy Zelinskie 2019-11-12 11:09:47 -05:00
parent 1898c361f3
commit 9c0dd3b722
2048 changed files with 218743 additions and 0 deletions

View file

@ -0,0 +1,43 @@
/**
* An element which allows for editing labels.
*/
angular.module('quay').directive('labelInput', function () {
return {
templateUrl: '/static/directives/label-input.html',
restrict: 'C',
replace: true,
scope: {
'labels': '<labels',
'updatedLabels': '=?updatedLabels',
},
controller: function($scope) {
$scope.tags = [];
$scope.$watch('tags', function(tags) {
if (!tags) { return; }
$scope.updatedLabels = tags.filter(function(tag) {
parts = tag['keyValue'].split('=', 2);
return tag['label'] ? tag['label'] : {
'key': parts[0],
'value': parts[1],
'is_new': true
};
});
}, true);
$scope.$watch('labels', function(labels) {
$scope.filteredLabels = labels.filter(function(label) {
return label['source_type'] == 'api';
});
$scope.tags = $scope.filteredLabels.map(function(label) {
return {
'id': label['id'],
'keyValue': label['key'] + '=' + label['value'],
'label': label
};
});
});
}
};
});