Revision 9ac432ec ui/templates/machines_icon.html

b/ui/templates/machines_icon.html
179 179
// handle connect machine image states
180 180
$("div.connect-arrow, div.running .machine .logo").live('mouseover',
181 181
    function() {
182
        if ($(this).parent().parent().find('.status').text().replace(TRANSITION_STATE_APPEND, "") != STATUSES['ACTIVE']) { return };
182
        vm = iconview_closest_vm(this);
183
        if ($(this).parent().parent().find('.status').text().replace(TRANSITION_STATE_APPEND, "") != STATUSES['ACTIVE'] || !vm_has_public_ip(vm)) { return };
183 184
        set_machine_os_image($(this).parent().parent(), "icon", "hover", undefined, 1);
184 185
        var parent = $(this).parent().parent();
185 186
        parent.find(".connect-arrow").show().addClass('border-hover');
......
187 188

  
188 189
$("div.connect-arrow, div.running .machine .logo").live('mouseleave',
189 190
    function() {
190
        if ($(this).parent().parent().find('.status').text().replace(TRANSITION_STATE_APPEND, "") != STATUSES['ACTIVE']) { return };
191
        vm = iconview_closest_vm(this);
192
        if ($(this).parent().parent().find('.status').text().replace(TRANSITION_STATE_APPEND, "") != STATUSES['ACTIVE'] || !vm_has_public_ip(vm)) { return };
191 193
        set_machine_os_image($(this).parent().parent(), "icon", "hover", undefined, 1, "hover");
192 194
        // mouseup outside the element is not fired
193 195
        set_machine_os_image($(this).parent().parent(), "icon", "hover", undefined, 1, "click");
......
197 199

  
198 200
$("div.connect-arrow, div.running .machine .logo").live('mousedown',
199 201
function() {
200
        if ($(this).parent().parent().find(".connect-arrow:visible").length == 0) { return };
202
        vm = iconview_closest_vm(this);
203
        if ($(this).parent().parent().find(".connect-arrow:visible").length == 0 || !vm_has_public_ip(vm)) { return };
201 204
        set_machine_os_image($(this).parent().parent(), "icon", "click", undefined, 1);
202 205
    });
203 206

  
204 207
$("div.connect-arrow, div.running .machine .logo").live('mouseup',
205 208
    function() {
206
        if ($(this).parent().parent().find(".connect-arrow:visible").length == 0) { return };
209
        vm = iconview_closest_vm(this);
210
        if ($(this).parent().parent().find(".connect-arrow:visible").length == 0 || !vm_has_public_ip(vm)) { return };
207 211
        set_machine_os_image($(this).parent().parent(), "icon", "click", undefined, 1, "click");
208 212
    });
209 213

  
210 214
// actions on machine mouseover
211 215
$("#machinesview-icon.standard .machine").live('mouseover', function() {
212 216
    // show connect button only if the machine is active
213
    if ($(this).find('.status').text().replace(TRANSITION_STATE_APPEND, "") == STATUSES['ACTIVE']) {
217
    vm = iconview_closest_vm(this);
218
    if ($(this).find('.status').text().replace(TRANSITION_STATE_APPEND, "") == STATUSES['ACTIVE'] && vm_has_public_ip(vm)) {
214 219
        $(this).find("div.connect-arrow").show();
215 220
        $(this).find("div.connect-border").show();
216 221
    }
......
235 240

  
236 241
// open console on machine logo click
237 242
$("#machinesview-icon.standard .running div.logo").live('click', function(){
238
    if ($(this).parent().parent().find(".connect-arrow:visible").length == 0) { return };
243
    vm = iconview_closest_vm(this);
244
    if ($(this).parent().parent().find(".connect-arrow:visible").length == 0 || !vm_has_public_ip(vm)) { return };
239 245
    var serverID = $(this).parent().parent().attr("id");
240 246
    machine_connect([machine_connect, serverID]);
241 247
    return false;

Also available in: Unified diff