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