----- Original Message -----
From: "Itamar Heim" <iheim(a)redhat.com>
To: "Oved Ourfalli" <ovedo(a)redhat.com>
Cc: users(a)ovirt.org, "Daniel Erez" <derez(a)redhat.com>
Sent: Wednesday, January 23, 2013 2:33:53 PM
Subject: Re: [Users] UI Plugin issue when switching main tabs
On 23/01/2013 04:32, Itamar Heim wrote:
> On 22/01/2013 14:06, Oved Ourfalli wrote:
>>
>> ----- Original Message -----
>>> From: "René Koch" <r.koch(a)ovido.at>
>>> To: "Oved Ourfalli" <ovedo(a)redhat.com>
>>> Cc: users(a)ovirt.org
>>> Sent: Tuesday, January 22, 2013 1:51:58 PM
>>> Subject: Re: [Users] UI Plugin issue when switching main tabs
>>>
>>>
>>> Thanks a lot for your input - it was really helpfu!
>>>
>>> I added a check for argument.length and now it's working as
>>> expected.
>>> The working code is:
>>>
>>> VirtualMachineSelectionChange: function() {
>>> if (arguments.length == 1) {
>>> var vmName = arguments[0].name;
>>> alert(vmName);
>>> // Reload VM Sub Tab
>>> api.setTabContentUrl('vms-monitoring', conf.url +
>>> '?subtab=vms&name=' + encodeURIComponent(vmName));
>>> }
>>> }
>>>
>>>
>>> Btw, do you know if I can get the name of a host instead the
>>> hostname/ip?
>>> arguments[0].name; gives me the IP address (value of webadmin
>>> column
>>> "hostname/ip") but not the name (column "name") - (I
always use
>>> ips
>>> instead of dns names for hypervisors)...
>>>
>> I don't think you can currently do that.
>> The plan is to expose all the attributes of the entity that are
>> exposed via REST, also in the plugin api, but currently that's not
>> the
>> case.
>> Not sure why it doesn't return the name itself (don't know if it
>> is a
>> bug, or it is "as designed"), but anyway, other properties will be
>> exposed in the future.
>
> but it sounds like a bug in the mapping of id/name for the current
> uiplugin infra (maybe vojtech mapped the wrong field).
> assuming restapi returns host name for the name field, uiplugin
> should
> return it as well.
hmmm, i wonder if the shellinabox uiplugin relies on this bug. once
it
is fixed, it will need to fetch the ip via rest or assume the name is
resolvable for ssh.
Yes, the shellinabox uiplugin indeed relies on it.
I thought it was intentional rather than a bug...
Can we simply add a new property to the JSON object?
I.e. obj.setProperty("hostname", ((VDS) businessEntity).gethost_name());
//$NON-NLS-1$
(in addition to: obj.setProperty("name", ((VDS) businessEntity).getvds_name());
//$NON-NLS-1$)