Before this change when a 403 error was encountered, such as failure to
have the permission to perform an operation, the user would get logged
out from UI pages written in the AngularJS framework. For example, if an
admin user lacks the get_project permission and tries to access the
images page, project->compute->images, the 403 will forcibly log out
the user.
This change keeps the user logged in when a 403 error is encountered and
displays an error message. The change only affects AngularJS pages.
Change-Id: I10a6eeb96dd1418449e1d15b1a3869cd4de9cafa
Closes-bug: #1840844
When refresh or link directly to ngdetails without existing resource type
or ID for the resource, ngdetails view shows blank view.
This patch jump to 404 page in this situation.
Change-Id: Ie95132d0fdb1e7aae5e32faad752f92ff76b238a
Closes-Bug: #1746709
This checkin includes the followings:
1.Added an error toast message when user gets
unauthorized 401 or 404 error during operation.
2.When the modal dialog shows up, it also adds an error
message at the top of the dialog.
3.Also added some unit tests to let the coverage passes
the threshold.
Change-Id: I5e0962937932a21565d374561f09f98013063a4f
Closes-bug: #1555415
As per OpenStack licensing guide lines [1]:
[H102 H103] Newly contributed Source Code should be licensed under
the Apache 2.0 license.
[1] http://docs.openstack.org/developer/hacking/#openstack-licensing
Change-Id: If9ae2195d23ee8ed4bfe3da136e647f4e291a415
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
If a session is timeout and then a user request ajax request,
Horizon redirect to Not found page because the url is incorrect.
This patch fix it in the correct url.
Change-Id: I25b9e07b4f97594d05b0cdae931af9f142a18168
Closes-bug: #1558917
Achieve this by limiting widget area to be recompiled to table/tab.
Change-Id: Icbbe2be833fccf17ba272ca920960393c9c3b667
Closes-Bug: #1561501
Closes-Bug: #1559105
Fix the issue by re-$compile-ing the content dynamically inserted by
jQuery. Ideally we should solve it by replacing jQuery insert with
Angular one. This remains a TODO for Newton release.
Closes-Bug: #1514627
Co-Authored-By: Matt Borland <matt.borland@hpe.com>
Change-Id: Ifbe063e9dd6c20930a1ed4fa14dddb2d0f762902
The dropdownToggle directive from angular-ui/bootstrap v0.11.2
conflicts with the native Bootstrap data-toggle="dropdown" attribute
(see https:github.com/angular-ui/bootstrap/issues/2156). This is fixed
in 0.13, but before that it'd be valuable to ensure that the same html
markup works the same way with both versions of angular-ui/bootstrap
(0.11.2 and 0.13). The decorator code could be safely deleted once
Horizon migrates to angular-ui/bootstrap v0.13.
Also fix dropdowns in material theme templates.
Closes-Bug: #1466146
Change-Id: I8f01c1ce7b0a5dc29bf9d8aba23c9ea7e6e1ec35
Using strict DI mode will improve angular's performance when injecting
dependencies in injectable functions because it doesn't have to
dynamically discover a function's dependencies.
It is suggested by Angular official web site to use strict dependency
injection mode in production for get better performance:
https://docs.angularjs.org/guide/di#using-strict-dependency-injection
This patch fixes all the places where explicit di is not applied, and
then enables strict-di mode in production.
This is prioritized as CRITICAL for Horizon Mitaka release:
https://etherpad.openstack.org/p/mitaka-horizon-priorities
Change-Id: I1c0e01d7ac9aec03d961f14ff7297bc98c513637
Implements: blueprint angular-performance-strict-di
The WEB_ROOT setting needs to be respected rather than assuming / as
the root of the application. Simiarly, we can not assume that STATIC_URL
is a sub url of the WEB_ROOT. They can be configured as two indepedent url.
Angular templates are loaded dynamically with Ajax, which requires an
absolute base path. We define those base paths as angular constants for
template use and future routing.
TO TEST, follow directions at:
http://docs.openstack.org/developer/horizon/topics/settings.html#webroot
Co-Authored-By: Matt Borland <matt.borland@hp.com>
Co-Authored-By: Shaoquan Chen <sean.chen2@hp.com>
Co-Authored-By: Thai Tran <tqtran@us.ibm.com>
Change-Id: Ifcd459633682edc94b270019ce77e17d64bea22d
Closes-Bug: #1451681
Using $window instead of window for testability.
Fixing angular/ng_di for the framework module.
Adding unit test covering 401 redirects.
Change-Id: I1f3d359be2093766d995897c4809c816845f11a7
Partially-Implements: blueprint jscs-cleanup
This is the last patch of this ngReorg series!!
This commit attempts to refactor the "hz" module and horizon.js
into "dashboard-app" because the code is actually bootstrapping
the default dashboard application, created using framework and
openstack_dashboard pieces. Ideally, this moves into a directory
that is a peer to openstack_dashboard, but for now, it is at
least grouped together with a name that reflects its purpose.
This was the last step in a larger effort to restructure the Angular
source. See https://review.openstack.org/#/c/176152/ for the
full set of planned changes.
The next refactoring effort (not addressed by this patch series)
is to restructure the Django templates so that
horizon.dashboard-app can be moved OUT of horizon/horizon.
Change-Id: If2cbc243ebfd0b2f1f834056e34b8e2d3df06060
Closes-Bug: #1454880
This commit collects UI components into a new
'horizon.framework.widgets' module. It also standardizes
the naming pattern for .scss files and makes them hierarchical.
This is one step in a larger effort to restructure the Angular
source. See https://review.openstack.org/#/c/176152/ for the
full set of planned changes.
Change-Id: I2edabd6c43f811a4bb2e3abe982dbc24958ddf93
Partial-Bug: #1454880