Merge "Reduce lint warnings"
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
toBeVisible: function() {
|
toBeVisible: function() {
|
||||||
return {
|
return {
|
||||||
compare: function(actual) {
|
compare: function(actual) {
|
||||||
var pass = (actual.css('display') !== 'none');
|
var pass = actual.css('display') !== 'none';
|
||||||
var result = {
|
var result = {
|
||||||
pass: pass,
|
pass: pass,
|
||||||
message: pass ?
|
message: pass ?
|
||||||
|
@@ -233,7 +233,7 @@
|
|||||||
return items.filter(function filterItems(item) {
|
return items.filter(function filterItems(item) {
|
||||||
return item._ext && item._ext.position === position;
|
return item._ext && item._ext.position === position;
|
||||||
}).sort(function sortItems(a, b) {
|
}).sort(function sortItems(a, b) {
|
||||||
return (a._ext.priority - b._ext.priority) || 1;
|
return a._ext.priority - b._ext.priority || 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
yesNoFilter.$inject = ['horizon.framework.util.i18n.gettext'];
|
yesNoFilter.$inject = ['horizon.framework.util.i18n.gettext'];
|
||||||
function yesNoFilter(gettext) {
|
function yesNoFilter(gettext) {
|
||||||
return function (input) {
|
return function (input) {
|
||||||
return (input ? gettext("Yes") : gettext("No"));
|
return input ? gettext("Yes") : gettext("No");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,9 @@
|
|||||||
*/
|
*/
|
||||||
function getText($window) {
|
function getText($window) {
|
||||||
// If no global function, revert to just returning given text.
|
// If no global function, revert to just returning given text.
|
||||||
var gettextFunc = $window.gettext || function (x) { return x; };
|
var gettextFunc = $window.gettext || function (x) {
|
||||||
|
return x;
|
||||||
|
};
|
||||||
|
|
||||||
// Eventually, could delete the window gettext references here,
|
// Eventually, could delete the window gettext references here,
|
||||||
// or provide an appropriate method.
|
// or provide an appropriate method.
|
||||||
|
@@ -38,7 +38,9 @@
|
|||||||
|
|
||||||
describe("injected window.gettext", function () {
|
describe("injected window.gettext", function () {
|
||||||
beforeEach(module(function ($provide) {
|
beforeEach(module(function ($provide) {
|
||||||
var $window = { gettext: function (x) { return x.replace(/good/, 'bad'); } };
|
var $window = { gettext: function (x) {
|
||||||
|
return x.replace(/good/, 'bad');
|
||||||
|
}};
|
||||||
$provide.value('$window', $window);
|
$provide.value('$window', $window);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@@ -150,7 +150,9 @@
|
|||||||
|
|
||||||
var pie = d3.layout.pie()
|
var pie = d3.layout.pie()
|
||||||
.sort(null)
|
.sort(null)
|
||||||
.value(function (d) { return d.value; });
|
.value(function (d) {
|
||||||
|
return d.value;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var unwatch = scope.$watch('chartData', updateChart);
|
var unwatch = scope.$watch('chartData', updateChart);
|
||||||
@@ -174,7 +176,9 @@
|
|||||||
scope.model.total = scope.chartData.maxLimit;
|
scope.model.total = scope.chartData.maxLimit;
|
||||||
scope.model.totalLabel = gettext('Max');
|
scope.model.totalLabel = gettext('Max');
|
||||||
} else {
|
} else {
|
||||||
scope.model.total = d3.sum(scope.chartData.data, function (d) { return d.value; });
|
scope.model.total = d3.sum(scope.chartData.data, function (d) {
|
||||||
|
return d.value;
|
||||||
|
});
|
||||||
scope.model.totalLabel = gettext('Total');
|
scope.model.totalLabel = gettext('Total');
|
||||||
}
|
}
|
||||||
scope.model.tooltipData.enabled = false;
|
scope.model.tooltipData.enabled = false;
|
||||||
@@ -199,7 +203,9 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
chart.on('mouseenter', function (d) { showTooltip(d, this); })
|
chart.on('mouseenter', function (d) {
|
||||||
|
showTooltip(d, this);
|
||||||
|
})
|
||||||
.on('mouseleave', clearTooltip);
|
.on('mouseleave', clearTooltip);
|
||||||
|
|
||||||
// Animate the slice rendering
|
// Animate the slice rendering
|
||||||
|
@@ -62,8 +62,7 @@
|
|||||||
if (item.parent) {
|
if (item.parent) {
|
||||||
item.parent.addedCount -= 1;
|
item.parent.addedCount -= 1;
|
||||||
}
|
}
|
||||||
}
|
} else if (!item.custom) {
|
||||||
else if (!item.custom) {
|
|
||||||
ctrl.hide = false;
|
ctrl.hide = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -102,14 +102,16 @@
|
|||||||
it("returns required", function() {
|
it("returns required", function() {
|
||||||
var error = {required: true};
|
var error = {required: true};
|
||||||
ctrl.text = {required: "texreq"};
|
ctrl.text = {required: "texreq"};
|
||||||
|
/*eslint-disable no-undefined */
|
||||||
expect(ctrl.formatErrorMessage(undefined, error)).toBe('texreq');
|
expect(ctrl.formatErrorMessage(undefined, error)).toBe('texreq');
|
||||||
|
/*eslint-enable no-undefined */
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns nothing when nothing for error", function() {
|
it("returns nothing when nothing for error", function() {
|
||||||
var error = {};
|
var error = {};
|
||||||
|
/*eslint-disable no-undefined */
|
||||||
expect(ctrl.formatErrorMessage(undefined, error)).toBeUndefined();
|
expect(ctrl.formatErrorMessage(undefined, error)).toBeUndefined();
|
||||||
|
/*eslint-enable no-undefined */
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -205,7 +205,7 @@
|
|||||||
$scope = $injector.get('$rootScope').$new();
|
$scope = $injector.get('$rootScope').$new();
|
||||||
|
|
||||||
var serviceName = 'horizon.framework.widgets.metadata.tree.service';
|
var serviceName = 'horizon.framework.widgets.metadata.tree.service';
|
||||||
item = new ($injector.get(serviceName).Item)();
|
item = new ($injector.get(serviceName)).Item();
|
||||||
$scope.item = item.fromProperty('test', namespaces[0].properties['test:A:6']);
|
$scope.item = item.fromProperty('test', namespaces[0].properties['test:A:6']);
|
||||||
|
|
||||||
var markup = '<metadata-tree-item' +
|
var markup = '<metadata-tree-item' +
|
||||||
|
@@ -44,8 +44,12 @@
|
|||||||
function SimpleModalController($modalInstance, context) {
|
function SimpleModalController($modalInstance, context) {
|
||||||
var ctrl = this;
|
var ctrl = this;
|
||||||
ctrl.context = context;
|
ctrl.context = context;
|
||||||
ctrl.submit = function() { $modalInstance.close(); };
|
ctrl.submit = function() {
|
||||||
ctrl.cancel = function() { $modalInstance.dismiss('cancel'); };
|
$modalInstance.close();
|
||||||
|
};
|
||||||
|
ctrl.cancel = function() {
|
||||||
|
$modalInstance.dismiss('cancel');
|
||||||
|
};
|
||||||
} // end of function
|
} // end of function
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@@ -70,7 +70,9 @@
|
|||||||
var service, modal;
|
var service, modal;
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
modal = { open: function() {return 'val'; } };
|
modal = { open: function() {
|
||||||
|
return 'val';
|
||||||
|
}};
|
||||||
$provide.value('$modal', modal);
|
$provide.value('$modal', modal);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@@ -125,9 +125,8 @@
|
|||||||
ctrl.limits.maxAllocation > ctrl.allocated.sourceItems.length) {
|
ctrl.limits.maxAllocation > ctrl.allocated.sourceItems.length) {
|
||||||
ctrl.allocated.sourceItems.push(item);
|
ctrl.allocated.sourceItems.push(item);
|
||||||
ctrl.allocatedIds[item.id] = true;
|
ctrl.allocatedIds[item.id] = true;
|
||||||
}
|
|
||||||
// Swap out items if only one allocation allowed
|
// Swap out items if only one allocation allowed
|
||||||
else if (ctrl.limits.maxAllocation === 1) {
|
} else if (ctrl.limits.maxAllocation === 1) {
|
||||||
var temp = ctrl.allocated.sourceItems.pop();
|
var temp = ctrl.allocated.sourceItems.pop();
|
||||||
delete ctrl.allocatedIds[temp.id];
|
delete ctrl.allocatedIds[temp.id];
|
||||||
// When swapping out, Smart-Table $watch is
|
// When swapping out, Smart-Table $watch is
|
||||||
|
@@ -27,7 +27,9 @@
|
|||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
// we will mock scope and timeout in this test
|
// we will mock scope and timeout in this test
|
||||||
// because we aren't concern with rendering results
|
// because we aren't concern with rendering results
|
||||||
var timeout = function(fn) { fn(); };
|
var timeout = function(fn) {
|
||||||
|
fn();
|
||||||
|
};
|
||||||
|
|
||||||
// we will mock parse and attrs
|
// we will mock parse and attrs
|
||||||
// because we want to control the parameters
|
// because we want to control the parameters
|
||||||
|
@@ -48,7 +48,7 @@
|
|||||||
transferTable.$inject = [ 'horizon.framework.widgets.basePath' ];
|
transferTable.$inject = [ 'horizon.framework.widgets.basePath' ];
|
||||||
|
|
||||||
function transferTable(path) {
|
function transferTable(path) {
|
||||||
var directive = {
|
return {
|
||||||
controller: 'transferTableController',
|
controller: 'transferTableController',
|
||||||
controllerAs: 'trCtrl',
|
controllerAs: 'trCtrl',
|
||||||
restrict: ' E',
|
restrict: ' E',
|
||||||
@@ -58,8 +58,6 @@
|
|||||||
link: link
|
link: link
|
||||||
};
|
};
|
||||||
|
|
||||||
return directive;
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
|
|
||||||
function link(scope, element, attrs, ctrl, transclude) {
|
function link(scope, element, attrs, ctrl, transclude) {
|
||||||
@@ -80,8 +78,7 @@
|
|||||||
transclude(availableScope, function(clone) {
|
transclude(availableScope, function(clone) {
|
||||||
available.append(clone.filter('table'));
|
available.append(clone.filter('table'));
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
transclude(scope, function(clone) {
|
transclude(scope, function(clone) {
|
||||||
allocated.append(clone.filter('allocated'));
|
allocated.append(clone.filter('allocated'));
|
||||||
available.append(clone.filter('available'));
|
available.append(clone.filter('available'));
|
||||||
|
@@ -191,7 +191,11 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("checks steps' readiness", function() {
|
it("checks steps' readiness", function() {
|
||||||
var checkedStep = {checkReadiness: function() { return true; }};
|
var checkedStep = {
|
||||||
|
checkReadiness: function() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
$scope.workflow = {
|
$scope.workflow = {
|
||||||
steps: [{}, checkedStep, {}]
|
steps: [{}, checkedStep, {}]
|
||||||
};
|
};
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns No when object is undefined or has no properties', function() {
|
it('returns No when object is undefined or has no properties', function() {
|
||||||
expect(hasExtras(undefined)).not.toBeTruthy();
|
expect(hasExtras()).not.toBeTruthy();
|
||||||
expect(hasExtras({})).not.toBeTruthy();
|
expect(hasExtras({})).not.toBeTruthy();
|
||||||
expect(hasExtras('string')).not.toBeTruthy();
|
expect(hasExtras('string')).not.toBeTruthy();
|
||||||
expect(hasExtras(1)).not.toBeTruthy();
|
expect(hasExtras(1)).not.toBeTruthy();
|
||||||
|
@@ -23,13 +23,20 @@
|
|||||||
function fakePolicy() {
|
function fakePolicy() {
|
||||||
return {
|
return {
|
||||||
then: function(successFn, errorFn) {
|
then: function(successFn, errorFn) {
|
||||||
if (policy.allowed) { successFn(); }
|
if (policy.allowed) {
|
||||||
else { errorFn(); }
|
successFn();
|
||||||
|
} else {
|
||||||
|
errorFn();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function fakePromise() { return { success: angular.noop }; }
|
function fakePromise() {
|
||||||
function fakeToast() { return { add: angular.noop }; }
|
return { success: angular.noop };
|
||||||
|
}
|
||||||
|
function fakeToast() {
|
||||||
|
return { add: angular.noop };
|
||||||
|
}
|
||||||
|
|
||||||
var controller, toastService, policyAPI, keystoneAPI;
|
var controller, toastService, policyAPI, keystoneAPI;
|
||||||
|
|
||||||
|
@@ -30,7 +30,9 @@
|
|||||||
it('has correct disk configuration options', function() {
|
it('has correct disk configuration options', function() {
|
||||||
expect(ctrl.diskConfigOptions).toBeDefined();
|
expect(ctrl.diskConfigOptions).toBeDefined();
|
||||||
expect(ctrl.diskConfigOptions.length).toBe(2);
|
expect(ctrl.diskConfigOptions.length).toBe(2);
|
||||||
var vals = ctrl.diskConfigOptions.map(function(x) { return x.value; });
|
var vals = ctrl.diskConfigOptions.map(function(x) {
|
||||||
|
return x.value;
|
||||||
|
});
|
||||||
expect(vals).toContain('AUTO');
|
expect(vals).toContain('AUTO');
|
||||||
expect(vals).toContain('MANUAL');
|
expect(vals).toContain('MANUAL');
|
||||||
});
|
});
|
||||||
|
@@ -401,7 +401,9 @@
|
|||||||
describe('defaultIfUndefined', function () {
|
describe('defaultIfUndefined', function () {
|
||||||
|
|
||||||
it('returns the given default if value is undefined', function () {
|
it('returns the given default if value is undefined', function () {
|
||||||
|
/*eslint-disable no-undefined */
|
||||||
expect(ctrl.defaultIfUndefined(undefined, 'defValue')).toBe('defValue');
|
expect(ctrl.defaultIfUndefined(undefined, 'defValue')).toBe('defValue');
|
||||||
|
/*eslint-enable no-undefined */
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns the value if defined', function () {
|
it('returns the value if defined', function () {
|
||||||
|
@@ -108,7 +108,9 @@
|
|||||||
// This table used in "allocated" portion of transfer table
|
// This table used in "allocated" portion of transfer table
|
||||||
scope.showSearchBar = false;
|
scope.showSearchBar = false;
|
||||||
// Always show items
|
// Always show items
|
||||||
scope.showItemFunc = function () { return true; };
|
scope.showItemFunc = function () {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
scope.itemClickAction = transferTableController.deallocate;
|
scope.itemClickAction = transferTableController.deallocate;
|
||||||
scope.noneAvailableText = transferTableHelpText.noneAllocText;
|
scope.noneAvailableText = transferTableHelpText.noneAllocText;
|
||||||
scope.itemButtonClasses = "fa fa-minus";
|
scope.itemButtonClasses = "fa fa-minus";
|
||||||
|
@@ -72,7 +72,10 @@
|
|||||||
spyOn(modal, 'open').and
|
spyOn(modal, 'open').and
|
||||||
.returnValue({
|
.returnValue({
|
||||||
result: {
|
result: {
|
||||||
then: function(x, y) { successFunc = x; errFunc = y; }
|
then: function(x, y) {
|
||||||
|
successFunc = x;
|
||||||
|
errFunc = y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
func(launchContext);
|
func(launchContext);
|
||||||
@@ -88,7 +91,10 @@
|
|||||||
spyOn(modal, 'open').and
|
spyOn(modal, 'open').and
|
||||||
.returnValue({
|
.returnValue({
|
||||||
result: {
|
result: {
|
||||||
then: function(x, y) { successFunc = x; errFunc = y; }
|
then: function(x, y) {
|
||||||
|
successFunc = x;
|
||||||
|
errFunc = y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
func(launchContext);
|
func(launchContext);
|
||||||
|
@@ -407,7 +407,7 @@
|
|||||||
* size for validating vol_size field
|
* size for validating vol_size field
|
||||||
*/
|
*/
|
||||||
function checkVolumeForImage() {
|
function checkVolumeForImage() {
|
||||||
var source = selection ? selection[0] : undefined;
|
var source = selection[0];
|
||||||
|
|
||||||
if (source && ctrl.currentBootSource === bootSourceTypes.IMAGE) {
|
if (source && ctrl.currentBootSource === bootSourceTypes.IMAGE) {
|
||||||
var imageGb = source.size * 1e-9;
|
var imageGb = source.size * 1e-9;
|
||||||
@@ -418,7 +418,9 @@
|
|||||||
var volumeSizeObj = { minVolumeSize: ctrl.minVolumeSize };
|
var volumeSizeObj = { minVolumeSize: ctrl.minVolumeSize };
|
||||||
ctrl.minVolumeSizeError = interpolate(volumeSizeText, volumeSizeObj, true);
|
ctrl.minVolumeSizeError = interpolate(volumeSizeText, volumeSizeObj, true);
|
||||||
} else {
|
} else {
|
||||||
|
/*eslint-disable no-undefined */
|
||||||
ctrl.minVolumeSize = undefined;
|
ctrl.minVolumeSize = undefined;
|
||||||
|
/*eslint-enable no-undefined */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -78,7 +78,9 @@
|
|||||||
it('defines the correct boot source options', function() {
|
it('defines the correct boot source options', function() {
|
||||||
expect(ctrl.bootSourcesOptions).toBeDefined();
|
expect(ctrl.bootSourcesOptions).toBeDefined();
|
||||||
var types = ['image', 'snapshot', 'volume', 'volume_snapshot'];
|
var types = ['image', 'snapshot', 'volume', 'volume_snapshot'];
|
||||||
var opts = ctrl.bootSourcesOptions.map(function(x) { return x.type; });
|
var opts = ctrl.bootSourcesOptions.map(function(x) {
|
||||||
|
return x.type;
|
||||||
|
});
|
||||||
types.forEach(function(key) {
|
types.forEach(function(key) {
|
||||||
expect(opts).toContain(key);
|
expect(opts).toContain(key);
|
||||||
});
|
});
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns Image for undefined', function () {
|
it('returns Image for undefined', function () {
|
||||||
expect(imageTypeFilter(undefined)).toBe('Image');
|
expect(imageTypeFilter()).toBe('Image');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -21,9 +21,15 @@
|
|||||||
beforeEach(module('horizon.app.core.openstack-service-api'));
|
beforeEach(module('horizon.app.core.openstack-service-api'));
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
cinderAPI = {getExtensions: function() {return {then: angular.noop}; }};
|
cinderAPI = {getExtensions: function() {
|
||||||
q = {defer: function() { return {resolve: angular.noop}; }};
|
return {then: angular.noop};
|
||||||
$provide.value('$cacheFactory', function() {return "cache"; });
|
}};
|
||||||
|
q = {defer: function() {
|
||||||
|
return {resolve: angular.noop};
|
||||||
|
}};
|
||||||
|
$provide.value('$cacheFactory', function() {
|
||||||
|
return "cache";
|
||||||
|
});
|
||||||
$provide.value('$q', q);
|
$provide.value('$q', q);
|
||||||
$provide.value('horizon.app.core.openstack-service-api.cinder', cinderAPI);
|
$provide.value('horizon.app.core.openstack-service-api.cinder', cinderAPI);
|
||||||
}));
|
}));
|
||||||
|
@@ -63,7 +63,9 @@
|
|||||||
function testCall(apiService, service, toastService, config) {
|
function testCall(apiService, service, toastService, config) {
|
||||||
// 'promise' simulates a promise, including a self-referential success
|
// 'promise' simulates a promise, including a self-referential success
|
||||||
// handler.
|
// handler.
|
||||||
var promise = {error: angular.noop, success: function() { return this; }};
|
var promise = {error: angular.noop, success: function() {
|
||||||
|
return this;
|
||||||
|
}};
|
||||||
spyOn(apiService, config.method).and.returnValue(promise);
|
spyOn(apiService, config.method).and.returnValue(promise);
|
||||||
spyOn(promise, 'error');
|
spyOn(promise, 'error');
|
||||||
service[config.func].apply(null, config.testInput);
|
service[config.func].apply(null, config.testInput);
|
||||||
|
@@ -275,7 +275,7 @@
|
|||||||
* filters. For example "name" : "fedora" would filter on the fedora name.
|
* filters. For example "name" : "fedora" would filter on the fedora name.
|
||||||
*/
|
*/
|
||||||
function getImages(params) {
|
function getImages(params) {
|
||||||
var config = (params) ? { 'params' : params} : {};
|
var config = params ? { 'params' : params} : {};
|
||||||
return apiService.get('/api/glance/images/', config)
|
return apiService.get('/api/glance/images/', config)
|
||||||
.error(function () {
|
.error(function () {
|
||||||
toastService.add('error', gettext('Unable to retrieve the images.'));
|
toastService.add('error', gettext('Unable to retrieve the images.'));
|
||||||
@@ -340,7 +340,7 @@
|
|||||||
* enabled.
|
* enabled.
|
||||||
*/
|
*/
|
||||||
function getNamespaces(params, suppressError) {
|
function getNamespaces(params, suppressError) {
|
||||||
var config = (params) ? {'params' : params} : {};
|
var config = params ? {'params' : params} : {};
|
||||||
config.cache = true;
|
config.cache = true;
|
||||||
|
|
||||||
var promise = apiService.get('/api/glance/metadefs/namespaces/', config);
|
var promise = apiService.get('/api/glance/metadefs/namespaces/', config);
|
||||||
|
@@ -72,7 +72,7 @@
|
|||||||
|
|
||||||
// Users
|
// Users
|
||||||
function getUsers(params) {
|
function getUsers(params) {
|
||||||
var config = (params) ? {'params': params} : {};
|
var config = params ? {'params': params} : {};
|
||||||
return apiService.get('/api/keystone/users/', config)
|
return apiService.get('/api/keystone/users/', config)
|
||||||
.error(function () {
|
.error(function () {
|
||||||
toastService.add('error', gettext('Unable to retrieve the users.'));
|
toastService.add('error', gettext('Unable to retrieve the users.'));
|
||||||
@@ -247,7 +247,7 @@
|
|||||||
|
|
||||||
// Projects
|
// Projects
|
||||||
function getProjects(params) {
|
function getProjects(params) {
|
||||||
var config = (params) ? {'params': params} : {};
|
var config = params ? {'params': params} : {};
|
||||||
return apiService.get('/api/keystone/projects/', config)
|
return apiService.get('/api/keystone/projects/', config)
|
||||||
.error(function () {
|
.error(function () {
|
||||||
toastService.add('error', gettext('Unable to retrieve the projects.'));
|
toastService.add('error', gettext('Unable to retrieve the projects.'));
|
||||||
|
@@ -23,9 +23,15 @@
|
|||||||
beforeEach(module('horizon.app.core.openstack-service-api'));
|
beforeEach(module('horizon.app.core.openstack-service-api'));
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
novaAPI = {getExtensions: function() {return {then: angular.noop}; }};
|
novaAPI = {getExtensions: function() {
|
||||||
q = {defer: function() { return {resolve: angular.noop}; }};
|
return {then: angular.noop};
|
||||||
$provide.value('$cacheFactory', function() {return "cache"; });
|
}};
|
||||||
|
q = {defer: function() {
|
||||||
|
return {resolve: angular.noop};
|
||||||
|
}};
|
||||||
|
$provide.value('$cacheFactory', function() {
|
||||||
|
return "cache";
|
||||||
|
});
|
||||||
$provide.value('$q', q);
|
$provide.value('$q', q);
|
||||||
$provide.value('horizon.app.core.openstack-service-api.nova', novaAPI);
|
$provide.value('horizon.app.core.openstack-service-api.nova', novaAPI);
|
||||||
}));
|
}));
|
||||||
|
@@ -281,8 +281,12 @@
|
|||||||
*/
|
*/
|
||||||
function getFlavors(isPublic, getExtras) {
|
function getFlavors(isPublic, getExtras) {
|
||||||
var config = {'params': {}};
|
var config = {'params': {}};
|
||||||
if (isPublic) { config.params.is_public = 'true'; }
|
if (isPublic) {
|
||||||
if (getExtras) { config.params.get_extras = 'true'; }
|
config.params.is_public = 'true';
|
||||||
|
}
|
||||||
|
if (getExtras) {
|
||||||
|
config.params.get_extras = 'true';
|
||||||
|
}
|
||||||
return apiService.get('/api/nova/flavors/', config)
|
return apiService.get('/api/nova/flavors/', config)
|
||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
// The colon character ':' in the flavor data causes problems when used
|
// The colon character ':' in the flavor data causes problems when used
|
||||||
@@ -319,8 +323,12 @@
|
|||||||
*/
|
*/
|
||||||
function getFlavor(id, getExtras, getAccessList) {
|
function getFlavor(id, getExtras, getAccessList) {
|
||||||
var config = {'params': {}};
|
var config = {'params': {}};
|
||||||
if (getExtras) { config.params.get_extras = 'true'; }
|
if (getExtras) {
|
||||||
if (getAccessList) { config.params.get_access_list = 'true'; }
|
config.params.get_extras = 'true';
|
||||||
|
}
|
||||||
|
if (getAccessList) {
|
||||||
|
config.params.get_access_list = 'true';
|
||||||
|
}
|
||||||
return apiService.get('/api/nova/flavors/' + id + '/' , config)
|
return apiService.get('/api/nova/flavors/' + id + '/' , config)
|
||||||
.error(function () {
|
.error(function () {
|
||||||
toastService.add('error', gettext('Unable to retrieve the flavor.'));
|
toastService.add('error', gettext('Unable to retrieve the flavor.'));
|
||||||
|
@@ -108,8 +108,12 @@
|
|||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
|
|
||||||
function success(response) {
|
function success(response) {
|
||||||
if (response.data.allowed) { deferred.resolve(); }
|
if (response.data.allowed) {
|
||||||
else { deferred.reject(); }
|
deferred.resolve();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
deferred.reject();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -70,13 +70,17 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var deferred = {
|
var deferred = {
|
||||||
then: function(callback) { callback(response); },
|
then: function(callback) {
|
||||||
|
callback(response);
|
||||||
|
},
|
||||||
reject: angular.noop,
|
reject: angular.noop,
|
||||||
resolve: angular.noop
|
resolve: angular.noop
|
||||||
};
|
};
|
||||||
|
|
||||||
var service;
|
var service;
|
||||||
var q = { defer: function() { return deferred; }};
|
var q = { defer: function() {
|
||||||
|
return deferred;
|
||||||
|
}};
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
|
|
||||||
|
@@ -28,10 +28,18 @@
|
|||||||
userSession = {get: angular.noop};
|
userSession = {get: angular.noop};
|
||||||
$provide.value('horizon.app.core.openstack-service-api.userSession', userSession);
|
$provide.value('horizon.app.core.openstack-service-api.userSession', userSession);
|
||||||
deferred = {promise: angular.noop, reject: angular.noop, resolve: angular.noop};
|
deferred = {promise: angular.noop, reject: angular.noop, resolve: angular.noop};
|
||||||
q = {all: function() {return {then: angular.noop}; },
|
q = {
|
||||||
defer: function() { return deferred; }};
|
all: function() {
|
||||||
|
return {then: angular.noop};
|
||||||
|
},
|
||||||
|
defer: function() {
|
||||||
|
return deferred;
|
||||||
|
}
|
||||||
|
};
|
||||||
$provide.value('$q', q);
|
$provide.value('$q', q);
|
||||||
$provide.value('$cacheFactory', function() { return 'cache'; });
|
$provide.value('$cacheFactory', function() {
|
||||||
|
return 'cache';
|
||||||
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(
|
beforeEach(
|
||||||
|
@@ -24,7 +24,9 @@
|
|||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
keystoneAPI = {getCurrentUserSession: angular.noop};
|
keystoneAPI = {getCurrentUserSession: angular.noop};
|
||||||
$provide.value('horizon.app.core.openstack-service-api.keystone', keystoneAPI);
|
$provide.value('horizon.app.core.openstack-service-api.keystone', keystoneAPI);
|
||||||
$provide.value('$cacheFactory', function() { return 'cache'; });
|
$provide.value('$cacheFactory', function() {
|
||||||
|
return 'cache';
|
||||||
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(['horizon.app.core.openstack-service-api.userSession', function(userSession) {
|
beforeEach(inject(['horizon.app.core.openstack-service-api.userSession', function(userSession) {
|
||||||
|
@@ -24,7 +24,9 @@
|
|||||||
ctrl.copyFrom = angular.element('#id_image_url').val();
|
ctrl.copyFrom = angular.element('#id_image_url').val();
|
||||||
ctrl.diskFormat = angular.element('#id_disk_format option:selected').val();
|
ctrl.diskFormat = angular.element('#id_disk_format option:selected').val();
|
||||||
ctrl.selectImageFormat = function (path) {
|
ctrl.selectImageFormat = function (path) {
|
||||||
if (!path) { return; }
|
if (!path) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var format = path.substr(path.lastIndexOf(".") + 1).toLowerCase().replace(/[^a-z0-9]+/gi, "");
|
var format = path.substr(path.lastIndexOf(".") + 1).toLowerCase().replace(/[^a-z0-9]+/gi, "");
|
||||||
|
|
||||||
/* eslint-disable angular/ng_angularelement */
|
/* eslint-disable angular/ng_angularelement */
|
||||||
|
Reference in New Issue
Block a user