From 6f69c36f312efe9c2e2367aafce451d1e5d3152a Mon Sep 17 00:00:00 2001 From: xudan Date: Thu, 29 Aug 2019 03:39:06 -0400 Subject: Update portal to get portal_key_file from results.json Change-Id: I210a9c240b720e3367134112ad2cdb5c3fdeffe0 Signed-off-by: xudan --- .../results-report/resultsReportController.js | 62 ++++++++++++++++------ 1 file changed, 46 insertions(+), 16 deletions(-) (limited to '3rd_party/static/onap-ui') diff --git a/3rd_party/static/onap-ui/components/results-report/resultsReportController.js b/3rd_party/static/onap-ui/components/results-report/resultsReportController.js index 09601ad..1997c3d 100644 --- a/3rd_party/static/onap-ui/components/results-report/resultsReportController.js +++ b/3rd_party/static/onap-ui/components/results-report/resultsReportController.js @@ -78,24 +78,54 @@ } function gotoResultLog(case_name) { - var case_area = case_name.split(".")[0]; - var log_url = "/logs/" + ctrl.testId + "/results/"; - log_url += case_area + "_logs/" + case_name + ".out"; - var is_reachable = false; - - $.ajax({ - url: log_url, - async: false, - success: function (response) { - is_reachable = true; - }, - error: function (response) { - alert("Log file could not be found. Please confirm this case has been executed successfully."); + function openFile(log_url) { + var is_reachable = false; + + $.ajax({ + url: log_url, + async: false, + success: function (response) { + is_reachable = true; + }, + error: function (response) { + alert("Log file could not be found. Please confirm this case has been executed successfully."); + } + }); + + if (is_reachable == true) { + window.open(log_url); } - }); + } - if (is_reachable == true) { - window.open(log_url); + var log_url = "/logs/" + ctrl.testId + "/results/"; + if (ctrl.version == '2019.04') { + var case_area = case_name.split(".")[0]; + log_url += case_area + "_logs/" + case_name + ".out"; + openFile(log_url); + } else { + var test_url = testapiApiUrl + '/onap/tests/' + ctrl.innerId; + $http.get(test_url).then(function(test_resp){ + var result_url = testapiApiUrl + '/results/' + test_resp.data.results[0]; + $http.get(result_url).then(function(result_resp){ + var keepGoing = true; + angular.forEach(result_resp.data.testcases_list, function(testcase, index) { + if (keepGoing == true) { + if (testcase.name == case_name) { + log_url += testcase.portal_key_file; + openFile(log_url); + keepGoing = false; + } + } + }); + if (keepGoing == true) { + alert("Log file could not be found. Please confirm this case has been executed successfully."); + } + }, function(result_error) { + alert('Error when get result record'); + }); + }, function(test_error) { + alert('Error when get test record'); + }); } } -- cgit 1.2.3-korg