Revision e2ccad35 ui/templates/list.html
b/ui/templates/list.html | ||
---|---|---|
175 | 175 |
current = -1; |
176 | 176 |
// check server status to select the appropriate OS icon |
177 | 177 |
osTag = image_tags[server.imageRef] |
178 |
var osIcon = osTag + ".png", imgStr; |
|
178 |
var osIcon = osTag + ".png", imgStr, imgSrc;
|
|
179 | 179 |
|
180 | 180 |
// check if the server already exists in the datatable |
181 | 181 |
tableData.forEach(function(row,index){ |
... | ... | |
189 | 189 |
try { |
190 | 190 |
console.info(server.name + ' from ' |
191 | 191 |
+ tableData[current][5] + ' to ' + STATUS_MESSAGES[server.status]); |
192 |
} catch(err) {} |
|
192 |
} catch(err) {}
|
|
193 | 193 |
if (server.status == "DELETED") { |
194 | 194 |
vmTable.fnDeleteRow(current); |
195 |
} else { |
|
196 |
// update status |
|
197 |
tableData[current][0] = "<input class="+server.status+" id="+server.id+" type=checkbox>"; |
|
195 |
} else { // server exists and should not be deleted |
|
198 | 196 |
// check server status to select the appropriate OS icon |
199 | 197 |
if (['ERROR', 'STOPPED'].indexOf(server.status) >= 0) { |
200 | 198 |
osIcon = osTag + "-off.png"; |
201 | 199 |
} |
202 |
|
|
203 |
if (tableData[current][5].indexOf(STATUS_MESSAGES[server.status]) > -1 || |
|
204 |
$('#'+server.id).parent().parent().find('.list-logo').attr('src').indexOf('wave')>-1){ |
|
205 |
imgStr = "<img class=list-logo src=static/os_logos/" + osIcon + |
|
206 |
" title=" + osTag + " height=16 width=16 />"; |
|
207 |
} else { |
|
208 |
imgStr = "<img class=list-logo src=static/wave.gif height=16 width=16 />"; |
|
209 |
} |
|
210 |
tableData[current][1] = "<span class=imagetag>" + osTag + |
|
211 |
"</span>" + imgStr; |
|
212 |
tableData[current][5] = "<span class=status>" + STATUS_MESSAGES[server.status] + "</span>"; |
|
213 |
// TODO: update name & ip |
|
214 |
vmTable.fnUpdate(tableData[current],current); |
|
215 |
imgStr = "<img class=list-logo src=static/os_logos/" + osIcon + |
|
216 |
" title=" + osTag + " height=16 width=16 />"; |
|
217 |
tableData[current][1] = "<span class=imagetag>" + osTag + |
|
218 |
"</span>" + imgStr; |
|
219 |
//setTimeout($('#'+server.id).parent().parent().find('.list-logo').attr, 2000,'src',imgStr); |
|
220 |
//setTimeout("vmTable.fnUpdate('"+tableData[current]+"','"+current+"')",2000); |
|
200 |
// if the new state does not differ from the previous one |
|
201 |
if (tableData[current][5].indexOf(STATUS_MESSAGES[server.status]) > -1){ |
|
202 |
// do nothing |
|
203 |
} else { // state has changed |
|
204 |
//$('#'+server.id).parent().parent().find('.list-logo').attr('src').indexOf('wave')>-1){ |
|
205 |
|
|
206 |
imgSrc = "static/wave.gif"; |
|
207 |
tableData[current][0] = "<input class="+server.status+" id="+server.id+" type=checkbox>"; |
|
208 |
imgStr = "<img class=list-logo src=" + imgSrc + " title=" + osTag + " height=16 width=16 />"; |
|
209 |
tableData[current][1] = "<span class=imagetag>" + osTag + "</span>" + imgStr; |
|
210 |
tableData[current][2] = "<a class=name><span class=name>" + server.name + "</span></a>"; |
|
211 |
tableData[current][3] = "<a class=ip><span class=public>"+ server.addresses.public.ip.addr + "</span></a>"; |
|
212 |
//tableData[current][4] = "group"; //TODO |
|
213 |
tableData[current][5] = "<span class=status>" + STATUS_MESSAGES[server.status] + "</span>"; |
|
214 |
vmTable.fnUpdate(tableData[current],current); |
|
221 | 215 |
|
216 |
//try{console.info('vm ' + server.id + ' from ' + tableData[current][5] + ' to ' + STATUS_MESSAGES[server.status])} catch(err) {} |
|
217 |
setTimeout("$('#"+server.id+"').parent().parent().find('.list-logo').attr('src','static/os_logos/" + osIcon+"')", 2000); |
|
218 |
} |
|
222 | 219 |
} |
223 | 220 |
updateActions(); |
224 | 221 |
} else if (server.status != "DELETED") { // does not exist, we should create it |
... | ... | |
249 | 246 |
} |
250 | 247 |
|
251 | 248 |
// set confirm box position |
252 |
if (window.innerHeight - 235 < $('#machinesview').height())
|
|
249 |
if (window.innerHeight - 200 < $('#machinesview').height())
|
|
253 | 250 |
$('.confirm_multiple').addClass('fixed'); |
254 | 251 |
else |
255 | 252 |
$('.confirm_multiple').removeClass('fixed'); |
Also available in: Unified diff