Merge "Add "Edit Port Security Groups" action"

This commit is contained in:
Zuul 2018-05-02 14:52:13 +00:00 committed by Gerrit Code Review
commit 3cfc104bd3
5 changed files with 33 additions and 4 deletions
horizon/templates/horizon/common
openstack_dashboard/dashboards/project/instances
releasenotes/notes

@ -4,7 +4,7 @@
<div class="membership {{ step.slug }}_membership dropdown_fix" data-show-roles="{{ step.show_roles }}">
<div class="header">
<div class="help_text">{{ step.help_text }}</div>
<div class="help_text">{{ step.get_help_text }}</div>
<div class="row">
<div class="col-xs-6">

@ -478,6 +478,17 @@ class EditInstanceSecurityGroups(EditInstance):
request.user.tenant_id == instance.tenant_id)
class EditPortSecurityGroups(tables.LinkAction):
name = "edit_port_secgroups"
verbose_name = _("Edit Port Security Groups")
url = "horizon:project:instances:detail"
icon = "pencil"
def get_link_url(self, instance):
base_url = urls.reverse(self.url, args=[instance.id])
return '%s?tab=%s__%s' % (base_url, 'instance_details', 'interfaces')
class CreateSnapshot(policy.PolicyTargetMixin, tables.LinkAction):
name = "snapshot"
verbose_name = _("Create Snapshot")
@ -1253,7 +1264,9 @@ class InstancesTable(tables.DataTable):
AttachInterface, DetachInterface, EditInstance,
AttachVolume, DetachVolume,
UpdateMetadata, DecryptInstancePassword,
EditInstanceSecurityGroups, ConsoleLink, LogLink,
EditInstanceSecurityGroups,
EditPortSecurityGroups,
ConsoleLink, LogLink,
TogglePause, ToggleSuspend, ToggleShelve,
ResizeLink, LockInstance, UnlockInstance,
SoftRebootInstance, RebootInstance,

@ -0,0 +1,15 @@
{% load i18n %}
<p>
{% blocktrans trimmed %}
Add and remove security groups to this instance from the list of available
security groups.
{% endblocktrans %}
</p>
<p>
{% blocktrans trimmed %}
<b>Warning:</b> If you change security groups here, the change will be applied to
all interfaces of the instance. If you have multiple interfaces on this
instance and apply different security groups per port,
use "Edit Port Security Groups" action instead.
{% endblocktrans %}
</p>

@ -54,13 +54,12 @@ class UpdateInstanceSecurityGroupsAction(sg_base.BaseSecurityGroupsAction):
class Meta(object):
name = _("Security Groups")
slug = INSTANCE_SEC_GROUP_SLUG
help_text_template = 'project/instances/_edit_security_group_help.html'
class UpdateInstanceSecurityGroups(sg_base.BaseSecurityGroups):
action_class = UpdateInstanceSecurityGroupsAction
members_list_title = _("Instance Security Groups")
help_text = _("Add and remove security groups to this instance "
"from the list of available security groups.")
depends_on = ("instance_id", "target_tenant_id")
def allowed(self, request):

@ -4,3 +4,5 @@ features:
"Interfaces" tab is added to the instance detail page. The new tab shows
a list of ports attached to an instance. Users now have an easy way to
access the list of ports of the instance and edit security groups per port.
In addition, "Edit Port Security Groups" menu is added as an action of
the instance table.