Commit Graph

53 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
YuehuiLei 87f498bee5 Drop the usage of unicode prefix from unicode strings
All strings are considered as unicode strings in python 3,
so we no longer need "u" prefix (u'...').

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I796d2fcdca066475bbf29d25cbf2aa67b2b2178b
2021-02-12 13:05:27 -06: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 74df97f57c pylint: Fix unnecessary-comprehension warning
'unnecessary-comprehension' warning is emitted when
unnecessary use of a comprehension is found.

classes attribute in Action can be a tuple,
so we need list() to ensure it is a list before adding 'disabled'.
I think it is time to introduce a method in Action class or somewhere
but it should be handled separately.

Change-Id: I16a98d56b6d0bd0af234b00735c6ed576620df7e
2020-09-27 12:44:16 +09:00
Akihiro Motoki 692778f8cf pylint: Address no-else-return warning
This pylint check 'no-else-return' might be debatable.
but as far as I checked it works in most cases.

Change-Id: Ie8574d4a529454c6e050fa62a7a17ea097d00240
2020-09-27 12:44:16 +09: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 3e8088b800 Improve exception message in network related Batch/DeleteAction
DeleteActiona and BatchAction in the network, subnet and router tables
are improved using handle_exception_with_detail_message decorator.

There is no need to have separate delete action in the admin network
and subnet tables now, so they are merged into the corresponding delete
actions in the project tables.

Change-Id: I976e4e6ed8e9c1430f82ac362c080853744b5d07
Closes-Bug: #1733207
2018-01-23 22:46:29 +09:00
Akihiro Motoki 1340904d47 quota: Use network quota field names consistently
Previously neutron quota names and nova-network quota names are
mixly used and this makes the readability terrible.
We no longer supports nova-network, so it looks simple to use
neutron quota names consistently.

Neutron quota names use singular form and it is different
from nova and cinder (which adopt plural form as quota names).
Although it might be confusing, the mixed usage is much worse.
Some wrapper layer may address singular vs plural form issue,
but it can be solved later. Let's use neutron quota names
directly now to simplify the code.

blueprint make-quotas-great-again
Change-Id: Ie31414ada34cbdbd046063b512d3cef0a6e68acf
2017-12-13 20:27:02 +09:00
Trygve Vea a6ae818e71 Wrap various API calls with try/except in Router panel
This patch adds a try/except around all api.neutron-calls that are not already
covered by exception handling.

Change-Id: I5da17414ea932def6f2a21b2a8dca981e755cca6
2017-10-23 12:27:02 +00:00
Trygve Vea 59021766b8 Router lists display availability zone information
When 'availability_zone'-extension is enabled, we present the user with
a column showing the availability zones for which the router is
scheduled in.

Change-Id: I87f6bfcee1f129a77e6bf9efa973a79bfa2afe14
Partial-bug: #1716638
2017-10-19 07:14:32 +02:00
Mykhailo Dovgal ca0f293cb6 Fix tenant_quota_usages function calls caching
This patch changes type of 'targets' input parameter in
tenant_quota_usages function from list -> tuple. It provides
possibility for @memoized decorator to cache function calls.

Change-Id: I3c32c3b65ae91e8487fda6148f259fe1931d7c9f
Closes-Bug: #1700578
2017-06-26 17:36:07 +03:00
Akihiro Motoki 359467b401 Retrieve quota and usage only for resources really required
tenant_quota_usage() is used to retrieve quota and usage
to determine if a resource can be created.
However, tenant_quota_usage retrieves quota and usage for
all resources and it can be a performance problem.

This commit allows to load quota and usage only for resources
which are actually required.

Closes-Bug: #1675504
Change-Id: Iab7322a337a451a1a040cc2f4b55cc319b1ffc4c
2017-06-14 08:53:32 +00:00
Akihiro Motoki ced987815d Ensure log messages are not translated
Previously translated messages are included in log messages
and it was determined what language is chosen by users.
It makes difficult for operators to understand log messgaes.

This commit tries to use English messages for all log messages.
The following policies are applied based on the past discussions
in the bug 1406333 and related reviews.

- English messages are used for log messages.
- log messages include exception messages if possible
  to help operators identify what happens.
- Use ID rather than name for log messages
  as ID is much more unique compared to name.
- LOG.debug() in success code path are deleted.
  We don't log success messages in most places and API calls to
  back-end services can be logged from python bindings.

Change-Id: Ie554463908327435d886d0d0f1671fd327c0cd00
Closes-Bug: #1406333
2017-04-11 10:24:01 +00:00
Ying Zuo 14ab4d1c0c Fixed inconsistent names set for BatchAction
The name of a BatchAction should be one word.

Change-Id: I5172454b23a5aab951a089f05b0f5a04e1a72ba6
Closes-bug: #1626210
2016-09-21 12:57:27 -07:00
Jenkins 01b77c6b42 Merge "Prevent long names breaking table layouts" 2016-08-23 12:05:16 +00:00
Rob Cresswell 07d33cf462 Prevent long names breaking table layouts
Adds a word-break class that can be added to tables to prevent large
column values breaking the table shape.

Change-Id: Icca10d9c29254d176dc7f8b7c039bc19c3f52c72
Related-Bug: 1565724
Closes-Bug: 1584785
2016-08-19 09:21:33 +01:00
jlopezgu 02594a758f Server-side filtering routers
Implements server-side filtering for routers:
  - Admin->System->Routers
  - Project->Network->Routers

Implements blueprint: server-side-filtering

Depends-On: Idaee431ed15de81e5ea049948b55d1526e2024ac
Change-Id: Ic93ce6d2a73f33e639a9a3fa0f8846a7d1cbbe9a
2016-08-09 13:58:51 -05:00
Diana Whitten 8896835353 Angular vs. Django Table Danger Button Inconsistency
A button should have either btn-default OR btn-danger ... not both.

This also removes the flashing red change this  problem caused when
adding a 'disabled' class to the button after its already been
rendered on the page.

Closes-bug: #1557729
Closes-bug: #1549957

Change-Id: I6e035868be4df653438b4d31b462729c3fe06d9f
2016-04-13 09:13:34 -07:00
Elena S b12047454f Add test_router integration test
Create both test for router create/delete and router Page Object. Also
decapitalize routers table name so it could be referenced in
integration tests like any other table.

Change-Id: Ic4fdfa82584dd3cad1e906d5fc5526c4a758675f
2016-02-15 09:48:18 +00:00
Itxaka 031aed50a3 Translate status in network topology
Enables the translation of the status on
network topology.
Provides a json decoder that will resolve
lazy objects like translations.
Moves STATUS_DISPLAY_CHOICES and
ADMIN_STATE_DISPLAY_CHOICES out of the RoutersTable
for easy access to their status from other parts
of the code.
All network objects have their status translated
and a new item called original_status which provides
the untranslated status so the javascript code
is able to display the proper image (green/red)
based on the original status instead of doing it
on the translation.

Change-Id: Ic8cebafe7fbc291fa8933e8d1c2a244be20128e3
Closes-Bug: #1323599
Closes-Bug: #1484113
2016-01-18 13:19:20 +00:00
Lucas Palm b56b962a8f Refactor status and admin state translation code
In some of the dashboard 'views.py' files, there is code that enables
the detail status and, when applicable, admin state labels to be
translated.  The current coding style of these sections is hard
to read.  Any and all sections of code that use this style should
be refactored to enhance the code readability.  This change
proposes to create a single utility method that handles this
repetitive code block that is used in many places.  Thus to perform
the translation label lookup, this method need only be called.  This
method will provide a single clean and consistent code block that can
be used for any of these situations in the future.

Change-Id: I6353abef58fc2a481d4379eb1a2f8289d7f1790b
Closes-Bug: #1490031
2015-10-30 15:36:52 -05:00
Mike Hagedorn 5ba219acbf Neutron Quota Settings Flag Disables Neutron GUI
if OPENSTACK_NEUTRON_NETWORK["enable_quotas"] = False buttons will not appear
and exceptions are thrown.   This is because a dict is searched for a key
("available") which wont be there if its disabled.  This generates a
KeyError at runtime.

As currently written enable_quatas -> False essentially disables Neutron usage.
This is not a desirable outcome.

This patch shows Neutron related buttons and ignores the quota settings,
which seems more in line with the notion of disabling quotas.

Closes-Bug:#1482354
Change-Id: I9485ddeece74d87317c2587498f5f79d4ffdb66e
2015-09-24 20:50:50 +00:00
Jenkins de3f223b32 Merge "admin state column added in router table" 2015-03-05 11:27:22 +00:00
Masco Kaliyamoorthy e2cbdf04ac admin state column added in router table
admin state column is missing in router
table.

this patch is added the admin state column
in router table with the display choices
to translate the values

Change-Id: I9653ded182e9070f22249be53f7b9b6397c43b54
Closes-Bug: #1421166
2015-03-05 11:03:18 +05:30
LIU Yulong 3b2b07d8f8 Add help text to BatchAction
Add appropriate help text to some important batch actions.

NOTE:
    The another patch:
    https://review.openstack.org/#/c/139920/
    to add appropriate help text to some important delete actions.

Implements blueprint: add-batchactions-help-text

precondition blueprint: make-batchaction-help-text-configurable

Change-Id: Ide21a4fbcb327ed7edfc98f3e36b54aa527e0084
2015-02-27 15:12:34 +08:00
Masco Kaliyamoorthy c6552fe5d2 made router status value translatable
in router table, the value of status
column is not translatable.

this patch added a display choice for
status with translatable option.

Change-Id: I560591b8ad4112b868da0e0015720dd4a5ac4bf0
Closes-Bug: #1420287
2015-02-11 10:30:26 +05:30
lin-hua-cheng 0cde6aa055 Move to hacking 0.10
Release notes:
http://git.openstack.org/cgit/openstack-dev/hacking/tag/?id=0.10.0

Per the release notes, H307, H803 and H904 has been removed.

Fix code issues with H238 and W292.

Change-Id: I747ebb64db5825bc70f1ae19c1c1f5ca2089c06d
2015-02-04 20:27:07 -08:00
Masco Kaliyamoorthy 6fb1ecd013 added filter for networks and router
client side filter is missing for
network and router tables on both admin
project.

this patch adding the filter for both
network and router tables.

Change-Id: I27027da70b8b1e1e50ecfa414fa19a14e11064d7
Closes-Bug: #1413550
2015-01-22 17:56:47 +05:30
David Lyle 794ba46d56 Standardizing translation of "-"
There are several places where "-" or '-' are not translated strings.
There are others where they are. This should be consistent. I can see
value in being able to translate "-" to another character.

Closes-Bug: #1398892
Change-Id: Icfcd20fb597122d8efa30debf9f6e7273f036419
2014-12-03 10:09:17 -07:00
Miguel Grinberg b37fa64bdd Automatically remove interfaces on router delete
This change removes all attached interfaces from a router when it
is deleted from the project dashboard. This was only being done when
the router was deleted from the admin dashboard.

Change-Id: Ic0b639bfad7451bb5acbf486c39e349c938723db
Closes-Bug: 1384400
2014-11-18 22:25:03 +00:00
Jenkins 27c56ba541 Merge "Fix inconsistent behaviour exceeding quota limit" 2014-10-10 12:12:57 +00:00
Bradley Jones 42d73e85a6 Fix inconsistent behaviour exceeding quota limit
Added quota checks for security groups, networks and routers. If quotas are
exceeded then buttons to create are disabled and feedback is given to the
user.

Appropriate tests are also in place

Change-Id: Ie49db5397d87a0c9a583b64e5de34460144b5956
Closes-bug: 1278449
2014-10-06 13:10:14 +01:00
Jenkins 1544a7d8af Merge "Add HA mode support for Neutron router" 2014-09-30 09:54:33 +00:00
Akihiro Motoki f06e401adf Add HA mode support for Neutron router
HA (high availability) mode support is one of the important topics in
Neutron Juno, and this patch adds HA router mode support to Horizon.

This commit also changes the default value of enable_distributed_router
in the example local_settings.py to False. In Juno release of Neutron,
the distributed router and L3 HA mode cannot be enabled at the same
time and only L3-agent deployment with L3 Router service plugin
support both features. Thus I believe it is reasonable to make both
options default to False to avoid unnecessary confusions to operators.

Closes-Bug: #1370110
Change-Id: I77b0292b761f08b4580846f6d58443f7df9a1f6b
2014-09-26 17:08:26 +09:00
Doug Fish 827e5a36fa Fix concatenation in Network and Router actions
Remove concatenation and pluralization issues from Delete
Network, Delete Subnet, Delete Router Rule, Clear Gateway,
and Delete Network Profile

Change-Id: I0898b446abd79672b43b55be62dba6250a4fdd58
partial-bug: 1307476
2014-09-25 13:08:01 -05:00
Sam Betts 107cf8b328 Add mixin to replace replicated get_policy_target
Fix adds a mixin to replace the replicated get_policy_target
function. Duplicated code is removed from many classes and mixin is
inherited.

project_id, user_id and domain_id are now default in the generated
policy_target dict but are set to None if the data doesn't support it,
this is to provide the most flexibility for operators writing policy.json
as discussed in the bug report.

policy_target_attrs attribute added by the mixin is overwrittable by
sub-classes of the mixin to override the defaults for custom policy_target
information.

Change-Id: I26759f145b8756bd1eef585c8107160277061523
Closes-Bug: 1317238
2014-09-23 17:39:55 +09:00
Doug Fish a40f52f097 Fix concatenation in network tables
Remove concatenation and pluralization issues in network, subnet,
port, interface,wq and router tables.

Change-Id: I9ab759703505b188df0ec16b92f08d6f741ba944
partial-bug: 1307476
2014-09-16 14:36:08 -05:00
Akihiro Motoki 6a8ea3385c Add "Edit Router" to allow to change router type
Neutron DVR implementation allows to change router type from
centralized to distributed. This commit adds "Edit Router" form
which is not implemented so far to allow this feature.

This commit also adds:
- admin_state field to the router detail.
- documentation on a new option enable_distributed_router

Completes blueprint enhance-horizon-for-dvr
Change-Id: I4b46e44c417726217ed034e305827b102ba656f8
2014-08-30 05:01:25 +09:00
Saro Chandra Bhooshan 0d8fb6ce08 Horizon changes for DVR
Feature completed :
1. Admin router panel
   + New "Distributed" column introduced.
   + New Field "Distributed" added on to
     router detail panel
2. Project router panel
   if logged in as "Admin"
   ======================
   + New distributed column introduced.
   + New Field distributed column added on to
     router detail panel.
   + New Router Field dropdown box introduced in
     create router form.
   if logged in as "nonAdmin"
   =========================
   + Router Type dropdown will be invisible for
     non admin.
   + Distributed information will be
     hidden from details panel.

implements: blueprint enhance-horizon-for-dvr

Co-Authored-By: Akihiro Motoki <motoki@da.jp.nec.com>

Change-Id: I995745dd72a8b750866c0977a7d7cf42036f716f
2014-08-25 14:26:28 +09: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
Jiri Tomasek 92146772b6 Update Twitter Bootstrap to version 3
Updated to bootstrap 3.2.0
back to v3.1.1
fix base-line-height variable
Revamped grid system
Replaced help-inline with help-block
Change .control-group to .form-group
Add column widths to horizontal form labels and .controls, remove .controls class
Datepicker form fix
Add btn-default to btn elements with no other color
Topbar switcher fix
Rename button sizes
Replace alert-error with alert-danger
Removed alert-block
Alerts fixing
Updated LinkAction and Action table actions to define icon, replaced btn-default icon with glyphicon
Replaced icons with glyphicons, removed btn-icon styling from horizon.scss
change Button Icons text in customizing docs
Fixed table header
Fix page_header h2 margin
Nav accordion fix
Tables fix
Modal fixes
added form-control class to input and selects
Forms fixes
Workflow modal fix
Fix quota bar
updated customizing docs
removed unused styling from horizon.scss
make datepicker form inline
fix table filter styling
added btn-danger to terminate instances button
fixed loading spinner
form fields and validations
Created bootstrap_form_field filter and template to render bootstrap forms properly
Style up the datepicker
Fixed failing test cases

Implements: blueprint bootstrap-update

Change-Id: Ic826849be1af7fc6bf06f97dd7a60fc54b862148
2014-07-28 16:13:21 +02:00
Jenkins bf4950ccc0 Merge "adding policy check for neutron" 2014-05-29 19:51:27 +00:00
woodm1979 70384e78ca Exception handling should not use exc.message
In looking at
https://review.openstack.org/#/c/77613/3/openstack_auth/backend.py , it
occurred to me that many other instances of e.message are likely lurking
throughout our code. And especially because Alex Gaynor decided to weigh
in, I think we have a somewhat authoritative view of how this should be
solved.

Change-Id: If00dd70de07ffd278d72c7d5cdf9b0021da4663a
Closes-Bug: 1319918
2014-05-19 08:28:11 -06:00
Brian DeHamer d93722d379 adding policy check for neutron
Policy checks for all actions on firewalls, loadbalancers, network_topology,
networks, routers and vpn panels.

Co-Authored-By: Lin Hua Cheng <lin-hua.cheng@hp.com>
Change-Id: Id12257d3200f8af6ff590fd576c4cb6e414b455a
Implements: blueprint network-rbac
2014-05-07 11:10:33 -07: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
Radomir Dopieralski 028332da4a Remove #noqa from most common imports and add them to import_exceptions
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
2014-01-07 12:26:35 +01: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
Mark McClain 84e054b200 update Quantum references to Neutron
implements bug: 1197208

Change-Id: I14de163ca3cf498f5cb738a4c09088bba1759488
2013-07-09 17:51:54 -04:00
Wu Wenxiang 70277cd581 Correct exception msg in ClearGateway::action
Bug:1185059
    UnboundLocalError raised when clear gw on a router

Change-Id: I0dda29eb1d55ab551ac43a8ca20529fff9e689c8
2013-05-28 23:36:53 +08:00
Gabriel Hurley 4d8e331635 Updating .po files for translation.
Change-Id: I55f5eaca73e7962bbf48903786ec3d3665ba01e0
2013-03-11 21:12:51 -07:00