This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/static/js/directives/ui/label-view.js

32 lines
784 B
JavaScript

/**
* An element which displays a single label.
*/
angular.module('quay').directive('labelView', function () {
return {
templateUrl: '/static/directives/label-view.html',
restrict: 'C',
replace: true,
scope: {
expand: '@expand',
label: '<label'
},
controller: function($scope, $sanitize) {
$scope.getKind = function(label) {
switch (label.media_type) {
case 'application/json':
return 'json';
}
return '';
};
$scope.viewLabelValue = function() {
bootbox.alert({
size: "small",
title: $scope.label.key,
message: '<pre>' + $sanitize($scope.label.value.replace('<', '&lt;').replace('>', '&gt;')) + '</pre>'
});
};
}
};
});