Commit Graph

157 Commits

Author SHA1 Message Date
Zuul 9607dfbba4 Merge "Update jQuery click event to remove deprecation warning" 2023-04-25 00:22:38 +00:00
manchandavishal 6b0aa20179 Update jQuery click event to remove deprecation warning
The shorthand jQuery.fn.click() event has been deprecated in favor
of the on() method. This patch updates the code to use the on()
method instead to remove the deprecation warning. For more
information about the deprecation of jQuery.fn.click(),
please refer [1].

[1] https://api.jquery.com/click/

Change-Id: Ic44aaded8d0aaa70e38e46d4121dc3c825f3b831
2023-04-12 22:16:53 +05:30
Radomir Dopieralski 4a89303231 Clean up the syntax of html attributes to always use double quotes
Our templates are very inconsistent and sometimes even use single and
double quotes in the same tag. This is an attempt to clean it up a
little and use double quotes everywhere.

In addition, I have run into a problem with single quotes being
incorrectly escaped by the Django compressor, and I want to see if
this will help with the issue.

Change-Id: I2d5137a87ed65c6abef38a49264346f917a1c85a
2023-04-05 11:00:26 +02:00
Akihiro Motoki d9266fd82c Address RemovedInDjango40Warning (3)
In Django 3.1, django.conf.urls.url() is deprecated
in favor of django.urls.re_path().

https://docs.djangoproject.com/en/4.0/releases/3.1/#id2

Change-Id: I484694f8718f61c022126a1935cf28fce075894b
2022-02-04 16:26:54 +09:00
Akihiro Motoki cd7c1b5110 Address RemovedInDjango40Warning (2)
django.utils.translation.ugettext(), ugettext_lazy(), ugettext_noop(),
ungettext(), and ungettext_lazy() are deprecated in favor of the
functions that they’re aliases for: django.utils.translation.gettext(),
gettext_lazy(), gettext_noop(), ngettext(), and ngettext_lazy().

https://docs.djangoproject.com/en/4.0/releases/3.0/#id3

Change-Id: I77878f84e9d10cf6a136dada81eabf4e18676250
2022-02-04 16:22:07 +09:00
Akihiro Motoki e5d09edc20 Use python3-style super()
In python3, super() does not always require a class and self reference.
In other words, super() is enough for most cases.
This is much simpler and it is time to switch it to the newer style.

pylint provides a check for this.
Let's enable 'super-with-arguments' check.

NOTE: _prepare_mappings() method of FormRegion in
openstack_dashboard/test/integration_tests/regions/forms.py is refactored.
super() (without explicit class and self referece) does not work when
a subclass method calls a same method in a parent class multiple times.
It looks better to prepare a separate method to provide a common logic.

Change-Id: Id9512a14be9f20dbd5ebd63d446570c7b7c825ff
2020-10-15 14:37:20 +09:00
Takashi Kajinami b4487fe264 Remove ceilometer from osprofile backend
Ceilometer support in osprofile was removed long ago[1] and no longer
available.

[1] 0bb909c7a039f17b957d920c93d366d89e581280

Change-Id: I11be3a2f854ac75ba5dc3fd82e84cb3d99f81034
2020-05-22 05:56:20 +00:00
Ivan Kolodyazhny d870b40583 Remove six usage from openstack_dashboard package
We don't support Python 2 anymore so we don't need this
compatibility library.

six.reraise usages are left as is until it'll be moved to some
base lib like oslo.utils to not re-implenent this method in
Horizon.

This patch also removes Python2-specific base test case methods
assertItemsEqual and assertNotRegexpMatches in flavor of new
Python 3 analogues.

Change-Id: I26a59176be9e9f213128e4945a58b9459334b626
2020-01-15 12:47:48 +02:00
Akihiro Motoki ec970fd6e8 Handle partial dict setting
In Train cycle, we moved the definition of default values
to openstack_dashboard/defaults.py. The current code accesses
a dict member using []. It requires operators to define a dict
setting with a full member.

This commit allows to use dict-type settings with partial members.

A new function is introduced to retrieve a dict-type setting
considering default values defined in
{openstack_dashboard,horizon,openstack_auth}/defaults.py

Change-Id: I7ff0ad4bca698aef9c0eba370b0570200a14367a
Closes-Bug: #1843104
2019-09-26 14:31:17 +09:00
Ivan Kolodyazhny 86d13968d8 Remove unused 'not_list' template argument
This is unused in Horizon itself and I didn't find any
references in plugins. Undefined variable leads to
errors during render in a debug mode.

Partial-Bug: #1720893

Change-Id: I9de0b24adfeb48f5fe14676aaec6b17b8eb52207
2019-09-10 08:41:51 +00:00
Akihiro Motoki 2f1e1899d3 Define default settings explicitly (openstack_dashboard 5/5)
This commit mainly covers settings in the remaining files
under openstack_dashboard.

Note that HORIZON_CONFIG, horizon and openstack_auth are not covered.
They will be covered by follow-up patches.

Part of blueprint ini-based-configuration
Change-Id: Ibd70e030445a073d9a62da9867850f4893135a89
2019-07-08 18:20:32 +09:00
Michal Arbet e531b7babe Fix osprofiler support in horizon
This patch is fixing usage of osprofiler in horizon.
It has been merged once, but after merge to master,
manage.py compress starts to fail with python2.7.

This fail was caused by "TypeError: 'encoding' is an
invalid keyword argument for this function" which is
now fixed by using six library.

Change-Id: I21aa8d49833bef9e7673958d15674faec82a0925
Closes-Bug: #1814028
Related-Bug: #1811261
2019-01-31 14:06:45 +01:00
Zuul d27fcc0998 Merge "Revert "Fix osprofiler support in horizon"" 2019-01-31 11:46:58 +00:00
Akihiro Motoki 508818d90f Revert "Fix osprofiler support in horizon"
This reverts commit 96aded3c34.

The reverted commit breaks "manage.py compress" in python 2.7 env.
python 2.7 support is more important than osprofiler support,
so we revert this once and then tackle the original osprofiler issue.

Change-Id: Iff497a96fd62b447906a0c58fdcd6ce717d6fabe
Related-Bug: #1814028
Related-Bug: #1811261
2019-01-31 05:38:15 +00:00
Zuul 47b23498d6 Merge "Fix osprofiler support in horizon" 2019-01-31 04:08:52 +00:00
Michal Arbet 96aded3c34 Fix osprofiler support in horizon
Change-Id: I3c0d8e449bd78097a68bd40741977392ea14d6dd
Closes-Bug: #1811261
2019-01-21 11:20:16 +01:00
Michal Arbet a25d6b3312 Fix developer panel when debug is set to False
When developer panel is enabled in horizon via local enabled files,
and in local_settings.py is DEBUG = False,horizon start without
whole left side panel because dashboard with slug "developer"
is not registered. Correct fix is to register, but set it to not allowed.

Change-Id: Icbfc9ba11b07d6dbc33ed60df0dcf84dc4141429
Closes-Bug: 1812230
2019-01-20 13:13:52 +01:00
Akihiro Motoki c076db20c8 pylint: fix len-as-condition warning
Change-Id: Ib89c1854ad42b96e4caf281160d568fe98430afe
2019-01-16 12:56:20 +09:00
Stuart Grace 2e2ef6a8d0 Delete profiler object when request completes
When a request that is being profiled completes and the response is
received, the middleware expires the profiling cookie. It also needs
to delete the profiling object that holds the base_id UUID so a new
base_id will be created for the next profile. Otherwise the same
base_id is used for subsequent queries and they become merged togther
in the database.

Change-Id: I379cebfa2ed5282c96df0e255a8ba04c65a8523c
Closes-Bug: #1777486
Depends-On: https://review.openstack.org/578362
2018-07-24 12:33:31 +01:00
Stuart Grace 3a579e643a Don't remove last char from profiling cookie path
Code was stripping last char from path when expiring the cookie that
controls profiling. For example, cookie created at /admin/info/
was being expired as /admin/info without final "/". This can fail
to find the cookie (browser dependent?) and leave profiling active
for all subsequent refreshes of the view.

Change-Id: I71d36ab3ff121cc43b8d0b43a056ba26aa030058
2018-06-15 17:43:19 +01:00
Akihiro Motoki 3ecda5ac67 django2: adopt New-style middleware
Django 1.10 introduces a new style of middleware and
the old style was removed in Django 2.0.

https://docs.djangoproject.com/en/2.0/releases/1.10/#new-style-middleware

blueprint django2-support
Change-Id: I2fba2b1b2b528096422df3ed558ad75a1b80bbb9
2018-03-03 07:22:35 +09:00
Akihiro Motoki 1a252cb5e8 django2: is_authenticated/is_anonymous is now property only
https://docs.djangoproject.com/en/2.0/releases/1.10/#user-is-auth-anon-deprecation

blueprint django2-support
Change-Id: I57a39417f0595eae8d1c06d7e61d0a67078bb231
2018-02-17 01:36:54 +09:00
Akihiro Motoki e477eafa45 django2: Replace django.core.urlresolves with django.urls
(In Django 2.0) The django.core.urlresolvers module is removed
in favor of its new location, django.urls.
It was depreacted in Django 1.10:
https://docs.djangoproject.com/en/2.0/releases/1.10/#id3

blueprint django2-support
Change-Id: I46ab5c325491274b8eaffbf848e5d80f83c2fd26
2018-02-17 01:36:48 +09:00
Akihiro Motoki 4b1131aaed i18n: Do not include html directives in translation strings
It is important not to include html directives in translation targets
as much as possible to avoid unnecessary errors when selecting
translated languages.

Note that this commit does not necessarily exclude all html directives
from translation strings. Some of them needs to be included to allow
translators to control the word order properly.
This commit mainly focuses on eliminate unrelated html directives.

Change-Id: I66a24d4b01e695aab226b7c1cd4bc4f50ab33a7f
2018-01-31 22:31:53 +09:00
Shu Muto 9a758638ee Remove deprecated scope handling
The `initScope` function is deprecated since ocata, so this patch
replaces it into `initAction` if it needed, or removes it.
Also, gets scope from second parameter of perform function.
Futher more, removes deprecated `scope` parameter for `modal`
function of wizard-modal-service.

Change-Id: I8979b699a9b4383b894db9bdcbad80f15c1df150
Closes-Bug: #1640049
2017-11-01 14:51:50 +09:00
Akihiro Motoki af3b7e4134 flake8-import-order: Ensure to place project imports last
To ensure project imports are placed after third party import,
we need to specify application-import-names.
Previously flake8-import-check checks only standard imports or not.

Change-Id: I9beb2105f686dc7d9aebfce8e21c5e182698e2fe
2017-09-20 01:19:38 +00:00
Diana Whitten 1bf5c9752c Theme Preview Page should include datepicker.
Change-Id: I8b107dd3a28c8434fe5c5e5ba8e3ef0ecd1df0f2
partially-implements: blueprint bootstrap-theme-preview
Depends-On: https://review.openstack.org/#/c/318933
2017-07-27 10:24:33 -07:00
Akihiro Motoki baa4ca8dce hacking: noqa cleanup in openstack_dashboard
attribute-level imports are not checked by hacking module now.
most noqa is used to disable warnings on attribute-level imports.
This commit drops noqa for this purpose.

After this, there are only 3 noqa under openstack_dashboard/ :)

Change-Id: I4a449802f5dbd6e44e4b8b5c378a555d47d9a99f
2017-03-17 19:38:47 +00:00
Jenkins 4187837434 Merge "Define profiler constant to fix /jasmine test run" 2017-03-14 09:49:44 +00:00
Tyr Johanson 9ed4acd4ff Schema Form Developer Panel
A developer panel that allows you to edit schema forms in real-time,
with multiple examples. Also, you can view that same form in a
standard Horizon modal to preview what the form will look like. Based
on http://schemaform.io/examples/bootstrap-example.html

Also fixes some bugs in the schema-form implementation:
- Arrays cleaned up and fixed
- Tab arrays cleaned up
- Improved modal form to use schema.title if available

Co-Authored-By: Rob Cresswell <robert.cresswell@outlook.com>
Change-Id: Ia75a18d4c0c064ae618ee923cd6d602b1ef6e66e
2017-02-22 11:01:02 +11:00
Richard Jones 0f55a5268f Define profiler constant to fix /jasmine test run
Change-Id: Ie7aa0e1652b02ccbd9d1f3a776a041ecd3e1aa9b
Closes-Bug: 1665539
2017-02-21 11:07:26 +11:00
Richard Jones d256d0025f Fix reporting of profiler traces with multiple toplevels
The Profiler panel was only showing the first of potentally
many toplevel events in a request. This patch reinstates
those events by displaying the root event rather than
its first child.

Change-Id: Ifeb0c3ee16168335e7b41c1063897ccdf5511800
Closes-Bug: 1660449
2017-01-31 11:50:32 +11:00
Paul Karikh e2cf94eb46 Enable profiling of angular pages (with async requests)
The main difficulty in tracing async requests which are made during
the rendering of Angular-based pages is tracking the root request (the
one which was made to render the skeleton page which then initiated
all other requests) throughout other requests, so they form a cohesive
trace. This is solved by capturing the root request id and exposing it
as a profiler module constant in the process of interpolating
_scripts.html Django template. Then if that constant is not an empty
dictionary, profiler module intercepts all Angular requests and adds
osprofiler headers to them.

This patch also fixes issues which arose after transitioning to the
new version of angular-bootstrap.

Change-Id: I656028b969289a473f54594681d9313ff8a07fd8
2016-12-29 18:26:19 +03:00
Rob Cresswell c89633c9b0 Update for ui bootstrap changes
UI Bootstrap decided to prefix all of their services/functions, so we
need to add these prefixes for the code to continue to function.

This patch primarily addresses functionality - some styling is broken
even with this patch, but those breakages can be fixed once this
patch lands.

Change-Id: Ia6f593e27f81b2b00b6376426cc469a776c4add7
Depends-On: I7d8ebd4e9018332c1974672a0b99080c152ce6c3
2016-12-15 17:00:22 +00:00
Jenkins 86bec0003e Merge "Wrap api calls with tracing decorators" 2016-12-02 11:59:40 +00:00
Jenkins 9508b5e805 Merge "Add the Profiler panel to the Developer dashboard" 2016-12-02 11:27:55 +00:00
Paul Karikh 97945b5f6a Wrap api calls with tracing decorators
Since Horizon is going to be the first (or, one of the first)
OpenStack component using the new MongoDB driver, it won't be able to
retrieve traces made by other components using MongoDB driver (which
it should use because Ceilometer driver was too slow) for a
while. This means that Horizon itself is responsible for tracing the
rendering of its pages down to the layer where the flow of control
leaves Horizon domain. So, a lot of api wrappers in
openstack_dashboard.api are augmented with tracing decorator to
achieve this goal.

Co-Authored-By: Timur Sufiev <tsufiev@mirantis.com>
Implements-blueprint: openstack-profiler-at-developer-dashboard
Change-Id: Ib36692f0e9e68ed7fa0cd47919ba6581c9c8ab57
2016-12-01 19:31:10 +00:00
Timur Sufiev 4ceeef5376 Add the Profiler panel to the Developer dashboard
Provide both pythonic Django part and the static assets (angular
directives and styles) for the new panel.

DEPLOY NOTES:

To enable panel itself, copy
openstack_dashboard/local/local_settings.d/_9030_profiler_settings.py.example
file from the previous commit to
openstack_dashboard/local/local_settings.d/_9030_profiler_settings.py
and copy openstack_dashboard/contrib/developer/enabled/_9030_profiler.py
to openstack_dashboard/local/enabled/_9030_profiler.py

To support storing profiler data on server-side, MongoDB cluster needs
to be installed on Devstack host (default configuration), see
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/#install-mongodb-community-edition
for instructions. Then, change net:bindIp: key to 0.0.0.0 inside
/etc/mongod.conf and invoke `sudo service mongod restart` for the
changes to have an effect.

Implements-blueprint: openstack-profiler-at-developer-dashboard
Change-Id: Ice7b8b4b4decad2c45a9edef3f3c4cc2ff759de4
2016-12-01 22:29:16 +03:00
Thai Tran 8c7c33381c Consolidated common angular view
We have views that references angular.html all over the dashboard.
This patch creates a single view for angular views and consolidate others.

Change-Id: I31bd7eb1ce9eac5ec4e13531679b12fc5ebbe60b
2016-11-17 12:07:16 -08:00
Jenkins ce1aab2d1b Merge "Provide the bones of profiler: api and middleware" 2016-11-10 12:02:08 +00:00
Timur Sufiev dd98e10dbf Provide the bones of profiler: api and middleware
Middleware is the backbone of the whole profiler facility. It adds an
encoded payload to each request that should be profiled with
osprofiler library. This library is embedded into other OpenStack
services where it tries to decode the message with a known set of keys
(so Horizon middleware should use one of these keys) and if
successful, sends a message to MongoDB (via osprofiler driver). Every
message has its own id, the base id (root message id) and parent
id. Using these 3 ids a tree of trace messages is assembled.

Actually, Horizon Django application uses 2 middleware classes:
ProfilerClientMIddleware and
ProfilerMiddleware. ProfilerClientMiddleware is used to enable Horizon
self-profiling (profiling from the UI): if a specific key is found in
cookies, then 2 standard osprofiler headers are added to a
request. These headers are processed by ProfilerMiddleware which
should always be the last middleware class in a Django config, since
it's defines `process_view` method which returns HttpResponse object
effectively terminating the middleware process_view chain. Assuming
that all API calls happen during rendering a view, Horizon sets a
tracepoint there which becomes a root node of the trace calls tree.

Implements-blueprint: openstack-profiler-at-developer-dashboard
Change-Id: Ib896676e304f2984c011bd1b610c86d1f24d46b9
2016-11-09 11:51:06 +03:00
Jenkins 5f60f150de Merge "Renamed bootstrap theme preview page" 2016-11-09 02:39:34 +00:00
Beth Elwell 82511ea8f1 Renamed bootstrap theme preview page
Renamed bootstrap theme preview page to theme preview to clarify
that it is a preview of both bootstrap and horizon specific elements.

Change-Id: I88281b674ba5fdee735cc1091bb9767949eb8318
2016-11-08 14:32:43 +00:00
Rob Cresswell f0f7000297 Fix logspam in django 1.9 and django 1.10 tests
Including the contrib enabled files was causing a ton of warnings in the
test runs about the 'Developer' dashboard not being registered. We
should remove it from test settings; we can also disable the
theme_preview test (which didn't have much value anyway) as it is
covered by a check in developer/tests.py

Change-Id: Ib03a13f289eca6a7565a7a6f1a9a3ab6c90d56c9
Closes-Bug: 1630298
2016-10-05 17:03:27 +01:00
Jenkins c66b905d6a Merge "i18n: Avoid string concatenations to make translation life happier" 2016-09-30 11:45:13 +00:00
Jenkins c664427667 Merge "Remove duplicated inappropriate 'translate' tag" 2016-09-25 05:09:53 +00:00
Rob Cresswell fbbe16f76d Move Developer enabled/ files to contrib
This patch moves the developer panel enabled files to contrib, to stop
any strange behaviour when interacting with settings from enabled files
and prevent warning logs when DEBUG is False.

Change-Id: If7a2d023afe418b6dd90edf8a4a1d3bc9646c7ad
2016-09-23 10:59:20 +00:00
Akihiro Motoki 6436212073 i18n: Avoid string concatenations to make translation life happier
Change-Id: Iea0cef814f212662dc4403f62a2c6bea02ab1390
Closes-Bug: #1624757
2016-09-20 04:43:47 +00:00
Jenkins e5d467ff1e Merge "Fix jasmine test failures due to missing ngRoute, schema-form dep" 2016-09-20 00:40:53 +00:00
Akihiro Motoki 4340fc25fe Remove duplicated inappropriate 'translate' tag
Change-Id: Id07287e20760116285cb5fda86aac272b8d06e35
Closes-Bug: #1624751
2016-09-17 21:33:21 +00:00