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
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
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
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
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
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
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
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
This is needed to check if Image Metadata can be
updated.
Change-Id: I23f8b84f5f72a6423b0c453413faef25f2e139d2
Partially-Implements: blueprint angularize-images-table
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
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
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
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