Commit Graph

15 Commits

Author SHA1 Message Date
Gloria Gu ab0e96df95 Avoid forced logout when 403 error encountered
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
2019-09-03 17:15:41 +00:00
Shu Muto 58af806796 Move to '404' page when resource type or resource not found
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
2018-08-28 14:15:02 +09:00
gugl 2415d5ea59 Added error msg when gets redirect to login page
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
2017-07-05 16:24:20 -07:00
Cao Xuan Hoang b01c028673 Add Apache 2.0 license to source file
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
2016-12-02 17:40:28 +07: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
Kenji Ishii 9399680106 Fix the issue which redirect to Not Found page
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
2016-03-30 13:10:43 +00:00
Timur Sufiev d51bcdcbda Fix opening multiple Launch Instance during jQuery table polling
Achieve this by limiting widget area to be recompiled to table/tab.

Change-Id: Icbbe2be833fccf17ba272ca920960393c9c3b667
Closes-Bug: #1561501
Closes-Bug: #1559105
2016-03-25 15:06:57 +03:00
Timur Sufiev 2de6baae34 Fix non-working Angular actions in jquery modified tables
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
2016-03-17 18:23:37 +00:00
Timur Sufiev dab7e45c74 Fix for the broken header's dropdowns for both v0.11.2 and v0.13
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
2015-11-26 18:00:26 +03:00
Shaoquan Chen 67beea4138 Enabling strict di mode
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
2015-11-19 15:11:39 -08:00
Thai Tran 35e47358f0 Fix bug where WEBROOT is not respected
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
2015-07-22 04:10:50 +00:00
Dan Siwiec 8686148d44 Fix eslint error on framework.module.
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
2015-07-12 12:39:20 -07:00
Kelly Domico ffbfe81465 JSCS cleanup - horizon/static/framework conf and util
We need to do cleanup before we can enable JSCS globally
(https://review.openstack.org/#/c/185725/).

This patch excludes the 'util/tech-debt' folder which is
covered in patch: https://review.openstack.org/#/c/188316/.

Change-Id: I0b3e6435d48a24c0b24e38c96b1ce679c3268300
Partially-Implements: blueprint jscs-cleanup
2015-06-16 09:51:39 -07:00
Tyr Johanson 31de099efb ngReorg - Create dashboard-app
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
2015-05-22 08:43:38 -06:00
Tyr Johanson 5762d0deee ngReorg - create 'widgets' module
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
2015-05-19 09:55:58 -06:00