diff options
author | Simon Merrick <simonmerrick@catalyst.net.nz> | 2020-02-25 16:33:42 +1300 |
---|---|---|
committer | Simon Merrick <simonmerrick@catalyst.net.nz> | 2020-04-16 22:18:06 +1200 |
commit | 2735f2c08d82f2e904dd39bab0d5f776666adacd (patch) | |
tree | 5d1050ee44b0b823d284d5ddf2bb6995796cb015 /openstack_dashboard/static | |
parent | 5791d1aa4ea0234d3305b777154ff9189ff8ff04 (diff) | |
download | horizon-2735f2c08d82f2e904dd39bab0d5f776666adacd.tar.gz |
Add support for multiple swift storage policies
+ Adds endpoint for listing available policies
+ Support to select a storage policy for new containers
+ Display container storage polcy on dashboard.
Change-Id: I588452fd5d6417859f5dd19ccedcb18f420ab646
Diffstat (limited to 'openstack_dashboard/static')
-rw-r--r-- | openstack_dashboard/static/app/core/openstack-service-api/swift.service.js | 22 | ||||
-rw-r--r-- | openstack_dashboard/static/app/core/openstack-service-api/swift.service.spec.js | 18 |
2 files changed, 32 insertions, 8 deletions
diff --git a/openstack_dashboard/static/app/core/openstack-service-api/swift.service.js b/openstack_dashboard/static/app/core/openstack-service-api/swift.service.js index 221d3c606..458bff487 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/swift.service.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/swift.service.js @@ -47,6 +47,7 @@ getObjectDetails:getObjectDetails, getObjects: getObjects, getObjectURL: getObjectURL, + getPolicyDetails: getPolicyDetails, setContainerAccess: setContainerAccess, uploadObject: uploadObject }; @@ -90,6 +91,23 @@ } /** + * @name getPolicyDetails + * @description + * Fetch all the storage policy details with display names and storage values. + * + * @returns {Object} The result of the object passed to the Swift /policies call. + * + */ + function getPolicyDetails() { + return apiService.get('/api/swift/policies/').error(function() { + toastService.add( + 'error', + gettext('Unable to fetch the policy details.') + ); + }); + } + + /** * @name getContainers * @description * Get the list of containers for this account @@ -135,8 +153,8 @@ * @returns {Object} The result of the creation call * */ - function createContainer(container, isPublic) { - var data = {is_public: false}; + function createContainer(container, isPublic, policy) { + var data = {is_public: false, storage_policy: policy}; if (isPublic) { data.is_public = true; diff --git a/openstack_dashboard/static/app/core/openstack-service-api/swift.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/swift.service.spec.js index e9500bc44..7649a7217 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/swift.service.spec.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/swift.service.spec.js @@ -61,28 +61,34 @@ testInput: [ 'spam' ] }, { + func: 'getPolicyDetails', + method: 'get', + path: '/api/swift/policies/', + error: 'Unable to fetch the policy details.' + }, + { func: 'createContainer', method: 'post', path: '/api/swift/containers/new-spam/metadata/', - data: {is_public: false}, + data: {is_public: false, storage_policy: 'nz--o1--mr-r3'}, error: 'Unable to create the container.', - testInput: [ 'new-spam' ] + testInput: [ 'new-spam', false, 'nz--o1--mr-r3' ] }, { func: 'createContainer', method: 'post', path: '/api/swift/containers/new-spam/metadata/', - data: {is_public: false}, + data: {is_public: false, storage_policy: 'nz--o1--mr-r3'}, error: 'Unable to create the container.', - testInput: [ 'new-spam', false ] + testInput: [ 'new-spam', false, 'nz--o1--mr-r3' ] }, { func: 'createContainer', method: 'post', path: '/api/swift/containers/new-spam/metadata/', - data: {is_public: true}, + data: {is_public: true, storage_policy: 'nz--o1--mr-r3'}, error: 'Unable to create the container.', - testInput: [ 'new-spam', true ] + testInput: [ 'new-spam', true, 'nz--o1--mr-r3' ] }, { func: 'deleteContainer', |