From 714d6a98bf40db54d019c2489dff281a474f3bc0 Mon Sep 17 00:00:00 2001 From: Joe Fiorini Date: Thu, 2 Jul 2015 16:10:08 -0400 Subject: [PATCH] [system_tracking] Disable single result view for host-to-host compares --- .../system-tracking.controller.js | 112 +++++++++--------- 1 file changed, 58 insertions(+), 54 deletions(-) diff --git a/awx/ui/static/js/system-tracking/system-tracking.controller.js b/awx/ui/static/js/system-tracking/system-tracking.controller.js index 29bc7e40f6..689b274622 100644 --- a/awx/ui/static/js/system-tracking/system-tracking.controller.js +++ b/awx/ui/static/js/system-tracking/system-tracking.controller.js @@ -177,71 +177,75 @@ function controller($rootScope, $scope.error = null; if (_.isEmpty(info.factData)) { - // info = _.reject({ - // name: 'NoScanDifferences', - // message: 'No differences in the scans on the dates you selected. Please try selecting different dates.', - // dateValues: - // { leftDate: $scope.leftDate.clone(), - // rightDate: $scope.rightDate.clone() - // } - // }); - $scope.singleFactOnly = true; - $scope.factData = info.leftData.map(function(fact) { - var keyNameMap = activeModule.keyNameMap; - var nameKey = activeModule.nameKey; - var renderOptions = _.merge({}, activeModule); - var isNestedDisplay = false; - var facts; - if (_.isObject(renderOptions.factTemplate) && - _.isArray(renderOptions.compareKey)) { + if ($scope.compareMode === 'host-to-host') { + info = _.reject({ + name: 'NoScanDifferences', + message: 'No differences in the scans on the dates you selected. Please try selecting different dates.', + dateValues: + { leftDate: $scope.leftDate.clone(), + rightDate: $scope.rightDate.clone() + } + }); + } else { + $scope.singleFactOnly = true; + $scope.factData = info.leftData.map(function(fact) { + var keyNameMap = activeModule.keyNameMap; + var nameKey = activeModule.nameKey; + var renderOptions = _.merge({}, activeModule); + var isNestedDisplay = false; + var facts; - isNestedDisplay = true; + if (_.isObject(renderOptions.factTemplate) && + _.isArray(renderOptions.compareKey)) { - var templates = _.mapValues(renderOptions.factTemplate, function(template, key) { - if (template === true) { - return { render: function(fact) { - return fact[key]; - } + isNestedDisplay = true; + + var templates = _.mapValues(renderOptions.factTemplate, function(template, key) { + if (template === true) { + return { render: function(fact) { + return fact[key]; + } + }; + } else { + return new FactTemplate(template); + } + }); + + facts = _.map(templates, function(template, key) { + var keyName = key; + + if (_.isObject(keyNameMap) && keyNameMap.hasOwnProperty(key)) { + keyName = keyNameMap[key]; + } + + renderOptions.factTemplate = template; + var formattedValue = formatFactForDisplay(fact, renderOptions); + return { keyName: keyName, + isNestedDisplay: true, + value1: formattedValue }; - } else { - return new FactTemplate(template); - } - }); + }); - facts = _.map(templates, function(template, key) { - var keyName = key; - if (_.isObject(keyNameMap) && keyNameMap.hasOwnProperty(key)) { - keyName = keyNameMap[key]; - } - - renderOptions.factTemplate = template; + } else { + renderOptions.factTemplate = new FactTemplate(renderOptions.factTemplate); var formattedValue = formatFactForDisplay(fact, renderOptions); - return { keyName: keyName, - isNestedDisplay: true, + isNestedDisplay = false; + facts = { keyName: fact[nameKey], value1: formattedValue }; - }); + } + $scope.isNestedDisplay = isNestedDisplay; - } else { - renderOptions.factTemplate = new FactTemplate(renderOptions.factTemplate); - var formattedValue = formatFactForDisplay(fact, renderOptions); - isNestedDisplay = false; - facts = { keyName: fact[nameKey], - value1: formattedValue - }; - } - - $scope.isNestedDisplay = isNestedDisplay; - - return { displayKeyPath: fact[renderOptions.nameKey], - nestingLevel: 0, - containsValueArray: false, - facts: facts - }; - }); + return { displayKeyPath: fact[renderOptions.nameKey], + nestingLevel: 0, + containsValueArray: false, + facts: facts + }; + }); + } } else { $scope.singleFactOnly = false; $scope.factData = info.factData;