Merge "Cleaning up lint warnings for Image work"
This commit is contained in:
commit
0a494d6332
|
@ -44,8 +44,8 @@
|
|||
deleteImageService,
|
||||
launchInstanceService,
|
||||
updateMetadataService,
|
||||
imageResourceTypeCode)
|
||||
{
|
||||
imageResourceTypeCode
|
||||
) {
|
||||
var imageResourceType = registry.getResourceType(imageResourceTypeCode);
|
||||
imageResourceType.itemActions
|
||||
.append({
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
'horizon.app.core.volumes.resourceType'
|
||||
];
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
/*
|
||||
* @ngdoc factory
|
||||
* @name horizon.app.core.images.actions.create-volume.service
|
||||
*
|
||||
* @Description
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
'horizon.app.core.images.resourceType'
|
||||
];
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
/*
|
||||
* @ngdoc factory
|
||||
* @name horizon.app.core.images.actions.delete-image.service
|
||||
*
|
||||
* @Description
|
||||
|
@ -90,8 +90,7 @@
|
|||
userSessionService.isCurrentProject(image.owner),
|
||||
notDeleted(image)
|
||||
]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return policy.ifAllowed({ rules: [['image', 'delete_image']] });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
|
||||
for (var index = 0; index < imageCount; index++) {
|
||||
var image = angular.copy(data);
|
||||
image.id = (index + 1);
|
||||
image.id = index + 1;
|
||||
image.name = 'image' + (index + 1);
|
||||
images.push(image);
|
||||
}
|
||||
|
@ -134,7 +134,9 @@
|
|||
|
||||
var labels = deleteModalService.open.calls.argsFor(0)[2].labels;
|
||||
expect(deleteModalService.open).toHaveBeenCalled();
|
||||
for (var k in labels) { expect(labels[k].toLowerCase()).toContain('image'); }
|
||||
angular.forEach(labels, function eachLabel(label) {
|
||||
expect(label.toLowerCase()).toContain('image');
|
||||
});
|
||||
}
|
||||
|
||||
function testpluralLabels() {
|
||||
|
@ -144,7 +146,9 @@
|
|||
|
||||
var labels = deleteModalService.open.calls.argsFor(0)[2].labels;
|
||||
expect(deleteModalService.open).toHaveBeenCalled();
|
||||
for (var k in labels) { expect(labels[k].toLowerCase()).toContain('images'); }
|
||||
angular.forEach(labels, function eachLabel(label) {
|
||||
expect(label.toLowerCase()).toContain('images');
|
||||
});
|
||||
}
|
||||
|
||||
function testEntities() {
|
||||
|
|
|
@ -30,11 +30,16 @@
|
|||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.app.core.images.actions.launchInstanceService
|
||||
*
|
||||
* @param {Object} $q
|
||||
* @param {Object} nonBootableImageTypes
|
||||
* @param {Object} launchInstanceModal
|
||||
* @param {Object} $qExtensions
|
||||
* @Description
|
||||
* Brings up the Launch Instance for image modal.
|
||||
* On submit, launch the instance for the Image.
|
||||
* On cancel, do nothing.
|
||||
*
|
||||
* @returns {Object} The service
|
||||
*/
|
||||
function launchInstanceService(
|
||||
$q,
|
||||
|
|
|
@ -34,10 +34,17 @@
|
|||
* @ngDoc factory
|
||||
* @name horizon.app.core.images.actions.updateMetadataService
|
||||
*
|
||||
* @param {Object} $q
|
||||
* @param {Object} events
|
||||
* @param {Object} metadataModalService
|
||||
* @param {Object} userSessionService
|
||||
* @param {Object} $qExtensions
|
||||
* @Description
|
||||
* Brings up the Update Metadata for image modal.
|
||||
* On submit, update the metadata of selected image.
|
||||
* On cancel, do nothing.
|
||||
*
|
||||
* @returns {Object} The service
|
||||
*/
|
||||
function updateMetadataService(
|
||||
$q,
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
glanceAPI,
|
||||
keystoneAPI,
|
||||
registry,
|
||||
$routeParams)
|
||||
{
|
||||
$routeParams
|
||||
) {
|
||||
var ctrl = this;
|
||||
|
||||
ctrl.image = {};
|
||||
|
|
|
@ -24,12 +24,6 @@
|
|||
'horizon.framework.util.i18n.gettext'
|
||||
];
|
||||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name imageStatusFilter
|
||||
* @description
|
||||
* Takes raw image status from the API and returns the user friendly status.
|
||||
*/
|
||||
function imageStatusFilter(gettext) {
|
||||
var imageStatuses = {
|
||||
'active': gettext('Active'),
|
||||
|
@ -40,10 +34,20 @@
|
|||
'deleted': gettext('Deleted')
|
||||
};
|
||||
|
||||
return function (input) {
|
||||
return filter;
|
||||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name imageStatusFilter
|
||||
* @param {string} input - The status code
|
||||
* @description
|
||||
* Takes raw image status from the API and returns the user friendly status.
|
||||
* @returns {string} The user-friendly status
|
||||
*/
|
||||
function filter(input) {
|
||||
var result = imageStatuses[input];
|
||||
return angular.isDefined(result) ? result : input;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}());
|
||||
|
|
|
@ -24,14 +24,18 @@
|
|||
'horizon.framework.util.i18n.gettext'
|
||||
];
|
||||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name imageTypeFilter
|
||||
* @description
|
||||
* Takes a raw image object from the API and returns the user friendly type.
|
||||
*/
|
||||
function imageTypeFilter(gettext) {
|
||||
return function (input) {
|
||||
return filter;
|
||||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name imageTypeFilter
|
||||
* @param {Object} input - An image object
|
||||
* @description
|
||||
* Takes a raw image object from the API and returns the user friendly type.
|
||||
* @returns {Function} The filter
|
||||
*/
|
||||
function filter(input) {
|
||||
if (null !== input &&
|
||||
angular.isDefined(input) &&
|
||||
angular.isDefined(input.properties) &&
|
||||
|
@ -40,7 +44,7 @@
|
|||
} else {
|
||||
return gettext('Image');
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}());
|
||||
|
|
|
@ -27,12 +27,13 @@
|
|||
/**
|
||||
* @ngdoc filter
|
||||
* @name imageVisibilityFilter
|
||||
* @param {Object} gettext
|
||||
* @description
|
||||
* Takes a raw image object from the API and returns the user friendly
|
||||
* visibility. Handles both v1 (is_public) and v2 (visibility).
|
||||
*
|
||||
* @param {Object} image - Image object from the glance API.
|
||||
* @param {string} currentProjectId (optional) Pass this in if the filter should derive the
|
||||
* {Object} image - Image object from the glance API.
|
||||
* {string} currentProjectId (optional) Pass this in if the filter should derive the
|
||||
* sharing status based on the current project id. If the image is non-public and the image
|
||||
* is not "owned" by the current project, then this will return a visibility of "Shared with Me".
|
||||
*
|
||||
|
@ -53,6 +54,7 @@
|
|||
* Or, to include deriving the shared with me status:
|
||||
*
|
||||
* var visibility = imageVisibilityFilter(image, currentProjectId);
|
||||
* @returns {function} The filter
|
||||
*/
|
||||
function imageVisibilityFilter(gettext) {
|
||||
var imageVisibility = {
|
||||
|
|
|
@ -118,7 +118,7 @@
|
|||
// Bad input still gives a translated status of unknown
|
||||
|
||||
it('returns Unknown for is_public = undefined', function () {
|
||||
expect(imageVisibilityFilter({is_public: undefined})).toBe(expected.unknown);
|
||||
expect(imageVisibilityFilter({})).toBe(expected.unknown);
|
||||
});
|
||||
|
||||
it('returns Unknown for null', function () {
|
||||
|
@ -126,7 +126,7 @@
|
|||
});
|
||||
|
||||
it('returns Unknown for undefined input', function () {
|
||||
expect(imageVisibilityFilter(undefined)).toBe(expected.unknown);
|
||||
expect(imageVisibilityFilter()).toBe(expected.unknown);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -146,6 +146,7 @@
|
|||
* @ngdoc value
|
||||
* @name horizon.app.core.images.events
|
||||
* @description a list of events for images
|
||||
* @returns {Object} The event object
|
||||
*/
|
||||
function events() {
|
||||
return {
|
||||
|
@ -165,9 +166,12 @@
|
|||
];
|
||||
|
||||
/**
|
||||
* @name horizon.app.core.images.tableRoute
|
||||
* @name horizon.app.core.images.detailsRoute
|
||||
* @name config
|
||||
* @param {Object} $provide
|
||||
* @param {Object} $windowProvider
|
||||
* @param {Object} $routeProvider
|
||||
* @description Routes used by this module.
|
||||
* @returns {undefined} Returns nothing
|
||||
*/
|
||||
function config($provide, $windowProvider, $routeProvider) {
|
||||
var path = $windowProvider.$get().STATIC_URL + 'app/core/images/';
|
||||
|
|
|
@ -30,11 +30,18 @@
|
|||
];
|
||||
|
||||
/**
|
||||
* @ngdoc controller
|
||||
* @name horizon.app.core.images.steps.CreateVolumeController
|
||||
* @description
|
||||
* This controller is use for creating an image.
|
||||
*/
|
||||
* @ngdoc controller
|
||||
* @name horizon.app.core.images.steps.CreateVolumeController
|
||||
* @param {Object} $scope
|
||||
* @param {Object} $filter
|
||||
* @param {Object} cinder
|
||||
* @param {Object} nova
|
||||
* @param {Object} quotaChartDefaults
|
||||
* @param {Object} events
|
||||
* @description
|
||||
* This controller is use for creating an image.
|
||||
* @return {undefined} No return value
|
||||
*/
|
||||
function CreateVolumeController($scope, $filter, cinder, nova, quotaChartDefaults, events) {
|
||||
var ctrl = this;
|
||||
|
||||
|
@ -189,7 +196,7 @@
|
|||
}
|
||||
|
||||
function getPercentUsed(used, total) {
|
||||
return Math.round((used / total) * 100) + '%';
|
||||
return Math.round(used / total * 100) + '%';
|
||||
}
|
||||
|
||||
function getSourceImage(image) {
|
||||
|
|
|
@ -38,9 +38,20 @@
|
|||
* @ngdoc controller
|
||||
* @name horizon.app.core.images.table.ImagesTableController
|
||||
*
|
||||
* @param {Object} $q
|
||||
* @param {Object} $scope
|
||||
* @param {String} detailsRoute
|
||||
* @param {Object} events
|
||||
* @param {Object} imageResourceType
|
||||
* @param {Object} glance
|
||||
* @param {Object} userSession
|
||||
* @param {Object} typeRegistry
|
||||
* @param {Object} imageVisibilityFilter
|
||||
* @description
|
||||
* Controller for the images table.
|
||||
* Serves as the focal point for table actions.
|
||||
*
|
||||
* @returns {undefined} No return value
|
||||
*/
|
||||
function ImagesTableController(
|
||||
$q,
|
||||
|
|
|
@ -28,8 +28,12 @@
|
|||
|
||||
/**
|
||||
* @ngdoc factory
|
||||
* @name horizon.app.core.images.workflows.create-volume.service
|
||||
* @name createVolumeService
|
||||
* @param {String} basePath
|
||||
* @param {Object} workflowService
|
||||
* @param {Object} gettext
|
||||
* @description A workflow for the create volume action.
|
||||
* @returns {undefined} No value returned
|
||||
*/
|
||||
function createVolumeService(basePath, workflowService, gettext) {
|
||||
var workflow = workflowService({
|
||||
|
|
Loading…
Reference in New Issue