Commit Graph

29 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
manchandavishal be461acd6f Cleanup for Refactor-error-messages
This patch is a clean-up patch for refactor-error-messages bp
which remove the exception message from base message otherwise
the same exception message display twice like
this https://ibb.co/XyFWMdz .

Partially-Implements blueprint refactor-error-messages

Change-Id: I46b632dbb6701785e7d654feff336a27d6ecea9c
2020-09-04 10:39:11 +00:00
pengyuesheng f62349a92b Add use_required_attribute = False in Add Interface Form
When an element is required and hidden,
the browser will report an error when submitting the form.

Here is the code location where Django adds the required attribute to the element:
https://github.com/django/django/blob/master/django/forms/boundfield.py#L221-L222

Change-Id: I68e1145efbe1837861aa1d66fceec497d6d97cb9
Closes-Bug: #1811181
2019-04-03 09:38:22 +08:00
Akihiro Motoki 11eb4e9d3e Fix W503 warnings
W503 line break before binary operator

Looking at the code base, it sounds okay to follow this check.

Change-Id: Id511e0104dc6de5b204021661d4a8776ca6d3658
2018-04-11 18:13:47 +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
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
wei.ying 9808567f3b Correct the log info when get networks failed in project router form
Change-Id: I6735019abb00dea2b052d2868e7aea56d96ee88e
2017-10-17 23:44:56 +08: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
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
Masco Kaliyamoorthy ce65691bfc exclude subnets without gateway in create interface
In create interface form, if we select the subnet which
don't have gateway ip, the create will fail.

we can remove the subnets which don't have gateway ip
from the sebnet options to prevent the unnecessary
server call.

Change-Id: I75cec674516b07e141d74729b545e3d2cadee82d
Closes-Bug: #1478939
2016-02-17 09:12:09 +00:00
Rob Cresswell 22fd7fc661 [Django 1.9] Replace request.REQUEST with POST/GET
Replace request.REQUEST with request.GET or request.POST depending on
case.
https://docs.djangoproject.com/en/1.9/releases/1.7/#merging-of-post-and-get-arguments-into-wsgirequest-request

Change-Id: I0762f9c74b7f9524e520f404507a3d6e6305cb72
Partially-implements: blueprint drop-dj17
2016-01-19 09:18:18 +00:00
tinytmy ca596187a8 filter the subnets which already in the router
When we already add the subnet to router,
if we click 'Add Interface' again, we can see
the subnet also can select, but if we real to
add the subnet, it report a error. We can hidden
the subnet if it already add to the router.

Closes-bug:#1417892

Change-Id: I485608d267b9b235c1e83a990e330dd1ca98f17e
2015-06-01 00:33:01 +00:00
Ashish Chandra 80d05a5c3d Improve help messages on modals
Some general guidelines:
1. Removed contractions
2. Changed "Info" to "Information"
3. Removed the "From here you can..." at the beginning of messages.
4. Explained concepts to users instead of just reiterating the modal
title. Thanks Jeff Calcaterra!

Co-Authored-By: Cindy Lu <clu@us.ibm.com>
Closes-Bug: #1329984

Change-Id: I35af81953cafcbafc28c31b3ce305e8c5e21fe84
2014-08-27 16:12:18 -07: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
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
woodm1979 301569b81d Fix KeyError in router:AddInterface error handle
Under some circumstances the exception handling on adding an interface
to a router will produce a KeyError.

The exception happens in
openstack_dashboard/dashboards/project/routers/ports/forms.py in
AddInterface.populate_subnet_id_choices.

In the exception handling code, a reverse() is called an argument of
request.REQUEST['router_id'] which doesn't always exist.

The fix is quite simple: try to look for it in the initial form data as
well, and if 'router_id' is in neither location, fall-back to the index
page.

Change-Id: I74eaf8cd024d2929fed3d4e00b644e5850e2d5b3
Closes-Bug: 1304533
2014-04-08 10:38:52 -06:00
Maxime Vidori cbb52ebc66 Group specific fields in horizon.form module
According to the Django architecture, all fields are grouped in
the django.form module, Horizon fields were dispatched in two modules
utils and form. This patch cleanup the loading of Horizon specific
fields.

Change-Id: Ib18848a8cc06dbd5984ec02d7cd647145124ced4
Closes-Bug: #1287634
2014-03-04 11:13:59 +01: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
Ana Krivokapic 66ae9cc886 Delete periods from select options
Make the UI more consistent by deleting periods which appear
intermittently at the end of some select options.

Closes-Bug: #1263823
Change-Id: I6f184b205788171fd4931f5a622353d943161123
2013-12-24 05:36:55 +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
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
Akihiro MOTOKI 80f78f12e5 Allow users to create a rich network topology
Fixes bug 1146926

This commit enables Quantum Router support to create a router
interface with a specified IP address. Previously we can connect
one network (subnet) to only one router and a topology we can create
is limited. By this commit we can connect one network to multiple
routers and create a rich network topology through Dashboard.

This commit also fixes the folowing bugs:
* subnet_id in "Add Interface" form and network_id in "Set Gateway"
  form should be required=True since they are required fields.
* An error message is display twice when the above two forms.

Change-Id: Ifb90f70a4468fdf4e8ba356080cd0333f10e595f
2013-03-25 10:42:54 +09:00
Akihiro MOTOKI c97e693a9d Allow non-admin users to clear router gateway properly
Fixes bug 1131193

In Grizzly-3 milestone, quantum made a change to allow regular users
to set non-owned external network as router gateway, but Quantum
router support cannot handle it, particularily non-admin user cannot
clear router gateway. This means non-admin cannot delete a router as
a result. In addition, there is no way for non-admin users to check
if router gateway is set or not since a non-admin user cannot see
a router gateway.

To address the above issues, this commit does the following changes:
- Display "external gateway info" in router table and detail to allow
  non-admin users to check if a router is connected to an external
  network (i.e., a router has a default gateway).
- Move "Set/Clear Gateway" button to router table and Set/Clear
  button is displayed based on an existence of router gateway.
- Move "Set/Clear Gateway" button in Admin panel in the same way
  to keep consistency with Project panel.

Change-Id: Ib096d5e40c88b8a605ad8aae26d1f5cf7fd745e6
2013-03-06 17:12:17 +09:00
Akihiro MOTOKI 0e542cb0e8 Ensure "Add Interface" form in Admin Panel works
This commit add new templates for interface add/delete operations
in admin panel to make sure the original page is displayed after
adding a router interface successfully.

It also changes the following:
- Update the help message in "Add Interface" and "Set Gateway" forms
  (both in project and admin panels)
- Fixes a issue that Project router detail was displayed after setting
  an external gateway to a router in admin panel.
  Admin router detail is expected to display
- Make sure a router name is displayed in router detail in admin panel.

Fixes Bug #1131177

Change-Id: I9728cb68972977f868549b61979d9c779cd9fd4e
2013-02-25 20:35:42 +09: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