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
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
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
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
Ceilometer support in osprofile was removed long ago[1] and no longer
available.
[1] 0bb909c7a039f17b957d920c93d366d89e581280
Change-Id: I11be3a2f854ac75ba5dc3fd82e84cb3d99f81034
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
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
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
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
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
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
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
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
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
(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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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