Commit Graph

72 Commits

Author SHA1 Message Date
okozachenko aa21f4baa3 fix: ignore errors when flavors are deleted
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
2023-11-02 01:27:40 +11: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
Vadym Markov 4a2a1db145 Show image names at Admin-Instances dashboard
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
2021-08-11 18:12:09 +03:00
Zuul ff1af2f1a4 Merge "Non-api filters not working with admin instance tab" 2020-11-18 13:33:06 +00:00
vinay_m 6b79cdcc1b Non-api filters not working with admin instance tab
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
2020-10-27 20:07:57 +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
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
Akihiro Motoki 53486be43f Define default settings explicitly (openstack_dashboard 2/5)
This commit mainly covers settings
in openstack_dashboard/dashboards/admin/.

Part of blueprint ini-based-configuration
Change-Id: Ifb3e9401a926ba9e035e1b498a4a4493c1b594f5
2019-04-24 02:32:47 +09:00
Akihiro Motoki 59beb951a3 pylint: Fix consider-using-(dict|set)-comprehension
Change-Id: I81c694c17106c179a53326a12e78cfa899872970
2019-01-13 00:59:05 +09:00
Ferenc Cserepkei 4676694179 Add "prev" link to instance page list pagination
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>
2018-12-28 20:46:11 +09:00
Zuul 119ce678da Merge "Support of rescue instance in Horizon" 2018-12-03 14:51:43 +00:00
pengyuesheng ffa8b5404e Support of rescue instance in Horizon
Change-Id: Ie195befde8fe10ce419583ead06fdb759dd3813c
Implements: blueprint instance-rescue-horizon-support
2018-11-20 10:25:37 +00:00
Akihiro Motoki cebe212d00 Bump hacking to 1.1.0
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
2018-11-10 16:44:25 +09:00
BubaVV deb55b8411 Call Glance list with certain image ids
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
2018-11-06 12:30:57 +02:00
Akihiro Motoki 56ae087995 Refactor futurist calls
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
2018-03-14 21:15:52 +02: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 45442821d0 Use nova os-services to retrieve host list
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
2018-02-01 12:19:56 +00:00
Huan Xiong f929d39ab4 Do not make duplicate requests to Glance for image names in admin panel
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
2017-12-16 12:41:48 +00:00
Zuul 79b7b50a96 Merge "Refactor swap_filter in instance views" 2017-12-16 11:51:33 +00:00
Akihiro Motoki 6c4d254b4a Refactor swap_filter in instance views
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
2017-12-16 10:08:44 +00:00
Feilong Wang a42f58de50 Allow to skip API calls to Neutron in instance tables
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
2017-12-11 23:19:01 +09:00
yong sheng gong 1f41f29f0b Add MKS console support
Co-Authored-By: jinke <jin.ke@99cloud.net>
Co-Authored-By: yong sheng gong <gong.yongsheng@99cloud.net>

Change-Id: Id8ee4a28a09eb3d7f7598c507c0a4320a97cd01c
implements: bp support-mks-console-type
2017-11-29 21:06:38 -05:00
Huan Xiong 6107983761 Fix non-API bound filters in project and admin instance panels
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
2017-09-28 15:10:19 +08:00
Ivan Kolodyazhny 3a99499ba0 Get all needed instances for volumes attachments at Admin->Volumes
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
2017-07-13 20:35:21 +03:00
Akihiro Motoki 6ad4d263c4 Add futurist to requirements.txt explicitly
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
2017-04-16 09:03:27 +00:00
Jenkins 567535731c Merge "Make API calls in Instances view parallel" 2017-03-17 02:29:39 +00:00
Ying Zuo 804db52d7d Remove link for user id field on project action log
The action log under project dashboard should not link
to the user details panel which requires admin permission.

Change-Id: I802188db6f1f8fc7e854980eca85d3b1a75aec1e
Closes-bug: #1667154
2017-03-12 18:22:36 +00:00
Akihiro Motoki b091fb8016 Fix volume_url in admin instance detail
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
2017-03-11 17:20:44 +00:00
Mateusz Kowalski df194c8b4c Make API calls in Instances view parallel
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
2017-02-14 14:11:03 +01:00
Rob Cresswell 560f23a1c9 Add default common template to python table views
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
2017-01-05 08:59:35 +00:00
Eddie Ramirez 460a53f96d Server-side filtering for Instances (Project/Admin)
New Filters:
- UUID
- Flavor Name
- Image Name
- Availability Zone
- Key Name
- IPv4 Address
- IPv6
- vCPUs
- Changes-since.

Affected views: Project->Instances and Admin->Instances

Implements blueprint: server-side-filtering
Change-Id: I3b07674fc1083607cae5d1db5a691827bde46d7c
2016-09-15 22:33:35 +00:00
Luis Daniel Castellanos e15b61f58a Update admin filter first setting to a dict
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
2016-09-14 15:52:20 -05:00
Luis Daniel Castellanos adabe6ec3b Remove admin_filter_first from horizon module to avoid confusion
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
2016-08-18 15:24:41 -05:00
jlopezgu 7a88458acc Move get_filters to parent Class
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
2016-07-29 13:27:00 -05:00
Luis Daniel Castellanos 488efd784f Implement admin_filter_first in Instances and Images Admin Views
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
2016-06-23 10:18:11 -05:00
Paul Karikh b05d3cffb3 Add strip() to filter string in instances
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
2016-04-04 15:52:31 +00:00
Diana Whitten 2e793aa2dd Branding: Workflow cancel btn should be themable
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
2016-03-14 12:48:11 -07:00
Masco Kaliyamoorthy 4e8549ee9a Replace SortedDict with OrderedDict
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
2015-09-04 18:39:15 +00:00
Masco Kaliyamoorthy 2d8a4c6bc7 corrected the wrong url in admin instance detail
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
2015-07-02 17:31:40 +05:30
Masco Kaliyamoorthy 863f7fcd06 corrected the wrong url in admin instance detail
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
2015-06-09 14:38:18 +05:30
Alan Fung 6ed0c7c09f Correct Admin Instances actions to reference Admin ones
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
2015-05-11 17:23:44 -07:00
Rob Cresswell 49e40509eb Fixes inconsistent Edit between tables & details
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
2015-03-23 10:43:47 +00:00
Rob Cresswell 6d188cbac3 Fixes inconsistent Admin > Instances table header
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
2015-02-15 13:43:37 +00:00
Sam Betts 73ad5ec186 Reduce page title duplication in Admin views
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
2015-02-11 16:33:20 +00:00
Sam Betts 9ca494e6e3 Ensure DataTableView applies filter after redirect
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
2014-10-15 10:19:45 +01:00
Jenkins fd5c313f01 Merge "Fix host listing in live migration" 2014-09-12 06:30:51 +00:00
Akihiro Motoki 198c7dcd5f Show floating IPs from other projects of admin instance table
Change-Id: I36e1c7a3808994d1481463ed6b595506e579ae28
Closes-Bug: #1319669
2014-09-10 14:55:46 +09:00
Dirk Mueller 89dc7de2e8 Fix host listing in live migration
The live migration selector needs to offer a list
of hosts, not a list of hypervisors.

Change-Id: I73c1175a5f87b0f91e36083f05467c26feca5d51
Closes-Bug: #1335999
2014-09-10 11:17:46 +08:00
Justin Pomeroy 21d0fb59c3 Add API filtering to paged tables
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
2014-08-08 09:17:42 -05:00
He Yongli e790ac070e Remove extraneous vim configuration comments
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
2014-05-06 15:30:10 +08:00