Commit Graph

25 Commits

Author SHA1 Message Date
Tatiana Ovchinnikova 557a56c102 Drop readonly image metadata properties from request
Glance doesn not accept editing specific readonly metadata
properties, so we need to remove them from update request.

Change-Id: Ia9d8381f4add5cf6d82f2568b483d1c0b8d1a8b7
2023-02-23 15:00:47 -06:00
Tatiana Ovchinnikova f044c4b0a3 Migrate to AngularJS v1.8.2
This patch aligns current code with AngularJS v1.8.2 requirements.

Change-Id: Ifdad18e805953957bfaa1b42908dfbbe8976dbcb
2022-06-08 15:43:13 -05:00
Andy Botting 04fe1156bf Support setting more visibility options for edit/create image
The edit and create image pages could only set public or private
visibility for an image. With Glance v2, we have 'shared' and
'community' available to us. This commit adds buttons for those
pages selectively when the policy allows it.
It also only displays 'public' visibility if policy allows.

Closes-Bug: #1792411

Depends-On: https://review.openstack.org/#/c/614688/

Change-Id: I193bc0580e4bf9351ad7f17b148a5062e95313ab
2019-03-13 09:29:47 +11:00
yanghuichan c1d91d21a4 Fix wrong links in horizon
Some docs links have changed.
We should update the wrong links in our codes.

Change-Id: Ia726eaa4d3154a4152d1f685349de98386f42ef0
2017-09-12 15:23:26 +08:00
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
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
Itxaka 9697a9f580 bump eslint version to 1.10.3
bumps the eslint version to 1.10.3 which fixes a lot of
issues, especially rules not working as expected
or being ignored and brings the js code up to date to
comply with those rules.

Change-Id: I1234e7991f98d4ceb0c5333dc036c6a30206ff64
2016-03-31 14:06:45 +00:00
Matt Borland 09148f68d6 Cleaning up eslint warnings in the openstack-service-api directory
There are many eslint warnings in this directory.  This patch cleans
them up, about 100 warnings removed.

Change-Id: I639dccd7b511190552f05ae0e52234532412e54c
Partial-Bug: 1554824
2016-03-25 15:41:15 +00: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
Itxaka cfbfab4142 Reduce lint warnings
Reduce some of the most obvious lint warnings like braces.

Change-Id: Ib4740ed0cf358374600a99c69559fec52215727c
2016-02-25 10:28:42 +01:00
Jenkins fab5990aa5 Merge "Use interpolate in JS to allow translators to control word order" 2016-02-12 21:56:00 +00:00
Justin Pomeroy e19bb206bb Use OS::Nova::Server resource type for instance metadata
Horizon currently uses the OS::Nova::Instance resource type when
querying for instance metadata, but it should use OS::Nova::Server
to align with Heat and Searchlight.

See also:
  https://review.openstack.org/272271

Closes-Bug: #1537903
Change-Id: I1deab8ed74515d08301e68bd2c75604d35592c50
2016-02-05 19:02:18 +00:00
Justin Pomeroy e55240d882 Support properties_target when fetching namespaces
This allows specifying a properties target when fetching metadata
definitions namespaces from glance, and updates the instance
metadata widget to show only "metadata" properties (as opposed to
"scheduler_hints") when creating an instance or updating the
metadata.

Closes-Bug: #1537842
Change-Id: I64dd279139eca2cbd0c0a6e808ade4cbcba8df95
2016-01-29 15:47:28 -06:00
Akihiro Motoki ed28f129d5 Use interpolate in JS to allow translators to control word order
String concatenation is not recommended for better translation.

Closes-Bug: #1522317
Change-Id: Ib90f8e119d330b27023f2ef05bd24b048f1045bb
2016-01-18 11:08:53 +00: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
hgangwx 5e855ddba8 Wrong usage of "an"
Wrong usage of "an" in the mesages:
"Width an height of the chart will be taken from chart wrapper"
"an flavor. By default this will return the flavors"
"allocate an floating IP"
"Each item is an namespace"

Should be:
"Width and height of the chart will be taken from chart wrapper"
"a flavor. By default this will return the flavors"
"allocate a floating IP"
"Each item is a namespace"

Totally 5 occasions in Horizon base code.

Change-Id: I154257da9c93b33fc7353e2e642e9e406978162b
2015-12-30 13:53:53 +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
Rajat Vig 60ba217951 Uncapitalize the first letter of non init functions
Several files contain capital letters instead of lower case ones in
non init functions as discussed here:
https://review.openstack.org/#/c/216443/3/openstack_dashboard/static/app/core/openstack-service-api/heat.service.js

Change-Id: I79d7eaaa11c9475184ede580d10cc5fd2bc3ded7
Closes-Bug: #1501860
2015-10-01 11:06:06 -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
Rajat Vig 28d99113b8 Use the JP Style Guide for OpenStack Services
Use the Service style as documented in
https://github.com/johnpapa/angular-styleguide#style-y052

Fix a eslint error on security-group.service.spec.js
Changes API Services from Angular service to factory.

Change-Id: I76ef729e51878d67c355d1edc774d936038d7f62
Partially-Implements: blueprint john-papa-style-guide
Partially-Implements: blueprint jscs-cleanup
2015-08-24 18:31:20 +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