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
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 commit mainly covers settings
in openstack_dashboard/dashboards/admin/.
Part of blueprint ini-based-configuration
Change-Id: Ifb3e9401a926ba9e035e1b498a4a4493c1b594f5
W503 line break before binary operator
Looking at the code base, it sounds okay to follow this check.
Change-Id: Id511e0104dc6de5b204021661d4a8776ca6d3658
(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
In Python 2 there are two integer types 'int' and 'float',
but in Python 3 'int' handles all integers.
blueprint django2-support
Change-Id: Ic9e054a0e5015d60cfc966e70409a3016719ae11
Many of the Python table views are using identical (or nearly identical)
table templates. This patch adds a common template and makes it the
default for a DataTableView, which allows us to remove many similar
templates and redundant lines of code.
Change-Id: I1e4e15e695ee1f21f4d44f141a854e30f1e567a1
Closes-Bug: 1653986
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
Previously the ADMIN_FILTER_DATA_FIRST setting was a True/False
setting that was taking over all the admin views leaving
operators without the opportunity to set this setting to views
individually.
This patch changes the setting to a dict where it can be specified
which panels/views will implement this setting individually.
Implements blueprint: admin-views-filter-first
Change-Id: I50deab878f68c1cc519aa9b47feaa2c58bb8eacc
The admin_filter_first attribute in
'horizon.tables.views.MultiTableMixin' causes confusion since "admin"
is an OpenStack concept. The intention of this attribute is just to
provide a setting that allows views to request for a search criteria
first before loading data, not to merge concepts between 'horizon' and
'openstack_dashboard'. Removing the setting from it's original position
and permorming the check of the setting in each admin view that
whishes to implement admin-filter-first should eliminate this confusion
Change-Id: I77fb0566155e5e5b868cb86c5718ca7048d5d7d4
This patch follows on the example that the Containers set, providing
a 'switch' in the panel-enablement file that currently defaults to
'legacy' (Python-based Images panel) and allows for 'angular' (Angular-
based Images panel).
To be clear, this does NOT enable Angular Images. It's just setting the
stage to do so at some point, or to allow deployers/devs to easily switch
between the two.
A switch both for HORIZON_CONFIG and for integration tests is necessary
due to the way integration tests operate.
Co-Authored-By: Timur Sufiev <tsufiev@mirantis.com>
Change-Id: I12cd33552218ed1082d2d9a2ae8982639a217a6a
Partially-Implements: blueprint angularize-images-table
Implementing ADMIN_FILTER_DATA_FIRST setting will allow operators to
require admin users provide a search criteria first before loading
data into the Admin views.
Starting with Instances and Images admin views since they already have
server side filtering options.
Implements blueprint: admin-views-filter-first
Change-Id: I846690854fd443bb98692674bf9fe6733dd04263
check policy of getting images in:
project/images
project/ngimages
admin/images
Only block listing images but not whole panel if failed on policy check.
Create, Delete and other actions are controlled by according policys.
give a message "Insufficient privilege level to get images." to user
if polciy checks failed.
Closes-Bug: #1529012
Change-Id: I97ab081425dd56fa7c3208efb58ba8b041eaba24
The edit image and the update image is not uniform in the horizon.
Changed the update image to the edit image because there is only
a few places to use the update image.
Change-Id: I6ccca2e9da0d770d92a281cc4cb681c0507469dc
Closes-Bug: #1540755
Move most of the pagination-logic to `api.glance.image_list_detailed`,
thus making code in Admin/Project->Images->get_data() less confusing
(and remove hard-coded 'asc'|'desc' values).
Also prepare to get images both from glanceclient.v1 and
glanceclient.v2 (which doesn't set `is_public` attr on images using
`visibility` attr instead).
Change-Id: Ibe6d3dd1e94a1d1fbf95382599a5f53c3559ce5a
Closes-Bug: #1534670
Closes-Bug: #1336317
The iteritems() method of Python 2 dictionaries was renamed to items()
on Python 3. The overhead of creating a temporary list for items() on
Python 2 is negligible.
Replace also dict.itervalues() with six.itervalues(dict) in
horizon/test/utils.py.
Partial-Implements: blueprint porting-python3
Change-Id: Ib2d62236be2620c4626099ce80e6c8a9397a4533
Now some panel in admin page has project column for resources,
such as instances, volumes, networks, ... we should add images
project column for admin images tables.
Change-Id: Ic31c19aab080e2ca11b43eb684cde9a578ea421a
Implements: blueprint add-tenant-name-for-admin-image
The 'Docker' format is added to the default list of supported
formats so it can be selected from the list of formats when creating
or updating an image. When the docker format is selected, the
disk_format and container_format properties are set appropriately.
This also includes changes to the Format column and filter for the
Images table to handle this type.
Closes-Bug: #1455179
Change-Id: Ie705c86d47c0b6035373b9311454748122185988
This patch addresses several instances where clicking Edit on a Detail
page (such as Edit Port on the Port Detail Page) gave either more or
less options than the equivalent action in the Table. This patch fixes
any occurences so that Edit ___ show the same form and fields regardless
of where it is clicked
Closes-bug: 1408346
Change-Id: Ic2599d594b627bd7ab584d1a314360921e41a203
Patch https://review.openstack.org/#/c/142802 adds a method of
reducing duplication of page title logic, this patch applies that change
to the admin images views.
Change-Id: I53941fadee5338b20ee9c958edc9105757b42b0d
Partial-Bug: 1413749
In Juno, Glance is providing a metadata definitions catalog[1][2] where
users can register the available metadata definitions that can be used
on different types of resources (images, artifacts, volumes, flavors,
aggregates, etc). This includes both simple tags and key / value pairs
(properties, specs, etc).
This widget will get the metadata definitions from Glance
and will let the user add the metadata to the resource being edited.
It provides value validation as well as description information
about the metadata.
An implementation for Images is included in this patch. Additional
patches will be made for other resource types.
This patch also removes Edit Image Custom Properties screen as new
widget provides the same functionality. To avoid regressions owner
property is added to Image Detail screen.
********************** TESTING **************************
You can test this code with Glance patches by following
the instructions at the bottom of this etherpad:
Go to: https://etherpad.openstack.org/p/j3-glance-patches
*********************************************************
[1] Approved Glance Juno Spec:
https://github.com/openstack/glance-specs/blob/master/specs/juno/metadata-schema-catalog.rst
[2] Glance PTL Juno Feature Overview:
https://www.youtube.com/watch?v=3ptriiw1wK8&t=14m27s
Implements: blueprint tagging
DocImpact
Co-Authored-By: Santiago Baldassin <santiago.b.baldassin@intel.com>
Co-Authored-By: Pawel Skowron <pawel.skowron@intel.com>
Co-Authored-By: Travis Tripp <travis.tripp@hp.com>
Co-Authored-By: Szymon Wroblewski <szymon.wroblewski@intel.com>
Co-Authored-By: Michal Dulko <michal.dulko@intel.com>
Co-Authored-By: Bartosz Fic <bartosz.fic@intel.com>
Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@intel.com>
Co-Authored-By: Heather Whisenhunt <heather.whisenhunt@hp.com>
Change-Id: I335d4708f5ce8afe58fb88dbe9efd79e2c04fc9e
This adds the ability to filter paged tables (admin instances,
admin images, and project instances) based on supported API
query attributes.
Change-Id: I53cae922e3d349e2f01e8d0d688ddf04d65d84e4
Implements: blueprint table-filtering-by-api-query
The Glance API supports a sort direction which we can use to paginate back
The Prev href tag contains a marker id of the first item in the table.
When clicked, a GET API call is made, passing in this marker and the sort_dir='asc'
This will return the previous page's data. Then we have to re-sort the data because
it is ordered backwards. We use the default sort_key='created_by' for this.
Once the patch #1252649 is restored, we can add the same behavior to Project > Images.
If we are able to get the consistency across the APIs to include the sort_dir, then we can
bring Prev to the other project tables as well. There are some blueprints to enhance
API capabilities in this area.
Change-Id: I3e7c6a2db595838dbdff595dc8f0fdda288b6bcf
Partial-Bug: #1263142
Partial-Bug: #1282987
Partially-implements: blueprint pagination-add-prev-link
Remove vim setting:
comment - # vim: tabstop=4 shiftwidth=4 softtabstop=4
at the top of source code files, except for files in
openstack/common.
Change-Id: I9a5c6b17c6ef7ecec601f4503dfc7b31fc72e90a
Close-bug: #1229324
Admin's Images panel shows only instance snapshots of the project
selected on Projects tab .
Add the appropiate filter is_public: None to the list request.
Change-Id: I4963515d8dbdc89512258c30e3fad309f9720436
Closes-Bug: #1283258
Now that instance snapshots are just images, the images & snapshots
page only has images and volume snapshots. This is an odd combination.
I think we should now move volume snapshots to the volumes panel,
since a volume snapshot is tied to a volume.
Closes-Bug: #1190843
Change-Id: I3e12cec8b859a30db9f131e9889a92277e064086
We have a lot of import with #noqa that is there to ignore h302,
because it's traditional to import and use a name directly, instead
of a whole module. This hides other errors and gives people the
impression that it's actually fine to import non-modules, you just
have to slap #noqa on those lines.
I went through the code and identified about a dozen names that are
most commonly imported this way. I remove the #noqa tag from them,
and added them to the list in import_exceptions.
I also removed a few unused imports that were revealed in the process.
Change-Id: I27afb8e2b1d4759ec974ded9464d8f010312ee78
In an effort to help horizon more friendly to OpenStack hacking
guidelines, we now gate on H40* violations.
Change-Id: Id07294543660368d2f7f5ac363710176ab23b874
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
In some files, we import logging and define
LOG, but we never used it later, so i remove
those unused LOG and make horizon code clean.
Fixed: bug #1231761
Change-Id: I1ebf0098c647e7522f5f1a93cfece7a52bdc05c1
This patch replaces some method imports with module imports and
makes H302 test enabled.
Fixes bug 1188531
Change-Id: Ibfbddeaa19cbbb244da58ffd5c918c41f03a0c65
Fixes all occurrences of this. We have a custom exception handler
in Horizon anyway that only catches ClientException in most of these
cases, but this commit lets us gate on the other cases.
Change-Id: Iea3dc13817f3e5b775b2024424bf3a906da5584b
Closes-Bug: #1211657
This patch replaces relative imports with full paths and
makes H304 test enabled.
Fixes bug 1188535
Change-Id: I47254cf9a790727102f7993d0fd107da514983df
This patch also re-organizes imports to import one per line.
Change-Id: Ia958e3a30a48d4308d08d51df243c1272425c316
Fixes: bug 1188529
Fixes: bug 1188537
For project images, disable pagination entirely as it's not compatible
with client-side filtering (at least without moving to asynch table
loading). This can be revisited when we move to glance v2, which
apparently supports filtering by owner.
For snapshots and admin images, fix pagination by making sure the
iterator returned by glanceclient isn't exhausted completely when
returning a page of images. Do this by slicing just the number of
images we require (+ 1 to check if there will be another page after
this one).
Fixes bug #1083034.
Change-Id: I692f57dec6dca16cf8909f5b234aadb002702fc8
In the current code both api.<method> and api.<category>.<method> are used.
Using api.<method> directly makes it difficult to identify which module
defined a method and forces developers to use unique method names among
projects. This commit removes api.<method> style method calls.
Change-Id: Iaefa1061f99b7865e02541df87c112a6b2868ec0