Commit Graph

44 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
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
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
Julie Gravel 24c8cfb31d Change Network form names from Update to Edit
Change Networks, Routers, Ports update form names from 'Update xxx'
to 'Edit xxx' to be consistent with the corresponding row actions.

Change-Id: I7d42830e640c75bf2bafd10bcf3ec96de592dc3d
Closes-Bug: #1688645
2017-05-10 12:27:12 -07: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
Rob Cresswell 83e3ff88ec Remove duplicated modal_header statements
Across the codebase we've been using modal_header values that are
identical (or very close to) the page_title values. This patch sets the
modal_header to default to the page_title value, and cleans up a few
inconsistencies. Also deleted a couple of redundant submit_label values
that were identical to the default ("Submit").

Change-Id: I88815c3801c29b3fbc41e0cb426a50653255595f
Closes-Bug: 1653960
2017-01-04 13:31:36 +00: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
Akihiro Motoki ce6e34a5e4 Honor comments for translators when extracting messages
To extract commments for translators, '--add-comments' option
must be passed to pybabel. Comments for translators were extracted
when we used Django tools to extract messages, but when we switched
to pybabel it was lost. This commit adds the option to run_tests.sh.

Move the place of existing comments for translators
so that pybabel can find them. Django tool and pybabel
expect a bit different places.
Also add comments to ungettext_lazy in test codes.

Closes-Bug: #1553581
Change-Id: Ia2df36dfebb59bede19d57b2158a907126ca1944
2016-03-07 23:11:39 +09: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
Rob Cresswell f38ddf2032 Add breadcrumb to more details pages
This patch adds basic Breadcrumb nav to the detail pages for Data
Processing, Databases, Metadata Definitions and Routers.

Change-Id: I114e93799b957db39cbe0d4e49d3e6869bc9d92d
Partial-Bug: 1413823
2015-11-09 20:55:12 +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
Masco Kaliyamoorthy ffae6e6757 Corrected wrong url in router detail page
In router detail page, the link to the network detail page
redirecting to admins panel. so the non admin users not
able to access the network detail page from router detail page.

Change-Id: If6d70dcb214b9557d8501b9252b75fbfd9add248
Closes-Bug: #1504123
2015-10-08 18:52:22 +05:30
Jenkins af617d2406 Merge "Made router detail status and admin state translatable" 2015-09-09 14:55:22 +00: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
Lucas Palm 210665a126 Made router detail status and admin state translatable
The "Status" and "Admin State" labels on the Router Details panel in both the
Project and Admin dashboards are currently untranslatable.  This patch
fixes that issue and allows these labels to be translated.

Change-Id: I5f78701d4b830bab115a7e8da39714f00da90273
Partial-Bug: #1441366
2015-08-23 00:07:29 -05:00
Rob 14b2e700e8 Fixes inconsistent Router Details page
This patch addresses the stylistic inconsistencies in the Router details
pages, by changing it into a tabbed detail page

- Fixed bug on the Interfaces table causing the Name field to be empty
- Overview page has also been restyled to more clearly show information
  and link to relevant network
- Increased inheritance where possible, to reduce duplicate code
- Deleted unused files/functions. These can always be added as required
  later, but there is no need for unnecessary code bloat

Co-Authored-By: Sam Betts <sam@code-smash.net>

Change-Id: Ifbdfbf46127e9445395207c547c2b81ea9459dac
Closes-Bug: 1378895
2015-03-23 10:30:07 +00:00
Rob Cresswell fa649e9edd Refactor modal forms for Routers
Refactoring Routers modals
Based on merged patch: https://review.openstack.org/#/c/123472/

Change-Id: I6cbc06843e57f10073407a0a69b5884f8e06b840
Partially-Implements: blueprint form-template-to-view
2015-02-17 16:22:32 +00:00
Sam Betts 3d71d4bead Reduce title duplication in project networking
Patch https://review.openstack.org/#/c/142802 adds a method of
reducing duplication of page title logic, this patch applies that change
to the project network topology, networks and routers views.

Change-Id: I2a1372eb9d82acb3d9a259e19a3ecfb8aeff4c02
Partial-Bug: 1413749
2015-02-17 10:01:37 +00:00
liyingjun 403b81db29 Replace set_id_as_name_if_empty with name_or_id
we can replace set_id_as_name_if_empty with name_or_id in
in all neutron related place to reduce a extra loop call
since set_id_as_name_if_empty is called every after *_list.

Change-Id: I341adb3a581337790e22e049e5b72df11b462b44
Closes-bug: #1370986
2014-12-09 09:57:28 +08:00
Ana Krivokapic aa93056953 Add dropdown actions to all details pages
Partially implements: blueprint detail-pages-ia

Change-Id: Ic09385d19b417b256cbc51d044d66ecbb54c7d52
2014-10-07 14:35:10 +02: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
Akihiro Motoki d4abf856c5 Translation feedback - Add contextual marker for short strings
This commit add contextual markers to some short strings
which turned out difficult to distinguish during translations.

The detail descriptions are available in the bug report.
Closes-Bug: #1367104

Change-Id: I5ec2045b12542c8474356023bed73d583dc8dccd
2014-09-17 03:37:23 +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
Jenkins de11167ef1 Merge "Horizon changes for DVR" 2014-08-27 07:54:00 +00:00
woodm1979 d9ecd8d157 Fix handling of missing external network
When an external network can't be found, project/routers/index.html will
result in a type error caused by calling exceptions.handle when no
exception is present.  In this case, an error message should be
displayed, and the missing-network should be indicated to the user.

Also added tests for this case.

Change-Id: I3aaa64de28738051ad84cc587fbb6cfd546f4662
Closes-Bug: 1220345
2014-08-25 19:22:11 +00: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
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
Radomir Dopieralski b7537a8b81 Use memoized_method decorator in views
A lot of horizon's views use the pattern:

    def get_data(self):
        if not hasattr(self, "_data"):
            # Calculate data here.
            self._data = data
        return self._data

This is copy-pasted all over the codebase. It's better to handle that
with a single decorator. In the future, we might even replace it with
some better caching approach.

Closes-bug: #1248230
Change-Id: Id021fccf9032e5068993ec91a7774a5d0fbf29bb
2013-12-18 16:46:30 +01:00
Kevin Benton bb248e1d54 Adds router rules support to router details
Adds a table display and grid display for router
rules on the router details page. Changes router
details page to tab style page.

Implements: blueprint horizon-routerrules

Change-Id: I86d81db31f09e2a8d3b66a327fb9c1fb055e9d94
2013-10-16 22:39:13 -07: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
simon afaa72185c PEP8 E126 has been resolved
Change-Id: Ic5d3b96b6061b7a34e7620d8d09418bd6976fbb1
Partial-Bug: #1085346
2013-09-17 20:48:09 +09: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
Alex Gaynor 56ae8fdfc5 Enable pep8 F841 checking.
This check looks to see whether a local variable
is unused. Also fixed all violators of said check.

Change-Id: I7c186df41b5601078ffc54588aace8136c6576bd
2013-07-22 01:09:52 -07:00
Tatiana Mazur 3087c3486b Enable H304 check
This patch replaces relative imports with full paths and
makes H304 test enabled.

Fixes bug 1188535

Change-Id: I47254cf9a790727102f7993d0fd107da514983df
2013-07-16 18:49:56 +04: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
Matthias Runge 4ac70a732a remove unused imports
In the move to make flake8 tests stricter, we need a code
cleanup earlier.
This removes all unused imports and also enables tests to prevent
them for the future.

This patch also includes the checks on __init__.py files.

Change-Id: I34055803f7c4726682ac6fb95cc5b50ba761fec8
Fixes: bug 1188134
2013-06-13 07:51:10 +02: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
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