The code used to list flavors when in the admin
or project side was not consistent and raised
alerts if viewing in the admin side but not in the
project side.
This patch moves their behaviour to be consistent
and refactors the code to use the same code-base.
Closes-Bug: #2042362
Change-Id: I37cc02102285b1e83ec1343b710a57fb5ac4ba15
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
Admin-Compute-Instances dashboard shows "-" as image name for every
instance. Despite, Project-Compute-Instances dashboard displays image
name correctly. Admin dashboard just lacks code to resolve image name
Also, reverted commit deb55b8 which functionality is not needed anymore
Closes-Bug: #1932341
Change-Id: Ieb19e66dc51165d9935424b2e9ab5cdae757b07f
The issue was that the filtering opts like project_name, image_name,
flavor_name that are not supported by nova API (non-api filters) do
not work expectedly. These filters are mapped to their IDs [1], but
an instance list retrieved before resolving non-API filters is used [2].
This commit changes the logic to resolve non-API filters first and
then retrieve instances using the updated search_opts.
Note that the image list is handled a bit specially. If 'image_name'
is specified as a filter, we retrieve a corresponding image detail
first before fetching instances to resolve the image name into its ID.
Otherwise, we retrieve images only related to instances retrieved
and this happens after retrieving instances.
[1] f90c3cd501/openstack_dashboard/dashboards/admin/instances/views.py (L166)
[2] f90c3cd501/openstack_dashboard/dashboards/admin/instances/views.py (L154)
Closes-Bug: #1888490
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Id43adbd44778d3375c0d49da3f7530cbb99e16fe
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
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
Currently there is no link to previous page at paginated instances
table. This patch resolves that issue by re-using the pagination
code for flavors.
It also supports Ying Zuo's scenario:
After I set only 1 item per page and deleted the instance on the first page,
the expected behavior is showing the next instance in the table after one is
deleted.
xxxIndexView uses PagedTableMixin's _get_marker() from now instead of GET()-
ing the markers
Closes-Bug: #1274427
Co-Authored-By: Dmitry Ratushnyy <dratushn@cisco.com>
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Id8eaae6bf1b5d6f42291291655e14b8715c08bc8
Signed-off-by: Ferenc Cserepkei <ferenc.cserepkei@ericsson.com>
Fix the following new errors:
* E305 expected 2 blank lines after class or function definition, found 1
* E126 continuation line over-indented for hanging indent
max_line_length is set to 80 as the default value in pycodestyle is 79
but horizon uses 80 as max_line_length.
Ignore W504 and F405 by configurations.
Reasons of disabling them are explained as comments in tox.ini.
Change-Id: Iee8bcd60c30883fc8c74f08cf20af853cbb5e271
This patch uses glance list filtering, which allow to query images
for the list of required ids. See [1] for details.
Patch rebased to master. Added test for proposed Glance API request
[1] https://developer.openstack.org/api-ref/image/v2/#show-images
Related-Bug: #1508554
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Co-Authored-By: Vadym Markov <markov.vadim@gmail.com>
Change-Id: Iac485c1b448011fec97ba5bfaa83851914b294d9
After futurist calls were introduced, the code became difficult to
understand. For example, local variables are used something like global.
To keep the code easier to understand, the usage of local variables
should be more scoped.
This commit introduces a wrapper function for futurist.ThreadPoolExecutor
and converts inline functions into normal methods.
I believe it improves the code readability a lot.
Change-Id: Id5b7a06c50e397c8c27447322d7f64f2d65c06b6
(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
novaclient version 10 has dropped the support for novaclient.v2.hosts.
os-aggregates and migrateLive APIs expects host from os-services,
so this commit retrieves host list from os-services API.
Change-Id: I5ec007ab1f244ca8caee1eb7b5d4262ac6c32171
Closes-Bug: #1745502
Admin panel generates duplicate (N per instance) requests to Glance for
instances that boot from image. The commit fixes it by getting all
images information in one shot.
Change-Id: I360aef8c34304f3abe76a90787ab63647cd78491
Closes-Bug: #1711486
Previously we check if a fake_field is contained in search_opts
before calling swap_filter, but we can move it into the inside
of swap_filter.
This commit is split from https://review.openstack.org/#/c/507388/
to avoid doing a fix and refactoring in a single commit.
Co-Authored-By: Huan Xiong <huan.xiong@hxt-semitech.com>
Change-Id: I3069c6c9e66f32f53a64124f1d9d191d6aa703a3
Now instance panel is sending API calls to Neutron to get the addresses
info about network. It take some time until Nova network info cache is
synced when IP address operation like floating IP association is made
in Neutron. The API calls to Neutron exist from this reason.
However, it retrieves a full list of port, so it can potentially leads
to performance issues in large deployments. This commit adds a setting
flag to control whether API calls to Neutron is used or skipped in
the project instance table.
This commits drops a call of servers_update_addresses() in the admin
instance table. In the admin instance table there is no need to retrieve
IP addresses from neutron because the main purpose of the admin panel is
to see all instances and IP addresses in nova network info cache will be
synced soon.
Closes-Bug: #1722417
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Ie16784eb6352f70ab644dc8b6ea03fc6a881d3f9
Filters like "image_name", "flavor_name" and "project" in instance
panels are keys not supported in Nova List-Servers API directly, so they
should be converted to "image", "flavor" and "project_id", respectively,
before Horizon calling Nova List-Servers API.
That used to work, but was broken in commit
df194c8b4c because the code change messed
up the order. This commit fixes it by converting those filters first and
then calling Nova API with modified filters.
Change-Id: I504caaab2b6f256e7eb8c2605acaec39c004e80f
Closes-Bug: #1718725
Nova server_list() wrapper needs to receive an explicit `all_tenants`
boolean flag in order to request instances for _all_ tenants -
otherwise while rendering Admin->Volumes table Django will request
missing instances (to get their names for volume attachments) one by
one, thus significantly increasing response time.
This patch adds check if all_tenants in search_opts and add it to
the search else uses tenant_id in the search_opts.
Co-Authored-By: Dmitry Sutyagin <dsutyagin@mirantis.com>
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Change-Id: I4761d7da15036b69619649871aef91e1799ee385
Closes-Bug: #1508568
After commit df194c8b4c we use
futurist library in horizon code. futurist is already installed
by dependency of oslo.messaging required osprofiler, but it is
better to declare our dependency explicitly rather than depending
on requirements of other library.
Also this commit fixes import grouping related to futurist.
Change-Id: I260b4ea88a5a41808286026815f519693740961b
The action log under project dashboard should not link
to the user details panel which requires admin permission.
Change-Id: I802188db6f1f8fc7e854980eca85d3b1a75aec1e
Closes-bug: #1667154
Recently the volume panel was moved, but volume_url in
the admin instance detail was not updated accordingly.
This was pointed out in https://review.openstack.org/#/c/437191/
Change-Id: Ie26ef81982c1e2a1c907b57e497b9d4ca2f740cc
In order to increase rendering speed, make
api.nova.server_list, api.network.servers_update_addresses,
api.nova.flavor_list and api.glance.image_list_detailed
parallel. For admin panel also api.keystone.tenant_list
is parallelized.
Closes-bug: #1655307
Change-Id: I83150d3963f1233edc9efbcdac299520dedbed3c
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
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
For server side filtering the method get_filters() is used in every
view, moving this method to the parent class will allow us to not
add it to each view.
Implements blueprint: server-side-filtering
Change-Id: Idaee431ed15de81e5ea049948b55d1526e2024ac
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
admin/instances and project/instaces
have server filter field.
This field do not strip search string,
so attempt to search "test " will return
nothing. This patch fixes it.
Change-Id: I6a56a95e8b9b46384c0ee9da4968abcbb0ecff70
Closes-Bug: #1564878
Cancel buttons are quite hard coded in their styles, and most templates
are overriding the default modal-footer template.
This patch removes most of the straight duplications in the
modal-footer.
Co-Authored-By: Rob Cresswell <robert.cresswell@outlook.com>
Closes-bug: #1551455
Change-Id: I496381e3f512856ad37619108b45af3c1da800a5
From django V1.9 django.utils.datastructures.SortedDict
will be removed and it is deprecated in V1.7.
The similar functionality is added in collections.OrderedDict
from python 2.7.
Horizon code also should avoid the SortedDict class and
start using the OrderedDict class.
This patch replacing the SortedDict with OrderedDict.
Change-Id: I8dfcf7c29fc49b6215451f160cf7a951bf11b5ad
Closes-Bug: #1492270
In admin instance detail page, the url for attached volume
pointing to volume detail in project panel.
This behavior is wrong, it should be link to admin panel only.
This patch corrected the url to point to the admin panel volume detail.
Change-Id: I76419f1236304211602fa98f3885d8a2a05b6468
Closes-Bug: #1470821
In admin instance detail page, the image url pointing to image detail page in project panel.
This behavior is wrong, it should be link to admin panel only.
This patch corrected the url to point to the admin panel image detail page.
Change-Id: I4ec2687cc208e61b2be00dc86e42f95fa8a1a363
Closes-Bug: #1463312
Currently "Console" and "View Log" actions are referencing the Project
version of these pages instead of the Admin version.
i.e. "Console" action redirects to Project > Instances > Detail page
Additionally, the Admin instance detail page is using the collection
of actions from the Project instance table.
This change corrects these references to redirect to the detail page
under the Admin panel group; updates the Admin detail page to use the
collection of actions from the Admin instance table.
Change-Id: I7043d8283c4f3a85e52b360a790aa3487b9a4ff7
Closes-Bug: 1421318
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
Changes Instances table header to "Instances" rather than "All Instances"
so that it is consistent with the other tables in the Admin panel
Change-Id: Ie96806d55d2db6eaddbe0979170065b0968a2299
Closes-Bug: 1420293
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 info, instances, metering and metadata_defs views.
Change-Id: Ia30fee5318391283cb471a32547e75b1ecfb6de6
Partial-Bug: 1413749
Non-API bound filters were not persisting across pages changes,
this patch adds an additional check to make sure the DataTable looks
for any non api bound filters in the session and applies them on page load.
Also added some logic to make Project filter in Admin->Instances API
bound using the tenant_id.
Change-Id: Ieab9f2b92b59401809725a4f37628757dc4c8f13
Closes-Bug: 1369014
The live migration selector needs to offer a list
of hosts, not a list of hypervisors.
Change-Id: I73c1175a5f87b0f91e36083f05467c26feca5d51
Closes-Bug: #1335999
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
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