Commit Graph

42 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 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
Zuul d1a2db6d19 Merge "Correct error messages on create and update router form" 2019-06-24 08:47:01 +00:00
pengyuesheng 248b8e9715 Correct error messages on create and update router form
The name is not required, so data["name"] may be empty.
When data["name"] is empty, get the id value.
This patch correct error messages on create and update form

Change-Id: I9d5eebf65501c5e182a9a135c97461ff3fcf57e7
2019-05-30 13:47:19 +08:00
gaoyl a473887aaa Add tooltips for "Admin State" in related forms
Now only workflows.py in project/networks/
has the tooltip for "admin state".
Since "admin state" is confusing, there should
be tooltips for wherever it appears.

Change-Id: Ib075efd46af6c8f0d0d61b4ac76160d8de08b77d
2019-05-27 13:20:03 +08:00
pengyuesheng f520815d36 Modify the prompt of create routes and update routes.
The name is not required, so data["name"] may be empty,
but the router.name_or_id must have a value

Change-Id: I0b20d0ab5ff66e199faa58cb9146aa731552c698
2018-11-27 14:01:48 +08:00
Vladislav Kuzmin 19a6c9bc61 Add "Create Router" button to admin panel
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I623acbad9a326845603c7a9f480d05265d5b279e
2018-11-05 09:10:08 +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
wei.ying 0cb96af3a2 Admin State is always UP whatever whether router Admin State is checked or not
On the project creation router page, if we don't check "Enable Admin
State" option, when the router is created, "Admin State" is displayed
as UP. This inconsistency is because the judgment condition of [1]
doesn't hold which causes the "admin_state_up" parameter not to be
passed by the call creation router interface. In this case, the
back-end defaults to "admin_state_up" to be UP.

Since the router "Enable Admin State" option has an initial value of
True, there is no need to check for [1].

[1] https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/project/routers/forms.py#L121

Change-Id: I6b95ffa680eab5c29d2bca6c91fc7f028f7f519a
Closes-Bug:#1748777
2018-02-13 10:53:24 +08:00
wei.ying de9f03c9ab Unable to create router when the external network is specified
In project create router form, when creating router with the external
network, there is no need to determine "ext_gw_mode_supported" since
the "ext_gw-mode" has been checked when the form is initialized.
So, we need to delete it since it's also undefined.

Change-Id: I6dc221638ccda2a8819776679735685cb3c61d56
Closes-Bug:#1733047
2017-11-20 09:53:52 +08:00
Cao Xuan Hoang f7eec152c2 Use ThemableChoiceField
There are still remain some ChoiceField that have not covered.

Closes-Bug: #1732317
Change-Id: Ib9be4f252eba08374f87e4fef5e702a6ea8c1226
2017-11-15 02:27:56 +00:00
Trygve Vea edcd22244f Add a checkbox to disable SNAT on routers
When creating a router, or when setting a gateway on a router - a checkbox
is displayed, which can be unchecked to disable SNAT.

Change-Id: I8bc040018645fe2bde534b7d48e14c17984cc9c4
Closes-bug: #1673076
2017-10-23 16:10:48 +00: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 b9664a1bf1 Routers can be created with availability zone
When 'availability_zone'-extension is enabled, we present the user with
a drop-down menu containing a list of available availability zones.
This sets the 'availability_zone_hints' parameter on router creation.

Change-Id: I96293202ddd855823e89c4c7ba0b1f6a6423aab2
Partial-bug: #1716638
2017-10-19 11:53:39 +02:00
Akihiro Motoki cb391cc933 Do not display UUID in network/rotuer forms
In horizon design we don't show IDs as they are not user friendly,
but forms in the network and router panels show ID as read-only fields.
These fields are only used to retrieve ID of target or parent resource,
but they can be retrieved from "self.initial". (Note that 'initial'
data is set from url parameters in the django views.)

We don't usually show resource name of parent resource as well.
Let's do it consistently for network/router forms.

Change-Id: Ibd4c594e79889e8c605203a79bc35e1ffaa40703
Closes-Bug: #1671593
2017-04-28 08:58:59 +00:00
Jenkins 30a00a0dc3 Merge "Ensure log messages are not translated" 2017-04-27 22:39:12 +00:00
Akihiro Motoki c8cd03189a Use BooleanField for admin_state_up form
admin_state_up is a boolean value but the network and port edit forms
expected a string version of True/False. As a result, True/False string
was shown as the default value in these forms. The field is implemented
as ChoiceField, but there is no special reason not to use BooleanField
for a boolean field and admin_state(_up) fields are the only exceptions
in horizon. This commit replaces all admin_state(_up) fields to
use BooleanField.

As far as I checked, this pattern is used only in the networking
related panels and this patch clean them up.

Change-Id: I9286f6c29d67fec7a88b74661bc8eca945fd9061
Closes-Bug: #1672213
2017-04-14 19:40:48 +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
Cindy Lu 163489b5e9 Horizon selects are now themable: Project Panels
Based on Diana's work.
Complete for Admin Panels: https://review.openstack.org/#/c/290204/

Horizon used a standard select input. Unfortunately this type of
input is only customizable to a small extend. Note: not all
ChoiceFields were converted because they have unexpected
impact.

Change-Id: Id9405c6f0127d6e86db09dfaf772f1275a7d7547
Partially-implements: blueprint horizon-theme-css-reorg
2016-08-01 14:15:54 -07:00
Andreas Scheuring bb38c59777 Revert "Router namespace not created in controller".
Issue has been fixed in Neutron. See patch
https://review.openstack.org/290470

This reverts commit 7334c3cfee.

Change-Id: I0889106367ef0723ea955b09623b804e9b4e76b9
2016-07-14 21:54:19 +00:00
Kenji Ishii 39937f9964 [Trivial] Add required=False to router name in Create Router
Because Router name is not required.

Change-Id: If1056bcd1a8d55e98c2e6a34de6fe2b381cc0136
Closes-Bug: #1594247
2016-06-20 05:11:29 +00:00
Masco Kaliyamoorthy 7334c3cfee Router namespace not created in controller
When creating a router with an external network attached
from the Create Router form a router namespace doesn't
get created on the controller.

By calling the correct APIs, the namespace get
created.

To check the namespace list run the below command
on controller node.
'sudo ip netns list'

Change-Id: I829c707353830ff808b6f6a0b29ccedeca588616
Closes-Bug: #1535707
2016-02-11 12:48:24 +05:30
Jenkins 499a2af767 Merge "improved the create router form" 2015-02-24 01:06:46 +00:00
Masco Kaliyamoorthy 1a5ae92146 makes router id visible in update router modal
In update router modal, the router id textinput
is hidden. since duplicate router name is allowed,
it is difficult to differentiate.

This patch is making the router id field visible
and readonly.

Change-Id: I898bdc7a92b011ce61ab0375e04d81d82a83a313
Closes-Bug: #1421589
2015-02-20 22:53:03 +00:00
Masco Kaliyamoorthy 55f85114ce improved the create router form
In create router form some optional
parameters and help text is missing.

This patch is adding the admin state
and external network parameters and
help text.

Change-Id: I36295a70f25f7e09a89d78aff07643e89c52ba2f
Closes-Bug: #1421128
2015-02-20 23:37:47 +05:30
liyingjun 33092aec9b Make admin_state translatable
In several panels the network admin state is hardcoded to UP/DOWN,
this patch aims to make the admin_state translatable.

Change-Id: Ia0e5ba02a4980c1db0d914e2689956feee5fb718
Closes-bug: #1390207
2014-12-16 15:50:47 +08:00
Akihiro Motoki 03c562736b Disable router HA attribute due to Neutron bug
Change-Id: Iccd0e2dfb545a95cb1b9a809187103bb3a5a76a7
Closes-Bug: #1378525
2014-10-17 21:50:42 +09: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
Sam Betts ab9e36e9b2 Made Admin State choice more human readable
The Admin State choices in create forms throughout horizon
were not very clear, this patch presents that choice in a much more
readable and understandable way. The field is changed from a boolean
field to a choice field with the different states, making it more
obvious what is being decided.

Change-Id: I7091e5ccf91c57d3f64e2d4415bed952d09ada71
Closes-Bug: 1370322
2014-09-17 18:34:14 +01:00
Akihiro Motoki 62a0ec2659 Use integer instead of string for form max_length
This is a follow-up patch of a comment
in https://review.openstack.org/#/c/119134/

Change-Id: I87f0a5698e5ccde251eb9cd9c1280291f5d746e0
2014-09-14 15:49:39 +09: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
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
Facundo Farias 4248bc067d Enhanced error message when router creation failed
Changed error message to show when the router creation
fails due resource quota restrictions.

Change-Id: If5a43d4132adc653694cc42c3d658ca2d88adc33
Closes-Bug: #1278482
2014-03-03 19:26:49 -03: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
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
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
Kieran Spear 242c8df495 Enable H201: do not write "except:"
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
2013-08-13 17:21:32 +10:00
Mark McClain 84e054b200 update Quantum references to Neutron
implements bug: 1197208

Change-Id: I14de163ca3cf498f5cb738a4c09088bba1759488
2013-07-09 17:51:54 -04: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
Zhenguo Niu 4a8ac74a4d Make 'Router created' message translatable
Change-Id: If0e246157a72fd1cabdbbde77e0c057d9d611eaa
2013-06-06 13:26:03 +08:00
Nachi Ueno eed092a5bb Support Quantum L3 function
Implements bp quantum-l3-support
Implemented basic CRD for router
Add/remove interface support
Support set gateway and clear gateway

Change-Id: Ie4cac962eb8fadc021c80cf05e2aa63caab3c00a
2013-01-07 20:24:57 -08:00