diff options
Diffstat (limited to '3rd_party/static/onap-ui')
-rw-r--r-- | 3rd_party/static/onap-ui/components/results-report/resultsReportController.js | 62 |
1 files changed, 46 insertions, 16 deletions
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'); + }); } } |