Merge "Backport the WEBROOT fixes for JS and CSS into Kilo" into stable/kilo
This commit is contained in:
commit
1d10078edb
|
@ -1,22 +1,28 @@
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('hz.widgets', [
|
angular
|
||||||
'hz.widget.form',
|
.module('hz.widgets', [
|
||||||
'hz.widget.help-panel',
|
'hz.widget.form',
|
||||||
'hz.widget.wizard',
|
'hz.widget.help-panel',
|
||||||
'hz.widget.table',
|
'hz.widget.wizard',
|
||||||
'hz.widget.modal',
|
'hz.widget.table',
|
||||||
'hz.widget.modal-wait-spinner',
|
'hz.widget.modal',
|
||||||
'hz.framework.bind-scope',
|
'hz.widget.modal-wait-spinner',
|
||||||
'hz.framework.workflow',
|
'hz.framework.bind-scope',
|
||||||
'hz.widget.transfer-table',
|
'hz.framework.workflow',
|
||||||
'hz.widget.charts',
|
'hz.widget.transfer-table',
|
||||||
'hz.widget.action-list',
|
'hz.widget.charts',
|
||||||
'hz.widget.metadata-tree',
|
'hz.widget.action-list',
|
||||||
'hz.widget.metadata-display',
|
'hz.widget.metadata-tree',
|
||||||
'hz.framework.validators'
|
'hz.widget.metadata-display',
|
||||||
])
|
'hz.framework.validators'
|
||||||
.constant('basePath', '/static/angular/');
|
])
|
||||||
|
.config(config);
|
||||||
|
|
||||||
|
function config($provide, $windowProvider) {
|
||||||
|
var path = $windowProvider.$get().STATIC_URL + 'angular/';
|
||||||
|
$provide.constant('basePath', path);
|
||||||
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||||
/*global angular*/
|
/*global angular*/
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
function ApiService($http, $log) {
|
function ApiService($http, $log, webroot) {
|
||||||
|
|
||||||
var httpCall = function (method, url, data, config) {
|
var httpCall = function (method, url, data, config) {
|
||||||
if (!angular.isDefined(config)) {
|
if (!angular.isDefined(config)) {
|
||||||
|
@ -24,7 +24,7 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
// url and method are always provided
|
// url and method are always provided
|
||||||
config.method = method;
|
config.method = method;
|
||||||
config.url = url;
|
config.url = webroot + url;
|
||||||
if (angular.isDefined(data)) {
|
if (angular.isDefined(data)) {
|
||||||
config.data = data;
|
config.data = data;
|
||||||
}
|
}
|
||||||
|
@ -56,5 +56,10 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
|
|
||||||
angular.module('hz.api.service', [])
|
angular.module('hz.api.service', [])
|
||||||
.service('apiService', ['$http', '$log', ApiService]);
|
.config(config)
|
||||||
|
.service('apiService', ['$http', '$log', 'webroot', ApiService]);
|
||||||
|
|
||||||
|
function config($provide, $windowProvider) {
|
||||||
|
$provide.constant('webroot', $windowProvider.$get().WEBROOT);
|
||||||
|
}
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -247,7 +247,7 @@ if ($(container).length){
|
||||||
var width = $(container).width(),
|
var width = $(container).width(),
|
||||||
height = 500,
|
height = 500,
|
||||||
stack_id = $("#stack_id").data("stack_id"),
|
stack_id = $("#stack_id").data("stack_id"),
|
||||||
ajax_url = '/project/stacks/get_d3_data/' + stack_id + '/',
|
ajax_url = WEBROOT + 'project/stacks/get_d3_data/' + stack_id + '/',
|
||||||
graph = $("#d3_data").data("d3_data"),
|
graph = $("#d3_data").data("d3_data"),
|
||||||
force = d3.layout.force()
|
force = d3.layout.force()
|
||||||
.nodes(graph.nodes)
|
.nodes(graph.nodes)
|
||||||
|
|
|
@ -9,7 +9,10 @@
|
||||||
|
|
||||||
{% comment %} Compress jQuery, Angular, Plugins, Bootstrap, Hogan.js and Horizon-specific JS. {% endcomment %}
|
{% comment %} Compress jQuery, Angular, Plugins, Bootstrap, Hogan.js and Horizon-specific JS. {% endcomment %}
|
||||||
{% compress js %}
|
{% compress js %}
|
||||||
<script type="text/javascript">var STATIC_URL = "{{ STATIC_URL }}";</script>
|
<script type="text/javascript">
|
||||||
|
var STATIC_URL = "{{ STATIC_URL }}";
|
||||||
|
var WEBROOT = "{{ WEBROOT }}";
|
||||||
|
</script>
|
||||||
<script src='{{ STATIC_URL }}horizon/lib/angular/angular-cookies.js'></script>
|
<script src='{{ STATIC_URL }}horizon/lib/angular/angular-cookies.js'></script>
|
||||||
<script src='{{ STATIC_URL }}horizon/lib/angular/angular-sanitize.js'></script>
|
<script src='{{ STATIC_URL }}horizon/lib/angular/angular-sanitize.js'></script>
|
||||||
<script src="{{ STATIC_URL }}horizon/lib/angular/lrdragndrop.js"></script>
|
<script src="{{ STATIC_URL }}horizon/lib/angular/lrdragndrop.js"></script>
|
||||||
|
|
|
@ -53,4 +53,7 @@ def openstack(request):
|
||||||
region in available_regions]}
|
region in available_regions]}
|
||||||
context['regions'] = regions
|
context['regions'] = regions
|
||||||
|
|
||||||
|
# Adding webroot access
|
||||||
|
context['WEBROOT'] = getattr(settings, "WEBROOT", "/")
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
|
@ -60,22 +60,20 @@ class LaunchImage(tables.LinkAction):
|
||||||
class LaunchImageNG(LaunchImage):
|
class LaunchImageNG(LaunchImage):
|
||||||
name = "launch_image_ng"
|
name = "launch_image_ng"
|
||||||
verbose_name = _("Launch")
|
verbose_name = _("Launch")
|
||||||
|
url = "horizon:project:images:index"
|
||||||
classes = ("btn-launch")
|
classes = ("btn-launch")
|
||||||
ajax = False
|
ajax = False
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self, attrs=None, **kwargs):
|
||||||
attrs={
|
|
||||||
"ng-controller": "LaunchInstanceModalCtrl"
|
|
||||||
},
|
|
||||||
**kwargs):
|
|
||||||
kwargs['preempt'] = True
|
kwargs['preempt'] = True
|
||||||
super(LaunchImage, self).__init__(attrs, **kwargs)
|
super(LaunchImage, self).__init__(attrs, **kwargs)
|
||||||
|
|
||||||
def get_link_url(self, datum):
|
def get_link_url(self, datum):
|
||||||
imageId = self.table.get_object_id(datum)
|
imageId = self.table.get_object_id(datum)
|
||||||
clickValue = "openLaunchInstanceWizard({successUrl: " +\
|
url = reverse(self.url)
|
||||||
"'/project/images/', imageId: '%s'})" % (imageId)
|
ngclick = "openLaunchInstanceWizard({successUrl: '%s', imageId: '%s'})"
|
||||||
self.attrs['ng-click'] = clickValue
|
self.attrs.update({"ng-controller": "LaunchInstanceModalCtrl",
|
||||||
|
"ng-click": ngclick % (url, imageId)})
|
||||||
return "javascript:void(0);"
|
return "javascript:void(0);"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -349,19 +349,17 @@ class LaunchLink(tables.LinkAction):
|
||||||
|
|
||||||
class LaunchLinkNG(LaunchLink):
|
class LaunchLinkNG(LaunchLink):
|
||||||
name = "launch-ng"
|
name = "launch-ng"
|
||||||
|
url = "horizon:project:instances:index"
|
||||||
verbose_name = _("Launch Instance NG")
|
verbose_name = _("Launch Instance NG")
|
||||||
ajax = False
|
ajax = False
|
||||||
classes = ("btn-launch")
|
classes = ("btn-launch")
|
||||||
|
|
||||||
def __init__(self,
|
def get_default_attrs(self):
|
||||||
attrs={
|
url = urlresolvers.reverse(self.url)
|
||||||
"ng-controller": "LaunchInstanceModalCtrl",
|
ngclick = "openLaunchInstanceWizard({ successUrl: '%s' })" % url
|
||||||
"ng-click": "openLaunchInstanceWizard(" +
|
self.attrs.update({'ng-controller': 'LaunchInstanceModalCtrl',
|
||||||
"{successUrl: '/project/instances/'})"
|
'ng-click': ngclick})
|
||||||
},
|
return super(LaunchLinkNG, self).get_default_attrs()
|
||||||
**kwargs):
|
|
||||||
kwargs['preempt'] = True
|
|
||||||
super(LaunchLink, self).__init__(attrs, **kwargs)
|
|
||||||
|
|
||||||
def get_link_url(self, datum=None):
|
def get_link_url(self, datum=None):
|
||||||
return "javascript:void(0);"
|
return "javascript:void(0);"
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
<div class="launchButtons">
|
<div class="launchButtons">
|
||||||
{% if launch_instance_allowed %}
|
{% if launch_instance_allowed %}
|
||||||
{% if show_ng_launch %}
|
{% if show_ng_launch %}
|
||||||
<a ng-controller="LaunchInstanceModalCtrl" ng-click="openLaunchInstanceWizard({successUrl: '/project/network_topology/', dismissUrl: '/project/network_topology/'})" id="instances__action_launch" class="btn btn-default btn-sm btn-launch ajax-modal {% if instance_quota_exceeded %}disabled{% endif %}"><span class="fa fa-cloud-upload"></span> {% if instance_quota_exceeded %}{% trans "Launch Instance (Quota exceeded)"%}{% else %}{% trans "Launch Instance"%}{% endif %}</a>
|
{% url 'horizon:project:network_topology:index' as networkUrl %}
|
||||||
|
<a ng-controller="LaunchInstanceModalCtrl" ng-click="openLaunchInstanceWizard({successUrl: '{{networkUrl}}', dismissUrl: '{{networkUrl}}'})" id="instances__action_launch" class="btn btn-default btn-sm btn-launch ajax-modal {% if instance_quota_exceeded %}disabled{% endif %}"><span class="fa fa-cloud-upload"></span> {% if instance_quota_exceeded %}{% trans "Launch Instance (Quota exceeded)"%}{% else %}{% trans "Launch Instance"%}{% endif %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{% url 'horizon:project:network_topology:launchinstance' %}" id="instances__action_launch" class="btn btn-default btn-sm btn-launch ajax-modal {% if instance_quota_exceeded %}disabled{% endif %}"><span class="fa fa-cloud-upload"></span> {% if instance_quota_exceeded %}{% trans "Launch Instance (Quota exceeded)"%}{% else %}{% trans "Launch Instance"%}{% endif %}</a>
|
<a href="{% url 'horizon:project:network_topology:launchinstance' %}" id="instances__action_launch" class="btn btn-default btn-sm btn-launch ajax-modal {% if instance_quota_exceeded %}disabled{% endif %}"><span class="fa fa-cloud-upload"></span> {% if instance_quota_exceeded %}{% trans "Launch Instance (Quota exceeded)"%}{% else %}{% trans "Launch Instance"%}{% endif %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -315,6 +315,7 @@ POLICY_CHECK_FUNCTION = policy_backend.check
|
||||||
|
|
||||||
# Add HORIZON_CONFIG to the context information for offline compression
|
# Add HORIZON_CONFIG to the context information for offline compression
|
||||||
COMPRESS_OFFLINE_CONTEXT = {
|
COMPRESS_OFFLINE_CONTEXT = {
|
||||||
|
'WEBROOT': WEBROOT,
|
||||||
'STATIC_URL': STATIC_URL,
|
'STATIC_URL': STATIC_URL,
|
||||||
'HORIZON_CONFIG': HORIZON_CONFIG,
|
'HORIZON_CONFIG': HORIZON_CONFIG,
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,12 @@
|
||||||
var module = angular.module('hz.dashboard', [
|
var module = angular.module('hz.dashboard', [
|
||||||
'hz.dashboard.launch-instance',
|
'hz.dashboard.launch-instance',
|
||||||
'hz.dashboard.workflow'
|
'hz.dashboard.workflow'
|
||||||
]);
|
])
|
||||||
|
.config(config);
|
||||||
|
|
||||||
module.constant('dashboardBasePath', '/static/dashboard/');
|
function config($provide, $windowProvider) {
|
||||||
|
var path = $windowProvider.$get().STATIC_URL + 'dashboard/';
|
||||||
|
$provide.constant('dashboardBasePath', path);
|
||||||
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -24,10 +24,12 @@
|
||||||
|
|
||||||
describe('hz.dashboard:constant:dashboardBasePath', function () {
|
describe('hz.dashboard:constant:dashboardBasePath', function () {
|
||||||
var dashboardBasePath;
|
var dashboardBasePath;
|
||||||
|
var staticUrl;
|
||||||
|
|
||||||
beforeEach(module('hz.dashboard'));
|
beforeEach(module('hz.dashboard'));
|
||||||
beforeEach(inject(function ($injector) {
|
beforeEach(inject(function ($injector) {
|
||||||
dashboardBasePath = $injector.get('dashboardBasePath');
|
dashboardBasePath = $injector.get('dashboardBasePath');
|
||||||
|
staticUrl = $injector.get('$window').STATIC_URL;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should be defined', function () {
|
it('should be defined', function () {
|
||||||
|
@ -35,7 +37,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should equal to "/static/dashboard/"', function () {
|
it('should equal to "/static/dashboard/"', function () {
|
||||||
expect(dashboardBasePath).toEqual('/static/dashboard/');
|
expect(dashboardBasePath).toEqual(staticUrl + 'dashboard/');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
*/
|
*/
|
||||||
module.controller('LaunchInstanceSecurityGroupsCtrl', [
|
module.controller('LaunchInstanceSecurityGroupsCtrl', [
|
||||||
'launchInstanceModel',
|
'launchInstanceModel',
|
||||||
function (launchInstanceModel) {
|
'$window',
|
||||||
|
function (launchInstanceModel, $window) {
|
||||||
var ctrl = this;
|
var ctrl = this;
|
||||||
|
|
||||||
ctrl.label = {
|
ctrl.label = {
|
||||||
|
@ -37,8 +38,8 @@
|
||||||
displayedAllocated: []
|
displayedAllocated: []
|
||||||
};
|
};
|
||||||
|
|
||||||
ctrl.tableDetails =
|
ctrl.tableDetails = $window.STATIC_URL +
|
||||||
'/static/dashboard/launch-instance/security-groups/security-group-details.html';
|
'dashboard/launch-instance/security-groups/security-group-details.html';
|
||||||
|
|
||||||
ctrl.tableHelp = {
|
ctrl.tableHelp = {
|
||||||
noneAllocText: gettext('Select one or more security groups from the available groups below.'),
|
noneAllocText: gettext('Select one or more security groups from the available groups below.'),
|
||||||
|
|
|
@ -63,6 +63,7 @@
|
||||||
'decodeFilter',
|
'decodeFilter',
|
||||||
'diskFormatFilter',
|
'diskFormatFilter',
|
||||||
'gbFilter',
|
'gbFilter',
|
||||||
|
'$window',
|
||||||
LaunchInstanceSourceCtrl
|
LaunchInstanceSourceCtrl
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -72,7 +73,8 @@
|
||||||
dateFilter,
|
dateFilter,
|
||||||
decodeFilter,
|
decodeFilter,
|
||||||
diskFormatFilter,
|
diskFormatFilter,
|
||||||
gbFilter) {
|
gbFilter,
|
||||||
|
$window) {
|
||||||
|
|
||||||
$scope.label = {
|
$scope.label = {
|
||||||
title: gettext('Instance Details'),
|
title: gettext('Instance Details'),
|
||||||
|
@ -134,8 +136,8 @@
|
||||||
$scope.tableData = {};
|
$scope.tableData = {};
|
||||||
$scope.helpText = {};
|
$scope.helpText = {};
|
||||||
$scope.maxInstanceCount = 1;
|
$scope.maxInstanceCount = 1;
|
||||||
$scope.sourceDetails =
|
$scope.sourceDetails = $window.STATIC_URL +
|
||||||
'/static/dashboard/launch-instance/source/source-details.html';
|
'dashboard/launch-instance/source/source-details.html';
|
||||||
|
|
||||||
var selection = $scope.selection = $scope.model.newInstanceSpec.source;
|
var selection = $scope.selection = $scope.model.newInstanceSpec.source;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
<title>Jasmine Spec Runner</title>
|
<title>Jasmine Spec Runner</title>
|
||||||
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}horizon/lib/jasmine/jasmine.css">
|
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}horizon/lib/jasmine/jasmine.css">
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window.STATIC_URL = '/static/';
|
||||||
|
window.WEBROOT = '/';
|
||||||
|
</script>
|
||||||
<script src="{% url 'horizon:jsi18n' 'horizon' %}"></script>
|
<script src="{% url 'horizon:jsi18n' 'horizon' %}"></script>
|
||||||
<script src="{{ STATIC_URL }}horizon/lib/jasmine/jasmine.js"></script>
|
<script src="{{ STATIC_URL }}horizon/lib/jasmine/jasmine.js"></script>
|
||||||
<script src="{{ STATIC_URL }}horizon/lib/jasmine/jasmine-html.js"></script>
|
<script src="{{ STATIC_URL }}horizon/lib/jasmine/jasmine-html.js"></script>
|
||||||
|
|
Loading…
Reference in New Issue