Revision 29772683 ui/static/synnefo.js
b/ui/static/synnefo.js | ||
---|---|---|
1156 | 1156 |
return false; |
1157 | 1157 |
} |
1158 | 1158 |
|
1159 |
function vm_has_address(vmId) { |
|
1160 |
var vm = get_machine(vmId); |
|
1161 |
|
|
1162 |
if (!vm) return false; |
|
1163 |
|
|
1164 |
try { |
|
1165 |
var ip = vm.addresses.values[0].values[0].addr; |
|
1166 |
} catch (err) { |
|
1167 |
console.log(err); |
|
1168 |
return false; |
|
1169 |
} |
|
1170 |
return ip; |
|
1171 |
} |
|
1172 |
|
|
1159 | 1173 |
// connect to machine action |
1160 | 1174 |
function machine_connect(serverIDs){ |
1161 | 1175 |
if (!serverIDs.length){ |
... | ... | |
1163 | 1177 |
return false; |
1164 | 1178 |
} |
1165 | 1179 |
var serverID = serverIDs.pop(); |
1166 |
|
|
1180 |
|
|
1167 | 1181 |
var machine = get_machine(serverID); |
1168 | 1182 |
var serverName = machine.name; |
1169 | 1183 |
try { |
... | ... | |
1179 | 1193 |
//console.log(serverIP); |
1180 | 1194 |
//console.log(machine.addresses); |
1181 | 1195 |
//console.log(machine.addresses.values[0].values[0].addr); |
1182 |
|
|
1196 |
|
|
1197 |
//show_connect_dialog(machine, ip); |
|
1183 | 1198 |
window.open('machines/connect' + params_url); |
1199 |
|
|
1200 |
|
|
1184 | 1201 |
|
1185 | 1202 |
// Restore os icon in list view |
1186 | 1203 |
osIcon = $('#'+serverID).parent().parent().find('.list-logo'); |
... | ... | |
2046 | 2063 |
el.addClass("single-image-" + cls); |
2047 | 2064 |
} |
2048 | 2065 |
|
2066 |
|
|
2067 |
// generic info box |
|
2068 |
|
|
2069 |
function msg_box(config) { |
|
2070 |
var config = $.extend({'title':'Info message', 'content': 'this is an info message', 'ajax': false, 'extra':false}, config); |
|
2071 |
// prepare the error message |
|
2072 |
// bring up success notification |
|
2073 |
|
|
2074 |
var box = $("#notification-box"); |
|
2075 |
box.addClass('success'); |
|
2076 |
box.removeClass('error'); |
|
2077 |
|
|
2078 |
var sel = function(s){console.log(box); return $(s, box)}; |
|
2079 |
|
|
2080 |
sel("h3 span.header-box").text(config.title); |
|
2081 |
sel("div.machine-now-building").html(config.content); |
|
2082 |
sel(".popup-header").removeClass("popup-header-error"); |
|
2083 |
box.removeClass("popup-border-error"); |
|
2084 |
sel(".popup-details").removeClass("popup-details-error"); |
|
2085 |
sel(".popup-separator").removeClass("popup-separator-error"); |
|
2086 |
|
|
2087 |
sel(".password-container").hide(); |
|
2088 |
if (config.extra) { |
|
2089 |
sel(".password-container .password").html(config.extra); |
|
2090 |
sel(".password-container").show(); |
|
2091 |
} |
|
2092 |
|
|
2093 |
var triggers = $("a#msgbox").overlay({ |
|
2094 |
// some mask tweaks suitable for modal dialogs |
|
2095 |
mask: '#666', |
|
2096 |
top: 'center', |
|
2097 |
closeOnClick: false, |
|
2098 |
oneInstance: false, |
|
2099 |
load: false, |
|
2100 |
onClose: function () { |
|
2101 |
// With partial refresh working properly, |
|
2102 |
// it is no longer necessary to refresh the whole page |
|
2103 |
// choose_view(); |
|
2104 |
} |
|
2105 |
}); |
|
2106 |
$("a#msgbox").data('overlay').load(); |
|
2107 |
|
|
2108 |
var parse_data = config.parse_data || false; |
|
2109 |
if (config.ajax) { |
|
2110 |
$.ajax({ |
|
2111 |
url:config.ajax, |
|
2112 |
success: function(data){ |
|
2113 |
if (parse_data) { |
|
2114 |
data = parse_data(data); |
|
2115 |
} |
|
2116 |
|
|
2117 |
if (data.title) |
|
2118 |
sel("h3 span.header-box").text(data.title); |
|
2119 |
|
|
2120 |
if (data.content) |
|
2121 |
sel("div.machine-now-building").html(data.content); |
|
2122 |
|
|
2123 |
if (data.extra) { |
|
2124 |
sel(".password-container .password").html(data.extra); |
|
2125 |
sel(".password-container").show(); |
|
2126 |
} |
|
2127 |
} |
|
2128 |
}); |
|
2129 |
} |
|
2130 |
return false; |
|
2131 |
} |
Also available in: Unified diff