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
Akihiro Motoki 3adff90a37 Add "Edit Port Security Groups" action
This commit adds a new action "Edit Port Security Groups"
which jumps the interfaces tab of the instance detail page.

In addition, a warning message is added to the "Edit Security Groups"
form because if a user change security groups as an instance level
the change will be applied to all interfaces of the instance, so
it would be nice if we can provide a good navigation to a page
of editting security groups per port.

Previously, UpdateMembersStep does not support help_text_template option.
To use a bold tag in the added help message, we need to use a template
instead of help_text, so _workflow_step_update_members.html is updated.

Closes-Bug: #1750147
Change-Id: I71437a376b94cab90df0e423aa7e1d2d0d8387ee
2018-04-22 07:44:20 +09:00
Akihiro Motoki 500acb47b7 Move common SG workflow classes into separate module
This is a preparation for a fix of bug 1750147
to avoid some import circulation.

Change-Id: I4198c3b137976413ebb704d58162b56dbb321a9b
Related-Bug: #1750147
2018-04-13 22:37:39 +09:00
Akihiro Motoki 3051dee604 Ensure to show security groups only from current project
Previously when logging in as a user with admin role,
if we visit "Edit Security Group" action of the instance table,
security groups from all projects are listed.

Change-Id: I71ff940434ef8dc146e934dc833c4d26829930c0
Closes-Bug: #1750140
2018-04-08 15:31:08 +09:00
liyingjun 2ad84cb34f Support description for instance update/rebuild
In Nova Compute API microversion 2.19, you can specify a description
attribute when creating, rebuilding, or updating a server instance. This
description can be retrieved by getting server details, or list details
for servers, this patch adds support for this attribute for instance in
horizon.
This patch adds description for instance update/rebuild

Change-Id: I1c561607551fe6ed521772688b643cb27400e24e
Closes-bug: #1753661
2018-03-30 11:02:27 +08:00
Akihiro Motoki 28fd6b233d Switch project instances tests to mock
Python3, map() returns a map object. It is better to ensure to pass
an interable object when the value is passed to another library.
It also breaks mock assert_has_calls/assert_called_once_with
because they fails to compare map object and an array.
This commit changes map object passed in
api.neutron.server_update_security_groups into an explicit array
to address this problem.

Change-Id: I4a45489cdbe2f5ca3b17e30f2e62159dd5ab74f8
Partially-Implements: blueprint mock-framework-in-unit-tests
2018-02-22 14:46:23 +09:00
Kenji Ishii e9db12382e Support security groups association per port
This patch support operation for operators and project users to
associate security groups to a port. The feature is mentioned at
the neutron user feedback session in Barcelona summit [1].

This function UI is same as the function of security groups
association per instance. To realize this, the way of implementation
for 'Edit port' is changed, which move from a single modal to a
workflow base.

[1] https://etherpad.openstack.org/p/ocata-neutron-end-user-operator-feedback (L.35+)

Also we need to display how security groups is associated at a port.
At the moment, there is not way to be able to see it (only this function).
It should be done as an another patch.

Change-Id: I96e0fafdffbf05b8167ec1b85f7430176fdaab90
Closes-Bug: #1637444
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
2017-10-20 23:57:40 +00:00
Akihiro Motoki 9067ae8b0f Move SG and FIP API wrapper to api.neutron
We no longer need to have SG and FIP API wrapper in api.network
as we only supports a single network back-end.

Completes blueprint drop-nova-network

Change-Id: I4e59d897508b497a3cd2ae2fda93b30b786610dc
2017-06-04 17:51:25 +00:00
Akihiro Motoki 07f964c42e Drop Nova security group dependency from dashboard
This commit drops Nova security group dependency from
the dashboard implementation.

security group support in the nova API wrapper will be dropped
in a separate patch.

Also removes api.network.security_group_backend()
as it is no longer needed.

Partially implement blueprint drop-nova-network

Change-Id: I224010eb59068a7cc4f97c2453d499adde7644b4
2017-04-28 08:28:41 +00:00
Masco Kaliyamoorthy 3cb374b1c2 Wording for Security Groups is incorrect
The wording on the Security Groups tab for the Edit Instance window
is wrong. This patch Correcting it.

Current string: 'Add and remove security groups to this project ...'

New string : 'Add and remove security groups to this instance ...'

Change-Id: I76d3afb9174d1428a01dacdc3770a9ebac8f5ce8
Closes-Bug: #1493252
2015-09-08 13:55:19 +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
Kahou Lei 520c29cdf0 place the word "Info" with "Information"
Update necessary html files.
Test it on GUI and unit tests passed

Change-Id: Ic1d66a68c9de45c52884109e360917c1eefbfac8
Closes-Bug: 1394315
2014-11-21 00:12:48 +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
Tatiana Ovchinnikova 9621ea3a90 Cleanup for Horizon fields
Since 'True' is the default value for 'required',
additional assignments are not needed.

Change-Id: I11ae029949e6245af1cf8b0c83825a2ed384aec4
2014-07-25 12:07:23 +04: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
Yuanhui Liu ea5ae37532 Enforce length checking for instance name field
Add the max_length checking for instance name field in Update Instance.
Also changed the max_length value from 80 to 255 in Create Instance
to match the backend's restriction.

Change-Id: I52398a13a545449699a7209db49c06859daa9463
Closes-Bug: #1279590
2014-03-10 16:04:27 -07: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
Julie Pichon 89c648e3b4 Internationalise a couple of forgotten strings
Change-Id: Ia17cbcd7d5127ca83a925ce9f31bf095a23062e8
Partial-Bug: #1224338
Closes-Bug: #1224289
2013-09-11 20:05:32 +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
Lin Hua Cheng ee8bdb7e15 Refactoring of user assignment workflow.
The javascript code and template for project membership has been
renamed to horizon.membership.js. It has been modified to take
step_slug as an argument, this is used as the identifier for the
membership step variables - for supporting multiple membership step
in a single workflow.

Also, removed unused template, tables and views.

Change-Id: I8685a307006cabc7005def160875c844e24c60ef
Fixes bug 1208558
2013-08-06 13:59:05 -07:00
Akihiro MOTOKI 695bf560c0 Neutron Security Group native support
blueprint quantum-security-group

Rule table view
* Add direction and ethertype columns (which are specific to Neutron)
  It may be better to hide "Direction" and "Ether Type" columns
  unless Quantum security group is enabled.
* Merge ip_protocol/from_port/to_port into one column for better view
* Use "::/0" for IPv6 ANY instead of "0.0.0.0/0"
* Rename "Source" column to "Remote".
  (The naming "source" does not fit egress rules)
* Display security group name in the title of rule detail view

Rule creation form
* New arguments 'direction' and 'ethertype' in security_group_rule_create()
* Set the default value of 'direction' to 'ingress' in forms.handle()
* Rename 'ip_protocol' to 'rule_menu' and 'source' to 'remote'
  Note that rule_menu is retrieved from rule.ip_protocol in the unit tests
  since they are tests for custom TCP/UDP/ICMP rules.

Network abstraction layer for security group management
* Move security group methods to api.network
* Add Neutron security group API implementation
* Move base classes for network abstraction to a separate module
  (api/network_base.py) to avoid circulated import between
  api.network and api.nova/api.neutron

Add a configuration parameter to control Neutron security group support
* Neutron security group support is enabled when Neutron is enabled and
  enable_security_group in OPENSTACK_NEUTRON_NETWORK in settings is True.
* Not all neutron plugins support security group, so we need a way
  to control neutron security group is enabled or not.
* It can be determined by supported extension list from Neutron
  and it is a possible future work.

Move get_int_or_uuid to openstack_dashboard/utils/filters.
* get_int_or_uuid is now used in security_group implementation as
  well as floating IP logics.
* In addition the depth of the directory tree becomes longer and
  it is hard to fit the import line in 80 chars.
  It is a good chance to move it to a common directory.

Add __repr__ to API**Wrapper to make it easier to debug.

Limitations:
Neutron supports per-port security group. security groups can be
associated with a port instead of an instace and each port can have
a different set of security groups. It is not a scope of this BP
and is a future work.

Change-Id: I5410e88043a364596037b9ebcc566cd50b317614
2013-07-12 21:03:40 +09: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
Brooklyn Chen 08e6ed7392 Use ugettext_lazy instead of ugettext.
We should use ugettext_lazy to let users in different languages
get correct translation.Though in views or similar places
we can use ugettext with no problems, we should make code
style consistent.

This also fix the issues that the django proxy objects appear on the
launching instance page instead of translated strings. Now the
translated quota strings are handled correctly.

Fixes: bug #1178722

Change-Id: I76f0d31e6546d70e5ece7e86a06f7eefd04861d2
2013-05-18 15:13:54 +08:00
Kieran Spear f2fb22cf59 Support adding/removing instance security groups
Changes the edit instance dialog into a workflow, and adds a step
"Edit security groups" that reuses the admin:project add/remove user
dialog.

Changes:
- Allow "roles" dropdown to be hidden.
- Moved project members template into horizon/common.
- Moved workflows.py to workflows/create_instance.py so I could add
  a workflows/update_instance.py.
- Moved hardcoded UI text from js to template/workflow definition.
- Made filter-fields use placeholder attributes.
- Fixed the #add_remove being added to the URL bar when adding/removing
  members.
- Fixes the project members modal getting stuck displaying the lists
  from the first invocation of the modal and never updating
  (try clicking "modify users" for different projects).

Implements blueprint add-security-group-to-instance

Change-Id: If2939e05c92ac50bfc3c6f0112bdfc1785d9fb4e
2013-02-18 22:24:51 +11:00