From 262634555a04b9dfe4665982b0fe08976ac10cce Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 18 Oct 2013 17:59:26 -0400 Subject: [PATCH] Work in progress: Show the diff information in the UI --- static/css/quay.css | 67 ++++++++++++++++++++++++++++++++++ static/js/controllers.js | 23 ++++++++++++ static/partials/view-repo.html | 55 +++++++++++++++++++++++++--- 3 files changed, 139 insertions(+), 6 deletions(-) diff --git a/static/css/quay.css b/static/css/quay.css index be51c55e1..44bd80a98 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -486,6 +486,11 @@ p.editable:hover i { margin-left: 80px; } +.repo dl.dl-normal dd { + padding-left: 14px; + margin-bottom: 10px; +} + .repo .header h3 { display: inline-block; } @@ -660,6 +665,68 @@ p.editable:hover i { margin: 0px; } +.repo .changes-container:before { + content: "File Changes: "; + display: inline-block; + margin-right: 10px; + font-weight: bold; + float: left; + padding-top: 4px; +} + +.repo .changes-count-container { + text-align: center; +} + +.repo .change-count { + font-size: 18px; + display: inline-block; + margin-right: 10px; +} + +.repo .changes-container .added i { + color: rgb(73, 209, 73); +} + +.repo .change-container .removed i { + color: rgb(209, 73, 73); +} + +.repo .changes-container .changed i { + color: rgb(73, 100, 209); +} + +.repo .change-count:last-child { + margin-right: 0px; +} + +.repo .change-count i { + font-size: 20px; + vertical-align: middle; +} + +.repo .change i { + float: right; + vertical-align: middle; + margin-left: 4px; +} + +.repo .more-changes { + padding: 6px; +} + +.repo #collapseChanges .well { + margin-top: 10px; + margin-bottom: 0px; +} + +.repo #collapseChanges .change { + overflow: hidden; + font-size: 14px; + text-overflow: ellipsis; + white-space: nowrap; +} + .navbar-nav > li > .user-dropdown { padding-top: 9px; padding-bottom: 9px; diff --git a/static/js/controllers.js b/static/js/controllers.js index 7a6e8bd4b..100e64e98 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -360,8 +360,30 @@ function RepoCtrl($scope, Restangular, $routeParams, $rootScope, $location, $tim }); }; + $scope.loadImageChanges = function(image) { + $scope.currentImageChanges = null; + + var changesFetch = Restangular.one('repository/' + namespace + '/' + name + '/image/' + image.id + '/changes'); + changesFetch.get().then(function(changeInfo) { + $scope.currentImageChanges = changeInfo; + }, function() { + $scope.currentImageChanges = {}; + }); + }; + + $scope.getMoreCount = function(changes) { + if (!changes) { return 0; } + var addedDisplayed = Math.min(15, changes.added.length); + var removedDisplayed = Math.min(15, changes.removed.length); + var changedDisplayed = Math.min(15, changes.changed.length); + + return (changes.added.length + changes.removed.length + changes.changed.length) - + addedDisplayed - removedDisplayed - changedDisplayed; + }; + $scope.setImage = function(image) { $scope.currentImage = image; + $scope.loadImageChanges(image); if ($scope.tree) { $scope.tree.setImage($scope.currentImage.id); } @@ -382,6 +404,7 @@ function RepoCtrl($scope, Restangular, $routeParams, $rootScope, $location, $tim if (proposedTag) { $scope.currentTag = proposedTag; $scope.currentImage = $scope.currentTag.image; + $scope.loadImageChanges($scope.currentImage); if ($scope.tree) { $scope.tree.setTag($scope.currentTag.name); } diff --git a/static/partials/view-repo.html b/static/partials/view-repo.html index 275ba5cd4..6befa64a7 100644 --- a/static/partials/view-repo.html +++ b/static/partials/view-repo.html @@ -107,15 +107,58 @@
-
+
+
+
+
+ +
Created
-
+
+
Image ID
+
{{ currentImage.id }}
-
- Description: -
-
+ +
+ +
+ +
+
+ + + {{currentImageChanges.added.length}} + + + + {{currentImageChanges.removed.length}} + + + + {{currentImageChanges.changed.length}} + +
+ +
+
+
+ + {{file}} +
+
+ + {{file}} +
+
+ + {{file}} +
+
+ +