Fixing hard-coded path

There are two places in angular launch-instance where it should have
used bathBase to build up a path rather than using hard-coded absolute
path (url). This bad practice keeps causing issues during refactoring.
This patch fixes the issue.

Change-Id: I02e945c4f4793fe435a2f0942787928285c458b0
This commit is contained in:
Shaoquan Chen 2015-07-04 19:05:31 -07:00
parent d8ce4041fb
commit 02ce088fd3
4 changed files with 19 additions and 17 deletions
openstack_dashboard/static/dashboard/launch-instance

@ -25,10 +25,11 @@
.controller('LaunchInstanceSecurityGroupsController', LaunchInstanceSecurityGroupsController);
LaunchInstanceSecurityGroupsController.$inject = [
'launchInstanceModel'
'launchInstanceModel',
'dashboardBasePath'
];
function LaunchInstanceSecurityGroupsController(launchInstanceModel) {
function LaunchInstanceSecurityGroupsController(launchInstanceModel, basePath) {
var vm = this;
vm.label = {
@ -54,8 +55,7 @@
displayedAllocated: []
};
vm.tableDetails =
'/static/dashboard/launch-instance/security-groups/security-group-details.html';
vm.tableDetails = basePath + 'launch-instance/security-groups/security-group-details.html';
vm.tableHelp = {
/*eslint-disable max-len */

@ -31,7 +31,7 @@
securityGroups: [ 'group 1', 'group 2' ]
};
ctrl = $controller('LaunchInstanceSecurityGroupsController',
{ launchInstanceModel: model });
{ launchInstanceModel: model, dashboardBasePath: '' });
}));
it('contains its general labels', function() {

@ -31,15 +31,16 @@
.controller('LaunchInstanceSourceController', LaunchInstanceSourceController);
LaunchInstanceSourceController.$inject = [
'$scope',
'hz.dashboard.launch-instance.boot-source-types',
'bytesFilter',
'horizon.framework.widgets.charts.donutChartSettings',
'dateFilter',
'decodeFilter',
'diskFormatFilter',
'gbFilter',
'horizon.framework.widgets.charts.quotaChartDefaults'
'$scope',
'hz.dashboard.launch-instance.boot-source-types',
'bytesFilter',
'horizon.framework.widgets.charts.donutChartSettings',
'dateFilter',
'decodeFilter',
'diskFormatFilter',
'gbFilter',
'horizon.framework.widgets.charts.quotaChartDefaults',
'dashboardBasePath'
];
function LaunchInstanceSourceController($scope,
@ -50,7 +51,8 @@
decodeFilter,
diskFormatFilter,
gbFilter,
quotaChartDefaults) {
quotaChartDefaults,
basePath) {
var ctrl = this;
ctrl.label = {
@ -111,8 +113,7 @@
ctrl.tableData = {};
ctrl.helpText = {};
ctrl.maxInstanceCount = 1;
ctrl.sourceDetails =
'/static/dashboard/launch-instance/source/source-details.html';
ctrl.sourceDetails = basePath + 'launch-instance/source/source-details.html';
var selection = ctrl.selection = $scope.model.newInstanceSpec.source;

@ -32,6 +32,7 @@
$provide.value('decodeFilter', noop);
$provide.value('gbFilter', noop);
$provide.value('horizon.framework.widgets.charts.quotaChartDefaults', noop);
$provide.value('dashboardBasePath', '');
}));
beforeEach(inject(function($controller, $rootScope, _$browser_, $q) {