← Back to team overview

openstack team mailing list archive

Re: [Horizon] Different URLs (hyperlinks) in a table view.

 

If you're trying to override a link in the actions column you can override get_link_url on any subclass of LinkAction as demonstrated here:

https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/project/containers/tables.py#L67

If you're trying to alter the link wrapped around the text in one of the columns, you can pass a callable to the link argument for that Column as here:

https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/project/containers/tables.py#L113

Hope that helps,


-          Gabriel

From: Srikanth Kumar Lingala [mailto:srikanthkumar.lingala@xxxxxxxxx]
Sent: Tuesday, November 06, 2012 5:49 AM
To: Gabriel Hurley
Cc: openstack@xxxxxxxxxxxxxxxxxxx; openstack-dev@xxxxxxxxxxxxxxxxxxx
Subject: [Horizon] Different URLs (hyperlinks) in a table view.

Hi Gabriel,
I want to go to different URL for each row in a table view.
For example, in the below table, based on some criteria, first row URL needs to go to 'networks/[NETWORKID]/detail' and second URL needs to go to 'networks/[NETWORKID]/other_detail'.

Networks
Create Network<http://10.232.91.33/horizon/nova/networks/create> Delete Networks

[ ]

Name

Subnets Associated

Shared

Status

Admin State

Actions

[ ]

dsd<http://10.232.91.33/horizon/nova/networks/c15a3917-d7fa-4059-9e5c-38a2124995ef/detail>

*         1.1.1.1/24<http://1.1.1.1/24>

No

ACTIVE

UP

Edit Network<http://10.232.91.33/horizon/nova/networks/c15a3917-d7fa-4059-9e5c-38a2124995ef/update>

[ ]

vdvxc<http://10.232.91.33/horizon/nova/networks/f0d4201d-ddb8-4365-bd83-ef2bf0d0431c/detail>

*         10.10.0.0/24<http://10.10.0.0/24>

No

ACTIVE

UP

Edit Network<http://10.232.91.33/horizon/nova/networks/f0d4201d-ddb8-4365-bd83-ef2bf0d0431c/update>

Displaying 2 items


I saw the script 'dashboard/networks/url.py', but it is directing to only one page 'networks/[NETWORKID]/detail' every time.
Can I give different URL's dynamically to each network in networks table view, based on some criteria (Eg. based on its name).
Please help me.
Thanks in advance.

--
----
Srikanth.


References