From fa3528933c196aa37c9e23f37b3c588750be2514 Mon Sep 17 00:00:00 2001 From: "wei.ying" Date: Thu, 6 Apr 2017 20:09:30 +0800 Subject: [PATCH] Delete instance,volume,etc confirmation is missing name or ID If click the name link and go into the details page for the instance, volume, etc. And attempt to delete. It will pop up a message, but omit the name/id. Need to add the property of 'data-display' in detail page. Change-Id: I9c1966dc7942a27903237e2786edbcd2fbd936ea Closes-Bug: #1680329 --- .../floating_ips/templates/floating_ips/detail.html | 2 +- .../dashboards/admin/networks/agents/tables.py | 3 +++ .../dashboards/admin/networks/subnets/tables.py | 2 +- .../dashboards/admin/networks/tables.py | 3 +++ .../templates/projects/_detail_overview.html | 2 +- .../users/templates/users/_detail_overview.html | 2 +- .../backups/templates/backups/_detail_overview.html | 2 +- .../templates/cg_snapshots/_detail_overview.html | 2 +- .../dashboards/project/firewalls/tables.py | 9 +++++++++ .../templates/firewalls/_firewall_details.html | 2 +- .../templates/firewalls/_policy_details.html | 2 +- .../firewalls/templates/firewalls/_rule_details.html | 2 +- .../templates/images/images/_detail_overview.html | 2 +- .../templates/instances/_detail_overview.html | 2 +- .../dashboards/project/networks/ports/tables.py | 2 +- .../dashboards/project/networks/subnets/tables.py | 3 +++ .../dashboards/project/networks/tables.py | 3 +++ .../templates/networks/_detail_overview.html | 2 +- .../templates/networks/ports/_detail_overview.html | 2 +- .../templates/networks/subnets/_detail_overview.html | 2 +- .../dashboards/project/routers/ports/tables.py | 2 +- .../routers/templates/routers/_detail_overview.html | 2 +- .../templates/snapshots/_detail_overview.html | 2 +- .../stacks/templates/stacks/_detail_overview.html | 2 +- .../volumes/templates/volumes/_detail_overview.html | 2 +- openstack_dashboard/dashboards/project/vpn/tables.py | 12 ++++++++++++ .../vpn/templates/vpn/_ikepolicy_details.html | 2 +- .../vpn/templates/vpn/_ipsecpolicy_details.html | 2 +- .../templates/vpn/_ipsecsiteconnection_details.html | 2 +- .../vpn/templates/vpn/_vpnservice_details.html | 2 +- 30 files changed, 57 insertions(+), 24 deletions(-) diff --git a/openstack_dashboard/dashboards/admin/floating_ips/templates/floating_ips/detail.html b/openstack_dashboard/dashboards/admin/floating_ips/templates/floating_ips/detail.html index 8ea9a7efed..7418390e5e 100644 --- a/openstack_dashboard/dashboards/admin/floating_ips/templates/floating_ips/detail.html +++ b/openstack_dashboard/dashboards/admin/floating_ips/templates/floating_ips/detail.html @@ -17,7 +17,7 @@
{{ floating_ip.tenant_id|default:"-" }}
{% trans "Floating IP address" %}
-
{{ floating_ip.ip|default:_("None") }}
+
{{ floating_ip.ip|default:_("None") }}
{% trans "Status" %}
{{ floating_ip.status|default:_("None") }}
diff --git a/openstack_dashboard/dashboards/admin/networks/agents/tables.py b/openstack_dashboard/dashboards/admin/networks/agents/tables.py index 3edd56313e..1ec2c4b1d6 100644 --- a/openstack_dashboard/dashboards/admin/networks/agents/tables.py +++ b/openstack_dashboard/dashboards/admin/networks/agents/tables.py @@ -100,6 +100,9 @@ class DHCPAgentsTable(tables.DataTable): filters=(utils_filters.parse_isotime, filters.timesince)) + def get_object_display(self, agent): + return agent.host + class Meta(object): name = "agents" verbose_name = _("DHCP Agents") diff --git a/openstack_dashboard/dashboards/admin/networks/subnets/tables.py b/openstack_dashboard/dashboards/admin/networks/subnets/tables.py index 66572ede49..656fc0355b 100644 --- a/openstack_dashboard/dashboards/admin/networks/subnets/tables.py +++ b/openstack_dashboard/dashboards/admin/networks/subnets/tables.py @@ -113,7 +113,7 @@ class SubnetsTable(tables.DataTable): failure_url = reverse_lazy('horizon:admin:networks:index') def get_object_display(self, subnet): - return subnet.id + return subnet.name_or_id @memoized.memoized_method def _get_network(self): diff --git a/openstack_dashboard/dashboards/admin/networks/tables.py b/openstack_dashboard/dashboards/admin/networks/tables.py index 5ff9517236..966028875b 100644 --- a/openstack_dashboard/dashboards/admin/networks/tables.py +++ b/openstack_dashboard/dashboards/admin/networks/tables.py @@ -110,6 +110,9 @@ class NetworksTable(tables.DataTable): verbose_name=_("Admin State"), display_choices=DISPLAY_CHOICES) + def get_object_display(self, network): + return network.name_or_id + class Meta(object): name = "networks" verbose_name = _("Networks") diff --git a/openstack_dashboard/dashboards/identity/projects/templates/projects/_detail_overview.html b/openstack_dashboard/dashboards/identity/projects/templates/projects/_detail_overview.html index 41e3a55685..5ba6d92c8c 100644 --- a/openstack_dashboard/dashboards/identity/projects/templates/projects/_detail_overview.html +++ b/openstack_dashboard/dashboards/identity/projects/templates/projects/_detail_overview.html @@ -3,7 +3,7 @@
{% trans "Project Name" %}
-
{{ project.name }}
+
{{ project.name }}
{% trans "Project ID" %}
{{ project.id }}
{% trans "Enabled" %}
diff --git a/openstack_dashboard/dashboards/identity/users/templates/users/_detail_overview.html b/openstack_dashboard/dashboards/identity/users/templates/users/_detail_overview.html index c0511e8058..4be08439f5 100644 --- a/openstack_dashboard/dashboards/identity/users/templates/users/_detail_overview.html +++ b/openstack_dashboard/dashboards/identity/users/templates/users/_detail_overview.html @@ -11,7 +11,7 @@
{{ domain_name }}
{% endif %}
{% trans "User Name" %}
-
{{ user.name }}
+
{{ user.name }}
{% if description %}
{% trans "Description" %}
{{ description }}
diff --git a/openstack_dashboard/dashboards/project/backups/templates/backups/_detail_overview.html b/openstack_dashboard/dashboards/project/backups/templates/backups/_detail_overview.html index b95062d7fa..11a3544f21 100644 --- a/openstack_dashboard/dashboards/project/backups/templates/backups/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/backups/templates/backups/_detail_overview.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ backup.name }}
+
{{ backup.name }}
{% trans "ID" %}
{{ backup.id }}
{% if backup.description %} diff --git a/openstack_dashboard/dashboards/project/cg_snapshots/templates/cg_snapshots/_detail_overview.html b/openstack_dashboard/dashboards/project/cg_snapshots/templates/cg_snapshots/_detail_overview.html index 3a00bfb854..a11176560d 100644 --- a/openstack_dashboard/dashboards/project/cg_snapshots/templates/cg_snapshots/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/cg_snapshots/templates/cg_snapshots/_detail_overview.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ cg_snapshot.name }}
+
{{ cg_snapshot.name }}
{% trans "ID" %}
{{ cg_snapshot.id }}
{% if cg_snapshot.description %} diff --git a/openstack_dashboard/dashboards/project/firewalls/tables.py b/openstack_dashboard/dashboards/project/firewalls/tables.py index a917e1d19f..dee2d5e7aa 100644 --- a/openstack_dashboard/dashboards/project/firewalls/tables.py +++ b/openstack_dashboard/dashboards/project/firewalls/tables.py @@ -318,6 +318,9 @@ class RulesTable(tables.DataTable): link=get_policy_link, verbose_name=_("In Policy")) + def get_object_display(self, rule): + return rule.name_or_id + class Meta(object): name = "rulestable" verbose_name = _("Rules") @@ -341,6 +344,9 @@ class PoliciesTable(tables.DataTable): verbose_name=_("Audited"), filters=(filters.yesno, filters.capfirst)) + def get_object_display(self, policy): + return policy.name_or_id + class Meta(object): name = "policiestable" verbose_name = _("Policies") @@ -391,6 +397,9 @@ class FirewallsTable(tables.DataTable): verbose_name=_("Admin State"), display_choices=ADMIN_STATE_DISPLAY_CHOICES) + def get_object_display(self, firewall): + return firewall.name_or_id + class Meta(object): name = "firewallstable" verbose_name = _("Firewalls") diff --git a/openstack_dashboard/dashboards/project/firewalls/templates/firewalls/_firewall_details.html b/openstack_dashboard/dashboards/project/firewalls/templates/firewalls/_firewall_details.html index 5efb7a24c5..ec67a18811 100644 --- a/openstack_dashboard/dashboards/project/firewalls/templates/firewalls/_firewall_details.html +++ b/openstack_dashboard/dashboards/project/firewalls/templates/firewalls/_firewall_details.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ firewall.name|default:_("-") }}
+
{{ firewall.name|default:_("-") }}
{% trans "Description" %}
{{ firewall.description|default:_("-") }}
diff --git a/openstack_dashboard/dashboards/project/firewalls/templates/firewalls/_policy_details.html b/openstack_dashboard/dashboards/project/firewalls/templates/firewalls/_policy_details.html index 36b99e1dd4..1160a81271 100644 --- a/openstack_dashboard/dashboards/project/firewalls/templates/firewalls/_policy_details.html +++ b/openstack_dashboard/dashboards/project/firewalls/templates/firewalls/_policy_details.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ policy.name|default:_("-") }}
+
{{ policy.name|default:_("-") }}
{% trans "Description" %}
{{ policy.description|default:_("-") }}
diff --git a/openstack_dashboard/dashboards/project/firewalls/templates/firewalls/_rule_details.html b/openstack_dashboard/dashboards/project/firewalls/templates/firewalls/_rule_details.html index 85d4bc730b..06732bf2cb 100644 --- a/openstack_dashboard/dashboards/project/firewalls/templates/firewalls/_rule_details.html +++ b/openstack_dashboard/dashboards/project/firewalls/templates/firewalls/_rule_details.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ rule.name|default:_("-") }}
+
{{ rule.name|default:_("-") }}
{% trans "Description" %}
{{ rule.description|default:_("-") }}
diff --git a/openstack_dashboard/dashboards/project/images/templates/images/images/_detail_overview.html b/openstack_dashboard/dashboards/project/images/templates/images/images/_detail_overview.html index 528ed933e5..1cb64bb6c9 100644 --- a/openstack_dashboard/dashboards/project/images/templates/images/images/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/images/templates/images/images/_detail_overview.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ image.name|default:_("None") }}
+
{{ image.name|default:_("None") }}
{% if image.properties.description %}
{% trans "Description" %}
{{ image.properties.description }}
diff --git a/openstack_dashboard/dashboards/project/instances/templates/instances/_detail_overview.html b/openstack_dashboard/dashboards/project/instances/templates/instances/_detail_overview.html index 933080b06f..abee6f7527 100644 --- a/openstack_dashboard/dashboards/project/instances/templates/instances/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/instances/templates/instances/_detail_overview.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ instance.name }}
+
{{ instance.name }}
{% trans "ID" %}
{{ instance.id }}
{% trans "Status" %}
diff --git a/openstack_dashboard/dashboards/project/networks/ports/tables.py b/openstack_dashboard/dashboards/project/networks/ports/tables.py index 32952deeb6..51724f3b81 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/tables.py +++ b/openstack_dashboard/dashboards/project/networks/ports/tables.py @@ -132,7 +132,7 @@ class PortsTable(tables.DataTable): verbose_name=_("MAC Learning State")) def get_object_display(self, port): - return port.id + return port.name_or_id class Meta(object): name = "ports" diff --git a/openstack_dashboard/dashboards/project/networks/subnets/tables.py b/openstack_dashboard/dashboards/project/networks/subnets/tables.py index e4676b09f9..911e879417 100644 --- a/openstack_dashboard/dashboards/project/networks/subnets/tables.py +++ b/openstack_dashboard/dashboards/project/networks/subnets/tables.py @@ -152,6 +152,9 @@ class SubnetsTable(tables.DataTable): exceptions.handle(self.request, msg,) return network + def get_object_display(self, subnet): + return subnet.name_or_id + class Meta(object): name = "subnets" verbose_name = _("Subnets") diff --git a/openstack_dashboard/dashboards/project/networks/tables.py b/openstack_dashboard/dashboards/project/networks/tables.py index 21a1e1313f..332a3abca6 100644 --- a/openstack_dashboard/dashboards/project/networks/tables.py +++ b/openstack_dashboard/dashboards/project/networks/tables.py @@ -189,6 +189,9 @@ class NetworksTable(tables.DataTable): verbose_name=_("Admin State"), display_choices=DISPLAY_CHOICES) + def get_object_display(self, network): + return network.name_or_id + class Meta(object): name = "networks" verbose_name = _("Networks") diff --git a/openstack_dashboard/dashboards/project/networks/templates/networks/_detail_overview.html b/openstack_dashboard/dashboards/project/networks/templates/networks/_detail_overview.html index 1bdceddbe1..529358eeaf 100644 --- a/openstack_dashboard/dashboards/project/networks/templates/networks/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/networks/templates/networks/_detail_overview.html @@ -5,7 +5,7 @@
{% trans "Name" %}
{{ network.name|default:_("None") }}
{% trans "ID" %}
-
{{ network.id|default:_("None") }}
+
{{ network.id|default:_("None") }}
{% trans "Project ID" %}
{{ network.tenant_id|default:_("-") }}
{% trans "Status" %}
diff --git a/openstack_dashboard/dashboards/project/networks/templates/networks/ports/_detail_overview.html b/openstack_dashboard/dashboards/project/networks/templates/networks/ports/_detail_overview.html index d9187c2a6a..87b716d4b9 100644 --- a/openstack_dashboard/dashboards/project/networks/templates/networks/ports/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/networks/templates/networks/ports/_detail_overview.html @@ -5,7 +5,7 @@
{% trans "Name" %}
{{ port.name|default:_("None") }}
{% trans "ID" %}
-
{{ port.id|default:_("None") }}
+
{{ port.id|default:_("None") }}
{% trans "Network Name" %}
{{ port.network_name|default:_("None") }}
{% trans "Network ID" %}
diff --git a/openstack_dashboard/dashboards/project/networks/templates/networks/subnets/_detail_overview.html b/openstack_dashboard/dashboards/project/networks/templates/networks/subnets/_detail_overview.html index feebd97e1e..d4a6231521 100644 --- a/openstack_dashboard/dashboards/project/networks/templates/networks/subnets/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/networks/templates/networks/subnets/_detail_overview.html @@ -5,7 +5,7 @@
{% trans "Name" %}
{{ subnet.name|default:_("None") }}
{% trans "ID" %}
-
{{subnet.id|default:_("None") }}
+
{{subnet.id|default:_("None") }}
{% trans "Network Name" %}
{{ subnet.network_name|default:_("None") }}
{% trans "Network ID" %}
diff --git a/openstack_dashboard/dashboards/project/routers/ports/tables.py b/openstack_dashboard/dashboards/project/routers/ports/tables.py index 7f1419b4b8..d8650063b7 100644 --- a/openstack_dashboard/dashboards/project/routers/ports/tables.py +++ b/openstack_dashboard/dashboards/project/routers/ports/tables.py @@ -119,7 +119,7 @@ class PortsTable(tables.DataTable): display_choices=DISPLAY_CHOICES) def get_object_display(self, port): - return port.id + return port.name_or_id class Meta(object): name = "interfaces" diff --git a/openstack_dashboard/dashboards/project/routers/templates/routers/_detail_overview.html b/openstack_dashboard/dashboards/project/routers/templates/routers/_detail_overview.html index 7484d57d81..20161e392f 100644 --- a/openstack_dashboard/dashboards/project/routers/templates/routers/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/routers/templates/routers/_detail_overview.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ router.name|default:_("None") }}
+
{{ router.name|default:_("None") }}
{% trans "ID" %}
{{ router.id }}
{% trans "Description" %}
diff --git a/openstack_dashboard/dashboards/project/snapshots/templates/snapshots/_detail_overview.html b/openstack_dashboard/dashboards/project/snapshots/templates/snapshots/_detail_overview.html index b14f9775cf..ae79099a7e 100644 --- a/openstack_dashboard/dashboards/project/snapshots/templates/snapshots/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/snapshots/templates/snapshots/_detail_overview.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ snapshot.name }}
+
{{ snapshot.name }}
{% trans "ID" %}
{{ snapshot.id }}
{% if snapshot.description %} diff --git a/openstack_dashboard/dashboards/project/stacks/templates/stacks/_detail_overview.html b/openstack_dashboard/dashboards/project/stacks/templates/stacks/_detail_overview.html index 0a44f6b2ac..56534bba3e 100644 --- a/openstack_dashboard/dashboards/project/stacks/templates/stacks/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/stacks/templates/stacks/_detail_overview.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ stack.stack_name }}
+
{{ stack.stack_name }}
{% trans "ID" %}
{{ stack.id }}
{% trans "Description" %}
diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/_detail_overview.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/_detail_overview.html index 2358b229ea..6131462588 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/_detail_overview.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ volume.name }}
+
{{ volume.name }}
{% trans "ID" %}
{{ volume.id }}
{% if volume.description %} diff --git a/openstack_dashboard/dashboards/project/vpn/tables.py b/openstack_dashboard/dashboards/project/vpn/tables.py index 5cc5d6fe12..af7703461e 100644 --- a/openstack_dashboard/dashboards/project/vpn/tables.py +++ b/openstack_dashboard/dashboards/project/vpn/tables.py @@ -332,6 +332,9 @@ class IPSecSiteConnectionsTable(tables.DataTable): status_choices=STATUS_CHOICES, display_choices=STATUS_DISPLAY_CHOICES) + def get_object_display(self, ipsecsiteconnection): + return ipsecsiteconnection.name_or_id + class Meta(object): name = "ipsecsiteconnectionstable" verbose_name = _("IPSec Site Connections") @@ -388,6 +391,9 @@ class VPNServicesTable(tables.DataTable): status_choices=STATUS_CHOICES, display_choices=STATUS_DISPLAY_CHOICES) + def get_object_display(self, vpnservice): + return vpnservice.name_or_id + class Meta(object): name = "vpnservicestable" verbose_name = _("VPN Services") @@ -422,6 +428,9 @@ class IKEPoliciesTable(tables.DataTable): verbose_name=_('Encryption algorithm')) pfs = tables.Column("pfs", verbose_name=_('PFS')) + def get_object_display(self, ikepolicy): + return ikepolicy.name_or_id + class Meta(object): name = "ikepoliciestable" verbose_name = _("IKE Policies") @@ -443,6 +452,9 @@ class IPSecPoliciesTable(tables.DataTable): verbose_name=_('Encryption algorithm')) pfs = tables.Column("pfs", verbose_name=_('PFS')) + def get_object_display(self, ipsecpolicy): + return ipsecpolicy.name_or_id + class Meta(object): name = "ipsecpoliciestable" verbose_name = _("IPSec Policies") diff --git a/openstack_dashboard/dashboards/project/vpn/templates/vpn/_ikepolicy_details.html b/openstack_dashboard/dashboards/project/vpn/templates/vpn/_ikepolicy_details.html index 0a303a7213..6e925aceeb 100644 --- a/openstack_dashboard/dashboards/project/vpn/templates/vpn/_ikepolicy_details.html +++ b/openstack_dashboard/dashboards/project/vpn/templates/vpn/_ikepolicy_details.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ ikepolicy.name|default:_("None") }}
+
{{ ikepolicy.name|default:_("None") }}
{% trans "Description" %}
{{ ikepolicy.description|default:_("None") }}
diff --git a/openstack_dashboard/dashboards/project/vpn/templates/vpn/_ipsecpolicy_details.html b/openstack_dashboard/dashboards/project/vpn/templates/vpn/_ipsecpolicy_details.html index 82d89ca957..66cb33389b 100644 --- a/openstack_dashboard/dashboards/project/vpn/templates/vpn/_ipsecpolicy_details.html +++ b/openstack_dashboard/dashboards/project/vpn/templates/vpn/_ipsecpolicy_details.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ ipsecpolicy.name|default:_("None") }}
+
{{ ipsecpolicy.name|default:_("None") }}
{% trans "Description" %}
{{ ipsecpolicy.description|default:_("None") }}
diff --git a/openstack_dashboard/dashboards/project/vpn/templates/vpn/_ipsecsiteconnection_details.html b/openstack_dashboard/dashboards/project/vpn/templates/vpn/_ipsecsiteconnection_details.html index 6da4746990..307a30be2c 100644 --- a/openstack_dashboard/dashboards/project/vpn/templates/vpn/_ipsecsiteconnection_details.html +++ b/openstack_dashboard/dashboards/project/vpn/templates/vpn/_ipsecsiteconnection_details.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ ipsecsiteconnection.name|default:_("None") }}
+
{{ ipsecsiteconnection.name|default:_("None") }}
{% trans "Description" %}
{{ ipsecsiteconnection.description|default:_("None") }}
diff --git a/openstack_dashboard/dashboards/project/vpn/templates/vpn/_vpnservice_details.html b/openstack_dashboard/dashboards/project/vpn/templates/vpn/_vpnservice_details.html index 20866d2ba2..4db1bb6762 100644 --- a/openstack_dashboard/dashboards/project/vpn/templates/vpn/_vpnservice_details.html +++ b/openstack_dashboard/dashboards/project/vpn/templates/vpn/_vpnservice_details.html @@ -3,7 +3,7 @@
{% trans "Name" %}
-
{{ vpnservice.name|default:_("None") }}
+
{{ vpnservice.name|default:_("None") }}
{% trans "Description" %}
{{ vpnservice.description|default:_("None") }}