horizon/horizon/static/framework
Timur Sufiev 0e1279d05c [NG] Support local file upload in Create Image workflow
First, now there are 2 '/api/glance/images/ API wrapper endpoints for
creating a new image - POST and PUT. The POST endpoint which existed
before now resides at PUT. This was done to support legacy
(i.e. proxied by web-server) file uploads in Angular Create Image,
because Django (which we need to use in that case) doesn't correctly
process PUT request. So, if local file binary payload is added to the
form contents, we send it using POST request.

Second, speaking of '/api/glance/images' PUT request previously known
as POST... Where before the POST call to Horizon REST API wrappers
returned the final image object that Glance just created, now there
are two possibilities for what happens after PUT is sent.

* When Create Image form Source Type is set to URL, then everything is
  going as before.
* When Source Type is set to File, then just a file name instead of an
  actual Blob is sent to '/api/glance/images', then the Glance Image
  is queued for creation and Horizon web-server responds with an Image
  object which dict() representation has 2 additional keys:
  'upload_url' and 'token_id'. The 'upload_url' tells the location for
  the subsequent CORS request, while 'token_id' is passed as a header
  in that request, so Keystone would let it in. CORS upload is started
  immediately as Image is queued for creation (first promise is
  resolved) and returns the second promise, which is resolved once the
  upload finishes. The modal form hangs until second promise resolves
  to indicate that upload is in progress. Upload progress notification
  is added in a follow-up patch.

DEPLOY NOTES

The client-side code relies on CORS being enabled for Glance service
(otherwise browser would forbid the PUT request to a location
different from the one form content came from). In a Devstack setup
you'll need to edit [cors] section of glance-api.conf file, setting
`allowed_origin` setting to the full hostname of the web server (say,
http://<HOST_IP>/dashboard).

Related-Bug: #1467890
Implements blueprint: horizon-glance-large-image-upload
Change-Id: I5d842d614c16d3250380ea1dc1c6e0289d206fb5
2016-08-08 20:02:22 +03:00
..
conf Merge "hz-dynamic-table: Column level permissions" 2016-07-30 02:16:42 +00:00
util [NG] Support local file upload in Create Image workflow 2016-08-08 20:02:22 +03:00
widgets Add Angular Schema Form 2016-08-04 16:53:41 +00:00
.eslintrc Add selective ESLint rule activation for Horizon Legacy JS 2015-07-08 17:06:15 -07:00
framework.module.js [NG] Support local file upload in Create Image workflow 2016-08-08 20:02:22 +03:00
framework.module.spec.js Fix the issue which redirect to Not Found page 2016-03-30 13:10:43 +00:00
framework.scss ngReorg - create 'widgets' module 2015-05-19 09:55:58 -06:00