diff --git a/initdb.py b/initdb.py index 36ce9f672..c473f073e 100644 --- a/initdb.py +++ b/initdb.py @@ -510,6 +510,7 @@ def populate_database(minimal=False, with_storage=False): first_label = model.label.create_manifest_label(tag_manifest, 'foo', 'bar', 'manifest') model.label.create_manifest_label(tag_manifest, 'foo', 'baz', 'api') model.label.create_manifest_label(tag_manifest, 'anotherlabel', '1234', 'internal') + model.label.create_manifest_label(tag_manifest, 'jsonlabel', '{"hey": "there"}', 'internal') label_metadata = { 'key': 'foo', diff --git a/static/css/directives/repo-view/repo-panel-tags.css b/static/css/directives/repo-view/repo-panel-tags.css index 446c35d85..2cb46c156 100644 --- a/static/css/directives/repo-view/repo-panel-tags.css +++ b/static/css/directives/repo-view/repo-panel-tags.css @@ -127,11 +127,12 @@ color: black; } -.arepo-panel-tags-element .tag-span { - overflow: hidden; - text-overflow: ellipsis; - max-width: 250px; - display: inline-block; +.repo-panel-tags-element tr.expanded-view td { + border-bottom: 0px; +} + +.repo-panel-tags-element .labels-col { + padding-top: 0px; } @media (max-width: 1000px) { diff --git a/static/css/directives/ui/label-list.css b/static/css/directives/ui/label-list.css new file mode 100644 index 000000000..53f874146 --- /dev/null +++ b/static/css/directives/ui/label-list.css @@ -0,0 +1,9 @@ +.label-list-element .label-view { + margin-right: 6px; + margin-bottom: 4px; +} + +.label-list-element .empty-list { + font-size: 12px; + color: #ccc; +} \ No newline at end of file diff --git a/static/css/directives/ui/label-view.css b/static/css/directives/ui/label-view.css new file mode 100644 index 000000000..c9c3a5cff --- /dev/null +++ b/static/css/directives/ui/label-view.css @@ -0,0 +1,25 @@ +.label-view-element { + display: inline-block; + padding: 1px; + border-radius: 9px; + background-color: #eee; + padding-left: 8px; + padding-right: 8px; + font-size: 12px; + cursor: default; +} + +.label-view-element .kind { + text-transform: uppercase; + font-size: 8px; + color: #aaa; + margin-right: 2px; + position: relative; + top: -1px; +} + +.label-view-element .value { + max-width: 100px; + overflow: hidden; + text-overflow: ellipsis; +} diff --git a/static/css/directives/ui/manifest-label-list.css b/static/css/directives/ui/manifest-label-list.css new file mode 100644 index 000000000..840f1b737 --- /dev/null +++ b/static/css/directives/ui/manifest-label-list.css @@ -0,0 +1,8 @@ +.manifest-label-list-element { + padding-left: 6px; +} + +.manifest-label-list-element .none { + font-size: 12px; + color: #ccc; +} \ No newline at end of file diff --git a/static/directives/label-list.html b/static/directives/label-list.html new file mode 100644 index 000000000..8f2d82f3e --- /dev/null +++ b/static/directives/label-list.html @@ -0,0 +1,10 @@ +
+
+
+
+ No labels found +
+
\ No newline at end of file diff --git a/static/directives/label-view.html b/static/directives/label-view.html new file mode 100644 index 000000000..b6f6da5ba --- /dev/null +++ b/static/directives/label-view.html @@ -0,0 +1,8 @@ + + {{ getKind(label) }} + + {{ label.key }} + = + {{ label.value }} + + \ No newline at end of file diff --git a/static/directives/manifest-label-list.html b/static/directives/manifest-label-list.html new file mode 100644 index 000000000..64d63af1a --- /dev/null +++ b/static/directives/manifest-label-list.html @@ -0,0 +1,11 @@ +
+
+
+ This tag does not have an associated manifest +
+
+ Could not load labels for this manifest +
+
+
\ No newline at end of file diff --git a/static/directives/repo-view/repo-panel-tags.html b/static/directives/repo-view/repo-panel-tags.html index 8bb75e848..edba94c3c 100644 --- a/static/directives/repo-view/repo-panel-tags.html +++ b/static/directives/repo-view/repo-panel-tags.html @@ -1,4 +1,17 @@
+
+
+ + +
+
+

Tags

One or more of your tags has an extremely critical vulnerability which should be addressed immediately: @@ -103,129 +116,147 @@ - - - - - - - - Unknown - - - - - - Could not load security information - - - - - - - Queued + + + + + + - - - Unknown + + + + - - Unable to scan - - - - - Unsupported + Could not load security information - - - - - Passed - - + + + + + Queued + - - + + + + Unable to scan + - - - + + + + Unsupported + - - - {{ getTagVulnerabilities(tag).featuresInfo.brokenFeaturesCount }} vulnerable packages - - - {{ getTagVulnerabilities(tag).featuresInfo.fixableFeatureCount }} fixable packages - - - - - - - - - - - - - + + + + + Passed + + + + + + + + + + + + + {{ getTagVulnerabilities(tag).featuresInfo.brokenFeaturesCount }} vulnerable packages + + + {{ getTagVulnerabilities(tag).featuresInfo.fixableFeatureCount }} fixable packages + + - - - - - - - - - - - - - - - - Add New Tag + + + + + + + + + + - - Delete Tag + + + + + + + + + + + + + + + + Add New Tag + + + Delete Tag + - - - - + + + + + + +
+ + + + + + + + +
diff --git a/static/js/directives/repo-view/repo-panel-tags.js b/static/js/directives/repo-view/repo-panel-tags.js index 105eafebe..82f877e9c 100644 --- a/static/js/directives/repo-view/repo-panel-tags.js +++ b/static/js/directives/repo-view/repo-panel-tags.js @@ -35,6 +35,8 @@ angular.module('quay').directive('repoPanelTags', function () { $scope.tagActionHandler = null; $scope.tagsPerPage = 25; + $scope.expandedView = false; + $scope.imageVulnerabilities = {}; $scope.defcon1 = {}; $scope.hasDefcon1 = false; @@ -262,6 +264,26 @@ angular.module('quay').directive('repoPanelTags', function () { $scope.checkedTags.setChecked($scope.tags); }; + $scope.trackLineExpandedClass = function(index, track_info) { + var startIndex = $.inArray(track_info.tags[0], $scope.tags); + var endIndex = $.inArray(track_info.tags[track_info.tags.length - 1], $scope.tags); + index += $scope.options.page * $scope.tagsPerPage; + + if (index < startIndex) { + return 'before'; + } + + if (index > endIndex) { + return 'after'; + } + + if (index >= startIndex && index < endIndex) { + return 'middle'; + } + + return ''; + }; + $scope.trackLineClass = function(index, track_info) { var startIndex = $.inArray(track_info.tags[0], $scope.tags); var endIndex = $.inArray(track_info.tags[track_info.tags.length - 1], $scope.tags); @@ -359,6 +381,10 @@ angular.module('quay').directive('repoPanelTags', function () { $scope.setTab('history'); }; + $scope.setExpanded = function(expanded) { + $scope.expandedView = expanded; + }; + $scope.getTagNames = function(checked) { var names = checked.map(function(tag) { return tag.name; diff --git a/static/js/directives/ui/label-list.js b/static/js/directives/ui/label-list.js new file mode 100644 index 000000000..f8f7fae21 --- /dev/null +++ b/static/js/directives/ui/label-list.js @@ -0,0 +1,15 @@ +/** + * An element which displays labels. + */ +angular.module('quay').directive('labelList', function () { + return { + templateUrl: '/static/directives/label-list.html', + restrict: 'C', + replace: true, + scope: { + expand: '@expand', + labels: '=labels' + }, + controller: function($scope) {} + }; +}); diff --git a/static/js/directives/ui/label-view.js b/static/js/directives/ui/label-view.js new file mode 100644 index 000000000..49b8d8cee --- /dev/null +++ b/static/js/directives/ui/label-view.js @@ -0,0 +1,32 @@ +/** + * 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: '
' + $sanitize($scope.label.value) + '
' + }); + }; + } + }; +}); diff --git a/static/js/directives/ui/manifest-label-list.js b/static/js/directives/ui/manifest-label-list.js new file mode 100644 index 000000000..8cd5f1d11 --- /dev/null +++ b/static/js/directives/ui/manifest-label-list.js @@ -0,0 +1,47 @@ +/** + * An element which displays the labels on a repository manifest. + */ +angular.module('quay').directive('manifestLabelList', function () { + var directiveDefinitionObject = { + priority: 0, + templateUrl: '/static/directives/manifest-label-list.html', + replace: false, + transclude: true, + restrict: 'C', + scope: { + 'repository': '=repository', + 'manifestDigest': '=manifestDigest', + }, + controller: function($scope, $element, ApiService) { + $scope.labels = null; + + var loadLabels = function() { + if (!$scope.repository) { + return; + } + + if (!$scope.manifestDigest) { + return; + } + + $scope.labels = null; + $scope.loadError = false; + + var params = { + 'repository': $scope.repository.namespace + '/' + $scope.repository.name, + 'manifestref': $scope.manifestDigest + }; + + ApiService.listManifestLabels(null, params).then(function(resp) { + $scope.labels = resp['labels']; + }, function() { + $scope.loadError = true; + }); + }; + + $scope.$watch('repository', loadLabels); + $scope.$watch('manifestDigest', loadLabels); + } + }; + return directiveDefinitionObject; +}); \ No newline at end of file