Commit Graph

33 Commits

Author SHA1 Message Date
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 c45cc6b1c5 Drop the usage of nova extensions in python code
Part of the removal of OPENSTACK_NOVA_EXTENSIONS_BLACKLIST (1/3)

All references of nova extensions in the python code are cleaned up.
Note that the API layer is not touched yet as it is used by the
JavaScript side.

Change-Id: I66cd0a9629253a6462aace9902ef8200b94b2a21
2020-10-27 20:00:45 +09:00
Akihiro Motoki c9e47d6595 Add new setting for SimpleTenantUsage
This introduces a new setting OPENSTACK_USE_SIMPLE_TENANT_USAGE
as a replace of SimpleTenantUsage in OPENSTACK_NOVA_EXTENSIONS_BLACKLIST.
We received feedbacks on the need to control whether SimpleTenantUsage
is used or not, so we need a new setting before retiring
OPENSTACK_NOVA_EXTENSIONS_BLACKLIST.

Change-Id: Ib786ea2ac232fcd851f4b276b9144c14c0b62a0a
2020-10-27 19:59:34 +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
Marek 161b4ae5d4 Fixes a series of bugs related to Floating IPs.
- Fixes KeyErrors when accessing 'floatingip' values in usages, which
  broken Floating IP allocation.
- The quota display in the bottom right of the Allocation dialog are
  only displayed if 'enabled_quotas' is True
- Adds security group rule tallying for the usages overview page, which
  fixes a KeyError crash for installations where Horizon 'enable_quotas'
  is set to true, but the 'quota_details' extension is not installed on
  in Neutron
- Adds a policy check to show and hide The plus/add button in
  Instances->Associate Floating IP to match the Allocate IP To Project
  button in Floating IPs
- Fixed the page title not being set for the non-modal version of the
  modal allocation dialog/form
- Added an 'allowed' functionality for network usage overview charts to
  allow for them to be dynamically disabled
- Added tests and mocks for the above
- Added tests for non-legacy quota tallying for networks
- Added test for disabled network quotas in overview

Change-Id: I47f73ff94664d315a2400feb8ce8a25f4e6beced
closes-bug: #1838522
2019-12-17 13:30:25 +09:00
Zuul 17ce74e4f0 Merge "usage: Categorize Limit Summary by service" 2018-05-08 08:23:47 +00:00
HyunsikYang fa20420246 Bug Fix : Local variable 'quota_display' referenced before assignment
closes-Bug: #1767354

Change-Id: I6eed169b8c5f18295734cb6453c7256f31de10d3
2018-04-28 15:32:03 +09:00
Akihiro Motoki f897837444 usage: Categorize Limit Summary by service
blueprint make-quotas-great-again
Change-Id: Ia030defa851d8ce3e9a5e225dbf9c360b2b0c09a
2018-04-20 05:34:33 +09:00
Akihiro Motoki b5671a22ee usage: Add network resources to Limit Summary
blueprint make-quotas-great-again
Change-Id: I5594b594e5f5d7ca5341fb479b48efac6578c5c8
2018-04-20 05:29:58 +09:00
Akihiro Motoki b0dc533527 usage: move field-specific logic from template to code
_limit_summary.html has field-specific logic in the template,
but it is better to have such logic in python code so that
we can make the limit summary more pluggable in future.

In addition, filters for ram and volume gigabytes are applied
only when quota is not unlimited. This commit also fixes it.

blueprint make-quotas-great-again
Change-Id: I4c9584431c2526ebecf6d1438c1bf0e44f70a493
2018-04-20 05:29:57 +09:00
Akihiro Motoki 7fabda7ef1 usage: Use tenant_quota_usages() for Limit Summary
Previously we have almost duplicated logic for the limit summary
and quota usages. This commit shares the logic.

blueprint make-quotas-great-again
Change-Id: Ie5d7e51c9424701fdbcbfbcb1032c0b833a69371
2018-04-20 05:29:53 +09:00
Akihiro Motoki 788388c486 usage: split out the limit related logic into ProjectUsageView
Previously limit information was always retrieved but it is not
used in the admin overview. This commit moves the limit related logic
into a separate class ProjectUsageView.

testing of usage.views is covered by individual panel tests,
so UTs for panels which uses UsageView rather than the new
ProjectUsageView need to be updated in this commit.

blueprint make-quotas-great-again
Change-Id: Id93b66d11e3b0c98d1fbb0454bb43984c2999d92
2018-01-14 04:15:27 +09:00
Nick Timkovich edbf88fa79 Use specified phrases in lieu of 'Used' for limit summary
Some resources, namely floating IPs, are limited based on those
allocated, rather than in actual use. The "Allocated" string is present
in the code but not used in the template. This effectively changes "Used
X of Y" to "Allocated X of Y" for floating IPs.

Change-Id: I7919b883a47d66b1e870862363d07e0f90bdbe7b
Closes-Bug: #1708733
2017-11-14 12:06:17 +00:00
Pierre-Alexandre Bardina 4570413773 Add units in overview project page (limit summary)
Since liberty, there is no unit in the overview project page. Trying to
fix it.

Closes-bug: #1589523

Change-Id: I82710d7157b0b8b3cc8128283cd0bfa2f075db71
2016-06-24 15:36:33 +00:00
Akihiro Motoki 5fc26b0a11 Replace "Terminate Instance" with "Delete Instance"
"Delete" is being used almost everywhere in OpenStack Dashboard
except the instance panel. Using "Delete" looks more consistent.
In addition, "Delete" tells non-native English speakers that
deleted instances will be no longer usable again compared to
"Terminate".

DocImpact
Closes-Bug: #1502773
Change-Id: Idccaf3c45566f20f11d02ada64c1d3934a6f3002
2015-11-30 03:55:19 +09:00
Itxaka 65f919e87f Translate Floating IPs on overview page
Floating Ips was not being translated properly.

Change-Id: I57128e0dba5e2524cc2a326abdfc983d46df4c69
Closes-Bug: 1516162
2015-11-23 12:49:39 +01:00
Bradley Jones 286245b423 Refactor quota limit summary template
Refactor the quota limit summary template to allow easier customisation.
Also change it so that it removes the 'of' when there is no quota limits in
place so that it just reads Used 'x' (No Limit).

Added tests for checking usage['charts'] is in the context and that (No Limit)
is present when there is an infinite quota on the page.

Change-Id: Iba62ca89e53f0d6b9c583e4cc450e853c18ba107
Closes-bug: 1439717
2015-05-26 11:39:52 +01:00
Sam Betts 168aa7e162 Document and improve PageTitleMixin readability
This is a follow up patch to https://review.openstack.org/#/c/142802
that adds documentation and also improves code readability in the
PageTitleMixin.

Change-Id: Iac7666252b5ceb9611e0688ef90173edf90475d9
Closes-Bug: 1420744
2015-02-11 16:16:20 +00:00
Sam Betts 1934a7eaa8 Reduced code duplication in creating page headers
The same line of code to add a page title to a template was repeated in
many templates, this patch moves that line into the base.html, and also
tries to standardize the way page titles are defined in the python.

Change-Id: I11367d3007ebae727ba45446076a31307d477995
Closes-Bug: 1399840
2015-02-11 10:45:23 +00:00
Radomir Dopieralski 0eca7449cc Fix Flake8 style warnings in openstack_dashboard/
Warnings H904, H307 and H405 are new or considerably changed, and will
be fixed in a separate patch.

Closes-bug: #1349820
Partial-bug: #1347472

Change-Id: I4fd28990dacf16f03a4eaa6074ef59c37f1a2c14
2014-07-30 14:13:24 +02:00
Justin Pomeroy 407c17b38a Tolerate service catalog and endpoint connection errors
This is a fix for the issues encountered when a service is not
configured or a service endpoint is not reachable. This fix
will add tolerance for these errors so that an error message is
displayed but the dashboard page will still load, not an error page.
This makes it easier for the user to recover by allowing them to
go to a different page, select a different region, or logout. This
makes sense in many cases such as when a region only contains an
image service endpoint, or when a single endpoint is not reachable
for whatever reason.

It also adds permissions to the panels that require compute or
image services so that the dashboard will not display them if
the service is not configured.

To test these changes you will need to set up your keystone service
catalog so that not all services are available in all regions, or
some of the service endpoints are not reachable.

Change-Id: Ie04699d1fb1d4db13a7f4dcf1bdfd23bf21aab80
Closes-Bug: 1323811
Closes-Bug: 1207636
2014-07-21 08:38:53 -05:00
Leandro I. Costantino 340bf16be0 CSV Summary not working inside Admin panel.
When browsing Project usages from 'Admin->Projects->More->View Usages'
an AttributeError exception is thrown due to missing csv_render_class
attribute.
Also, project_id instead of tenant_id in BaseUsage  were expected, so
any request to /admin/projects/[id]/usage/ will always return the current
tenant from session.
This fix reuse logic from project/overview/ into this view.

Change-Id: I7d762569a7de176fdb8545a226e563afac34adae
Closes-Bug: #1255667
2013-12-06 11:05:25 -05:00
Paul Belanger 74117eb8b6 Gate on H102 Apache 2.0 license header not found for pep8
Now all files are properly licensed per OpenStack Hacking.

Change-Id: I223d983018568357197b0d9cf5dde12c135c53c9
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
2013-11-19 13:55:04 -05:00
Romain Hardouin d43e49ae46 Handle the case no SimpleTenantUsage Nova extension
When the SimpleTenantUsage Nova extension is not enabled,
panels that include usages produce an error and
the usage table is useless.

Three panels use the SimpleTenantUsage extension:
- openstack_dashboard.dashboards.admin.overview
- openstack_dashboard.dashboards.admin.projects
- openstack_dashboard.dashboards.project.overview

This fix avoids errors and does not show the usage
table in such a case.

A context variable 'simple_tenant_usage_enabled' is now
available in templates rendered by usage.UsageView subclasses.

Unit tests now mock nova 'extension_supported' API.

Change-Id: Ib306846bf6c947572ba0e7c773125d03b3dbf68b
Closes-Bug: #1211470
2013-10-08 22:22:35 +02:00
lawrancejing d33f294ba9 Remove unused LOG
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
2013-09-28 23:57:13 -07:00
Tatiana Mazur b4fc9b4bc9 Small "H302 check" cleanup
This patch set removes some commented out stuff that
has been unintentially left in "H302 check" patch set.
It also replaces a couple more method imports with
module imports.

Fixes bug 1215892

Change-Id: I35fd880154a4ea6d6d8d3b3615103c271aa4a005
2013-08-23 18:07:08 +04:00
Tatiana Mazur 953d1b9793 Enable H302 check
This patch replaces some method imports with module imports and
makes H302 test enabled.

Fixes bug 1188531

Change-Id: Ibfbddeaa19cbbb244da58ffd5c918c41f03a0c65
2013-08-22 17:39:09 +04:00
Tihomir Trifonov 0c0153a037 Improvements in csv export for usage data
Added a csv writer using the 'csv' library to format
properly exported data - escaping, encoding etc.
Added a HttpResponse-based class to handle csv generation
Added translation for the CSV columns and template.

Fix bug #1158383

Renamed few occurencies of 'tenant' to 'project'.

Also added a new 'project' in nova_data.py, which required
some refactoring of few tests, that didn't consider the current project
for project-based calls.

Note: I've added a StreamingHttpResponse example,
which is introduced in Django 1.5+ and being advised in the ticket.
However, my opinion is that at the moment we don't need this - it is
too complicated for the current usage.

Change-Id: I18bd70a23b7b8389c7c0f96dbf8794fea5e1e75b
2013-06-21 14:00:37 +03:00
Matthias Runge cea720e793 Sort imports alphabetically
This patch also re-organizes imports to import one per line.

Change-Id: Ia958e3a30a48d4308d08d51df243c1272425c316
Fixes: bug 1188529
Fixes: bug 1188537
2013-06-14 12:05:55 +02:00
Eric Peterson d4b0ab4aa3 switching to use limits instead of quotas
Fixes bug 1178694

Change-Id: I6fad061faf84079492338016fd2bada9a2e434f3
2013-06-05 15:40:37 -06:00
Kieran Spear ef26414b8d Revert "Improvements in csv export for usage data"
This reverts commit a4e583cffb

Fixes bug 1183441, bug 1183230, bug 1183310.
2013-05-23 16:50:57 +00:00
Tihomir Trifonov a4e583cffb Improvements in csv export for usage data
Added a csv writer using the 'csv' library to format
properly exported data - escaping, encoding etc.
Added a HttpResponse-based class to handle csv generation
Added translation for the CSV columns and template.
Improved consistency for exported data - now passing project name
instead of project id for csv export. Also added both project name/id
in the header of a project usage export.

Fix bug #1158383

Renamed few occurencies of 'tenant' to project.

Also added a new 'project' in nova_data.py, which required
some refactoring of few tests, that didn't consider the current project
for project-based calls.

Note: I've added a StreamingHttpResponse example,
which is introduced in Django 1.5+ and  being advised in the ticket.
However, my opinion is that at the moment we don't need this - it is
too complicated for the current usage.

Change-Id: Ic00626b273921fa5c6c89704b3a9e08b252aaeb0
2013-05-22 11:09:49 +03:00
Gabriel Hurley cb8e7c1f8f Splits OpenStack Dashboard bits from framework app code.
Moves everything OpenStack-specific (dashboards, apis, etc.)
into the openstack_dashboard project, achieving a much
cleaner separation between the project-specific code and
the generic Horizon framework code.

Change-Id: I7235b41d449b26c980668fc3eb4360b24508717b
2012-10-11 11:47:50 -07:00