Fix user-displayed test list URL

The url given to the user is a relative url and not an
absolute url. If a user copy-pastes the wget command, the download
will not work as they will need an absolute url to the API. This
patch provides that absolute url.

Change-Id: I85178011d1e235dd32b5f6d74cb81183493fb542
This commit is contained in:
Paul Van Eck 2016-04-20 15:01:13 -07:00
parent d0f0d640ca
commit 3b61143bb1

View File

@ -218,7 +218,7 @@
.controller('TestListModalController', TestListModalController);
TestListModalController.$inject = [
'$uibModalInstance', '$window', '$http', 'version',
'$uibModalInstance', '$http', 'version',
'target', 'status', 'refstackApiUrl'
];
@ -228,7 +228,7 @@
* test list corresponding to DefCore capabilities with the selected
* statuses.
*/
function TestListModalController($uibModalInstance, $window, $http, version,
function TestListModalController($uibModalInstance, $http, version,
target, status, refstackApiUrl) {
var ctrl = this;
@ -236,13 +236,21 @@
ctrl.version = version;
ctrl.target = target;
ctrl.status = status;
ctrl.url = refstackApiUrl;
ctrl.close = close;
ctrl.updateTestListString = updateTestListString;
ctrl.aliases = true;
ctrl.flagged = false;
// Check if the API URL is absolute or relative.
if (refstackApiUrl.indexOf('http') > -1) {
ctrl.url = refstackApiUrl;
}
else {
ctrl.url = location.protocol + '//' + location.host +
refstackApiUrl;
}
/**
* This function will close/dismiss the modal.
*/