html/assets/compare/machinery-compare.js in machinery-tool-1.9.1 vs html/assets/compare/machinery-compare.js in machinery-tool-1.10.0

- old
+ new

@@ -20,17 +20,60 @@ .directive("inBoth", function() { return { template: "<h3>In both descriptions:</h3>" }; }) + .directive("changed", function() { + return { + template: "<h3>In both with different attributes:</h3>" + }; + }) .directive("renderTemplate", function() { return { restrict: "E", scope: { object: "=object" }, link: function(scope, element, attrs) { scope.templateUrl = attrs.template; }, template: '<div ng-include="templateUrl"></div>' + }; + }); + + +// Scope specific directives +angular.module("machinery-compare") + .directive("changedPackages", function() { + return { + restrict: "E", + scope: { + object: "=object" + }, + link: function(scope, element, attrs) { + var elements = []; + + angular.forEach(scope.object, function(value) { + var changes = []; + var relevant_attributes = ["version", "vendor", "arch"]; + + if(value[0].version == value[1].version) { + relevant_attributes.push("release"); + if(value[0].version == value[1].version) { + relevant_attributes.push("checksum"); + } + } + + angular.forEach(relevant_attributes, function(attribute) { + if(value[0][attribute] != value[1][attribute]) { + changes.push(attribute + ": " + value[0][attribute] + " ↔ " + value[1][attribute]); + } + }); + + elements.push(value[0].name + " (" + changes.join(", ") + ")"); + }); + + scope.changed_elements = elements; + }, + templateUrl: "scope_packages_changed_partial" }; });