Commit Graph

15 Commits

Author SHA1 Message Date
Pascal Boutin 09a2afef35 Fix the error format of glance's createImage
Uppon failure, the createImage function returned a raw xhr error
that was incompatible with the wizard modal, making it display
the [Object object] error.

This change makes it so a generic error message is thrown directly
if it's not an handled glance error, so it could be shown on top of
the wizard modal.

Change-Id: I637bf1002630fe21f5ad20a7a047ec65ebc052dc
Closes-bug: #1703708
2017-07-27 09:50:50 -04:00
Jenkins ae764497ec Merge "Reject result when createImage call has error" 2017-06-02 19:15:02 +00:00
Gary Smith a25670fd42 Add api unit tests to improve coverage
Add jasmine unit tests to cover neutron.service and glance.service to
increase the code coverage, giving a little more breathing room over the
minimum thresholds.

Change-Id: Ibcb1dc390584b3e6a15e22c62c42eb5392501a19
2017-06-02 10:00:29 -07:00
gugl 9d2c4b0485 Reject result when createImage call has error
When there is an error from createImage, it still invokes
onCreateImage function which should be invoked only when
successful service call. Fixed onError function to throw
the error and the error will show up in the modal toast
message.

Change-Id: I20725f894835714d8245ec8b192937110cf11ab5
Closes-bug: #1630833
2017-05-02 13:51:00 -07:00
Timur Sufiev 60a265a10e [NG] Enhance Create Image workflow with upload tracking
Create Image service uses $scope captured in a closure var `scope` to
pass the upload progress of the local image file to Glance service
into modal form controller.

Implements blueprint: horizon-glance-large-image-upload
Change-Id: I98711e6a5e59c91ef71a726a6ff094767d421ef7
2016-08-09 14:17:47 +03:00
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
Matt Borland 2d6e0fb0b8 Fix bad/inefficient API call for JS getImage()
The Angular API library for Glance has a function getImage().  This
function currently calls to an API like:

/api/glance/images/abasdfasdfas

However, that returns a 301 and redirects to:

/api/glance/images/abasdfasdfas/ <-- trailing slash

This causes latency and unnecessary overhead.

To test this fix, first verify the 301 problem before applying:

Run Horizon in debug (watch the server responses)
Enable the NG Images panel (enable _1051_ng_image...).
Go to the NG Images panel, then as you click on a Details view,
withess the 301 call with no trailing slash, followed by a
successful call with a 200 and trailing slash.

Then apply the patch.

Then do the same, but notice how there is only one 200 call, with
the trailing slash.

Change-Id: I0f119e2568d41c4aa63176a8bf8f2fabfbed1b47
Closes-Bug: 1559279
2016-03-18 13:59:41 -06:00
Rajat Vig 0cd8c89731 API for Metadata Definitions
Adding REST API calls for use in the new angularized
panels for Metadata definitions.

Set DISABLED = False in
openstack_dashboard/enabled/_2131_admin_metadata_defs_panel.py

Change-Id: I08c9c05a7b0870160ede7eb7645fc9daa83e2dd5
Partially-Implements: blueprint ng-metadata-defs-panel
2016-01-13 10:01:53 -08:00
Rajat Vig 2b3ab06715 Add Action to delete multiple and single images to images panel
Adds the ability to delete multiple images
from the images panel.
Adding row action to delete single image to angular images panel

Work needs to be done on the actionss directive per the feedback

To test set DISABLED = False in _1051_project_ng_images_panel.py

Co-Authored-By: Kristine Brown<kbrown@thoughtworks.com>
Co-Authored-By: Errol Pais<epais@thoughtworks.com>
Co-Authored-By: Kyle Olivo<keolivo@thoughtworks.com>

Change-Id: I59d13e0b2225f2b3a05f93b2356029561dbd28bc
Partially-Implements: blueprint angularize-images-table
2016-01-07 11:14:19 -08:00
Rajat Vig ae6d42cbbd Add API to Create/Update/Delete Images in Glance
Co-Authored-By: Matt Borland <matt.borland@hpe.com>

Change-Id: I44360da3c30856dd875ab6b30c024b29dc4de4c7
Partially-Implements: blueprint angularize-images-table
2015-12-01 13:03:46 -07:00
Rajat Vig 7d004a34f1 Add REST API to get Glance API Version
This is needed to check if Image Metadata can be
updated.

Change-Id: I23f8b84f5f72a6423b0c453413faef25f2e139d2
Partially-Implements: blueprint angularize-images-table
2015-10-29 14:22:58 -07:00
Michael Krotscheck d7ef2b34bf Upgraded eslint rule libraries.
The newer version of eslint comes with somewhat stricter rules
about indentation and whitespace, so some files have been
adjusted to accomodate.

The newer version of eslint-config-openstack includes a relaxed
version requirement for eslint, as well as a switch/case
indentation update.

The newer version of the angular eslint rules includes a
deprecation rule for $cookieStorage, which has been set to
warning.

Change-Id: Id201a42e3ab484222f938a541507df2e96da2dcf
Partially-Implements: blueprint jscs-cleanup
2015-10-16 06:34:25 -07:00
Szymon Wroblewski f030262521 Angular metadata update modal
This patch adds metadata update modal dialog widet written in js
and some required REST API methods.

To see it in action checkout following patch
https://review.openstack.org/#/c/184275/
which replaces old metadata modals with new ones written in angular.

Co-Authored-By: Shaoquan Chen <sean.chen2@hp.com>
Co-Authored-By: Rajat Vig <rajatv@thoughtworks.com>

Partially-Implements: blueprint angularize-metadata-update-modals
Change-Id: I36bfb91f8b6bbba49fed6bb01cd1dd266261cfdb
2015-08-25 15:20:47 +02:00
Nathan Zeplowitz a898da92eb JSCS Cleanup - Use mock module to avoid using window
The specs now use common mocks to share functions for tests
instead of using the global window object

Change-Id: Ifc8f7717fcacf2ddf68997408b8e0d33e530c795
Partially-Implements: blueprint jscs-cleanup
2015-08-11 23:00:31 +00:00
Shaoquan Chen 0d4cf1661e Dashboard ReOrg - Move APIs into app/core
This patch relocates the 'openstack-service-api' directory because
they are application specific, but needed by multiple dashboards.

Co-Authored-By: Tyr Johanson <tyr@hp.com>
Co-Authored-By: Shaoquan Chen <sean.chen2@hp.com>

Change-Id: Ie5455f3ca4cfaacb99cbccd66c95fb3ad31da272
Partial-Bug: #1478717
2015-08-03 14:25:37 -06:00