# HG changeset patch # User Nikola Nikov # Date 1278972904 -10800 # Node ID dff069dff4b75f55c5ba01532fcbaf3ae8d31f62 # Parent b9279d8aaa76d37c88e62f340cf4e486ddb24a25 Many new things + some screenshot :) diff -r b9279d8aaa76 -r dff069dff4b7 index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/index.html Tue Jul 13 01:15:04 2010 +0300 @@ -0,0 +1,11 @@ + + XenCloudPlatform 0.1.1 + + + +

Citrix Systems, Inc. XenCloudPlatform 0.1.1 +

XenCenter CD image +

XenCenter installer +

xcpweb + + diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/bar.png Binary file interface/img/bar.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/button.png Binary file interface/img/button.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/button_active.png Binary file interface/img/button_active.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/cloud_pool_button.png Binary file interface/img/cloud_pool_button.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/cloud_pool_button_active.png Binary file interface/img/cloud_pool_button_active.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/create_new_button.png Binary file interface/img/create_new_button.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/create_new_button_active.png Binary file interface/img/create_new_button_active.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/ico-arrow-right.png Binary file interface/img/ico-arrow-right.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/loading.gif Binary file interface/img/loading.gif has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/menu_operations.png Binary file interface/img/menu_operations.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/menu_pause.png Binary file interface/img/menu_pause.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/menu_reboot.png Binary file interface/img/menu_reboot.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/menu_settings.png Binary file interface/img/menu_settings.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/menu_shutdown.png Binary file interface/img/menu_shutdown.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/menu_stats.png Binary file interface/img/menu_stats.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/menu_terminal.png Binary file interface/img/menu_terminal.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/meter.gif Binary file interface/img/meter.gif has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/minus_big.png Binary file interface/img/minus_big.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/minus_small.png Binary file interface/img/minus_small.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/paused.png Binary file interface/img/paused.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/plus_big.png Binary file interface/img/plus_big.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/plus_small.png Binary file interface/img/plus_small.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/running.png Binary file interface/img/running.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/server.png Binary file interface/img/server.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/settings_button.png Binary file interface/img/settings_button.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/settings_button_active.png Binary file interface/img/settings_button_active.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/shutdown.png Binary file interface/img/shutdown.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/img/stopped.png Binary file interface/img/stopped.png has changed diff -r b9279d8aaa76 -r dff069dff4b7 interface/index.html --- a/interface/index.html Tue Jun 15 00:58:46 2010 +0300 +++ b/interface/index.html Tue Jul 13 01:15:04 2010 +0300 @@ -16,7 +16,8 @@ var libxen_path='/libxen'; - + + @@ -28,6 +29,7 @@ var libxen_path='/libxen'; - +

+ \ No newline at end of file diff -r b9279d8aaa76 -r dff069dff4b7 interface/js/interface_init.js --- a/interface/js/interface_init.js Tue Jun 15 00:58:46 2010 +0300 +++ b/interface/js/interface_init.js Tue Jul 13 01:15:04 2010 +0300 @@ -3,6 +3,11 @@ function templates_req() { var xmldoc; var param; var url; + var attr; + + var objElement; + var strClass; + var binMayAlredyExists; this.CreateHttpRequestObject = function(param) { if (!param) { param = 'text/xml'; } @@ -24,12 +29,13 @@ function templates_req() { } return http_request; } - this.LoadTemplate = function(url,put_id) { + this.LoadTemplate = function(url,put_id,onload) { var httpRequest=self.CreateHttpRequestObject(); httpRequest.onreadystatechange = function() { if (httpRequest.readyState == 4) { if (httpRequest.status == 200) { document.getElementById(put_id).innerHTML=httpRequest.responseText; + if(typeof(onload)!='undefined')onload(); } else { if(httpRequest.status!=404) { @@ -48,10 +54,417 @@ function templates_req() { document.getElementsByTagName('head')[0].appendChild(fileref); return true; } + this.LoadImage = function(img) { + imageObj = new Image(); + imageObj.src=img; + } + // other functions - + this.findPos = function(fobj) { + if (typeof(fobj) != 'object') { return [0,0]; } + var curleft = curtop = 0; + if (fobj.offsetParent) { + curleft = fobj.offsetLeft + curtop = fobj.offsetTop + while (fobj = fobj.offsetParent) { + curleft += fobj.offsetLeft + curtop += fobj.offsetTop + } + } + return [curleft,curtop]; + } + this.findPosX = function(fobj) { + if (typeof(fobj) != 'object') { return 0; } + if (navigator.appName == 'Microsoft Internet Explorer' || navigator.appName == 'Opera' || navigator.appName == 'Netscape') { + return fobj.offsetLeft; + } + if (navigator.userAgent.indexOf('Chrome') > -1) { + return fobj.offsetLeft; + } + var curleft = 0; + if(fobj.offsetParent) + while(1) { + curleft += fobj.offsetLeft; + if(!fobj.offsetParent) + break; + fobj = fobj.offsetParent; + } + else if(fobj.x) + curleft += fobj.x; + return curleft; + } + this.findPosY = function(fobj) { + if (typeof(fobj) != 'object') { return 0; } + if (navigator.appName == 'Microsoft Internet Explorer' || navigator.appName == 'Opera' || navigator.appName == 'Netscape') { + return fobj.offsetTop; + } + if (navigator.userAgent.indexOf('Chrome') > -1) { + return fobj.offsetTop; + } + var curtop = 0; + if(fobj.offsetParent) + while(1) { + curtop += fobj.offsetTop; + if(!fobj.offsetParent) + break; + fobj = fobj.offsetParent; + } + else if(fobj.y) + curtop += fobj.y; + return curtop; + } + } var templates = new templates_req(); +//the sub menu part +function xcp_Menu() { + var bw=document.getElementById&&!document.all; + var winm; + var prgm; + var param; + var attr; + var oname; + var fobj; + var self = this; + this.openedForFiles = new Array(); + this.openedForObjects = false; + this.menuopen = new Array(); + this.menubeforeopen = new Array(); + this.winm = false; + this.mousedown = function(e) { + fobj = bw ? e.target : event.srcElement; + self.checkforopenmenu(e,fobj); + } + this.checkforopenmenu = function(e,fobj) { + if (self.winm && typeof(self.winm) == 'object') { + if (!fobj.getAttribute('submenu')) { + var menuid; + if (menuid = self.getMainMenuId(fobj)) { + self.dropMenu(menuid.substr(5)); + } + else if (menuid = self.getMainMenuId(self.winm)) { + self.dropMenu(menuid.substr(5)); + } + } + else { + var menuid = self.getMainMenuId(fobj); + if (document.getElementById(menuid)) { + var menuObj = document.getElementById(menuid); + var menuObjLeft = templates.findPosX(menuObj); + if (menuObjLeft > menuObj.offsetWidth) { + var mx = bw ? e.clientX : event.clientX; + menuObj.style.left = (menuObjLeft-(menuObj.offsetWidth - 15))+'px'; + } + } + } + } + if (fobj.getAttribute('menuclick') && self.isEnabled(fobj)) { + if (fobj.tagName == 'INPUT' && fobj.type == 'checkbox') { + fobj.checked = !fobj.checked; + } + else { + var obj = self.getMenuId(fobj); + if (typeof(obj) == 'string' && document.getElementById(obj)) { + self.changeCheckBox(obj); + } + } + eval(fobj.getAttribute('menuclick')); + } + } + this.openRightMenu = function(winm,e,param) { + if (!document.getElementById(winm)) { return false; } + var mx = bw ? e.clientX : event.clientX; + var my = bw ? e.clientY : event.clientY; + self.winm = document.getElementById(winm); + if (!param) { + self.winm.style.left=mx+"px"; + self.winm.style.top=my+"px"; + } + self.winm.style.display="block"; + if (!param) { + if (parseInt(navigator.appVersion)>3) { + if (navigator.appName=="Netscape") { + var winW = window.innerWidth; + var winH = window.innerHeight; + } + if (navigator.appName.indexOf("Microsoft")!=-1) { + var winW = document.body.scrollWidth; + var winH = document.body.scrollHeight; + } + } + if ((Number(self.winm.offsetLeft) + Number(self.winm.offsetWidth)) >= winW) { + self.winm.style.left = Number(self.winm.offsetLeft) - Number(self.winm.offsetWidth)+'px'; + } + if ((Number(self.winm.offsetTop) + Number(self.winm.offsetHeight)) >= winH) { + self.winm.style.top = Number(winH) - Number(self.winm.offsetHeight)+'px'; + } + } + } + + + var menuobj; + var menupos; + var menuname; + var menuclick; + var menuicon; + this.isMenu = function(param) { + if (document.getElementById('menu_'+param)) { return true; } + else { return false; } + } + this.getMenu = function(param) { + if (self.isMenu(param)) { return document.getElementById('menu_'+param); } + else { return false; } + } + this.isInMenu = function(menuobj,param) { + if (!menuobj) { return false; } + if (typeof(menuobj) == 'object') { + var mname = self.getMainMenuId(menuobj); + if (!mname) { return false; } + if (document.getElementById(mname+'_'+param)) { return true; } + else { return false; } + } + return false; + } + this.getInMenu = function(menuobj,param) { + if (!menuobj) { return false; } + if (typeof(menuobj) == 'object') { + var mname = self.getMainMenuId(menuobj); + if (!mname) { return false; } + if ((menuobj.className && menuobj.className == 'sub') || menuobj.tagName == 'DIV') { + menuobj = menuobj.getElementsByTagName('UL'); + if (menuobj.length) { menuobj = menuobj[0]; } + else { return false; } + } + for (i=0;i + +
Virtual Machines List
+ +
+ +
+ + +
+ +
+ + diff -r b9279d8aaa76 -r dff069dff4b7 interface/templates/cloud_pool.html.backup --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/templates/cloud_pool.html.backup Tue Jul 13 01:15:04 2010 +0300 @@ -0,0 +1,87 @@ +
+ +
Virtual Machines List
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
server_name Some description for the server.
Memory Usage :
5192M / 10280M
CPU Usage :
30%
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
xcpweb-serverDDK virtual machine
Memory Usage :
512M / 10280M
CPU Count: 1Weight: 256Cap: 95
testvmDebian Lenny Server
Memory Usage :
512M / 10280M
CPU Count: 1Weight: 256Cap: 95
centosCentOS 5.4 Virtual Machine
Memory Usage :
1024M / 10280M
CPU Count: 1Weight: 256Cap: 95
+
other_server Some description for the server.
Memory Usage :
8192M / 10280M
CPU Usage :
10%
+ + + + + + + + + + + + + + + + + + + + +
backup-serverDDK virtual machine
Memory Usage :
512M / 10280M
CPU Count: 1Weight: 256Cap: 95
testvm2Debian Lenny Backup Server
Memory Usage :
512M / 10280M
CPU Count: 1Weight: 256Cap: 95
+
+ +
+ +
diff -r b9279d8aaa76 -r dff069dff4b7 interface/templates/cloud_pool.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/templates/cloud_pool.js Tue Jul 13 01:15:04 2010 +0300 @@ -0,0 +1,257 @@ +var param; + + +//Loag menu images +templates.LoadImage('/interface/img/menu_terminal.png'); +templates.LoadImage('/interface/img/menu_reboot.png'); +templates.LoadImage('/interface/img/menu_stats.png'); +templates.LoadImage('/interface/img/menu_shutdown.png'); +templates.LoadImage('/interface/img/menu_settings.png'); +templates.LoadImage('/interface/img/menu_operations.png'); +templates.LoadImage('/interface/img/server.png'); +templates.LoadImage('/interface/img/plus_big.png'); + +function Cloud_Pool_VM_box() +{ +var self = this; +var is_hidden = 0; + + this.show_hide = function() + { + if(is_hidden) + { + document.getElementById('vm_show_hide').src='/interface/img/minus_big.png'; + document.getElementById('vm_show_hide').style.top='-3px'; + document.getElementById('vm_box_content').style.display=''; + is_hidden=0; + } + else + { + document.getElementById('vm_show_hide').src='/interface/img/plus_big.png'; + document.getElementById('vm_show_hide').style.top='3px'; + document.getElementById('vm_box_content').style.display='none'; + is_hidden=1; + } + } + + this.addHost = function(id,params) + { + var x=document.getElementById('pool_server').insertRow(-1); + + var pool = document.createElement('table'); + pool.width='100%'; + pool.id='pool_'+id; + var y=document.getElementById('pool_server').insertRow(-1).insertCell(0); + y.colSpan=5; + y.appendChild(pool); + + var tempcell; + x.className="pool_server_tr"; + x.id=id; + tempcell=x.insertCell(0); + tempcell.className="img"; + tempcell.innerHTML=''; + + tempcell=x.insertCell(1); + tempcell.className="server_name"; + tempcell.innerHTML=params['name_label']; + + tempcell=x.insertCell(2); + tempcell.className="name_description"; + tempcell.innerHTML=params['server_description']; + + tempcell=x.insertCell(3); + tempcell.className="memory_usage"; + tempcell.innerHTML='
Memory Usage :
'+params['memory_free']+'M / '+params['memory_total']+'M
'; + + tempcell=x.insertCell(4); + tempcell.className="cpu_usage"; + tempcell.innerHTML='
CPU Usage :
'+params['cpu_usage']+'%
'; + + return pool; + } + + this.addVM = function(id,params,host_table) + { + var x=host_table.insertRow(-1); + var tempcell; + x.className="vm_row"; + x.id=id; + x.onclick = function(e) {cp_submenus.vm(id,e);} + tempcell=x.insertCell(0); + tempcell.className="vm_row_status"; + if(params['power_state']=='Running')tempcell.innerHTML=''; + else if(params['power_state']=='Halted')tempcell.innerHTML=''; + else if(params['power_state']=='Paused')tempcell.innerHTML=''; + else tempcell.innerHTML=''; + + tempcell=x.insertCell(1); + tempcell.className="vm_row_name"; + tempcell.innerHTML=params['name_label']; + + tempcell=x.insertCell(2); + tempcell.className="vm_row_description"; + tempcell.innerHTML=params['name_description']; + + tempcell=x.insertCell(3); + tempcell.className="vm_row_memory"; + tempcell.innerHTML='
Memory Usage :
'+params['memory_total']+'M
'; + + tempcell=x.insertCell(4); + tempcell.className="vm_row_cpus cpus_count"; + tempcell.innerHTML='CPU Count: '+params['vm_cpus_count']; + + tempcell=x.insertCell(5); + tempcell.className="vm_row_cpus cpus_weight"; + tempcell.innerHTML='Weight: '+params['vm_cpus_weight']; + + tempcell=x.insertCell(6); + tempcell.className="vm_row_cpus cpus_cap"; + tempcell.innerHTML='Cap: '+params['vm_cpus_cap']; + + return x; + } + + + this.initBox = function() + { + + + /* //only for testing purposes + var vm_pool=new Array(); + vm_pool['quote:some_test_server_id_0']=new Array(); + vm_pool['quote:some_test_server_id_0']['name_label']='server_name'; + vm_pool['quote:some_test_server_id_0']['server_description']=' Some description for the server. '; + vm_pool['quote:some_test_server_id_0']['actual_memory']='5120'; + vm_pool['quote:some_test_server_id_0']['max_memory']='10240'; + vm_pool['quote:some_test_server_id_0']['cpu_usage']='40'; + + vm_pool['quote:some_test_server_id_0']['vm_list']=new Array(); + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']=new Array(); + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['name_label']='xcpweb-server'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['vm_description']='DDK virtual machine'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['actual_memory']='512'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['vm_state']='running'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['max_memory']=vm_pool['quote:some_test_server_id_0']['max_memory']; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['vm_cpus_count']='1'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['vm_cpus_weight']='256'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['vm_cpus_cap']='95'; + + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']=new Array(); + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['name_label']='testvm'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['vm_description']='Debian Lenny Server'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['actual_memory']='512'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['vm_state']='paused'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['max_memory']=vm_pool['quote:some_test_server_id_0']['max_memory']; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['vm_cpus_count']='2'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['vm_cpus_weight']='512'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['vm_cpus_cap']='150'; + + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']=new Array(); + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']['name_label']='centos'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']['vm_description']='CentOS 5.4 Virtual Machine'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']['actual_memory']='512'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']['max_memory']=vm_pool['quote:some_test_server_id_0']['max_memory']; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']['vm_cpus_count']='1'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']['vm_cpus_weight']='256'; + vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']['vm_cpus_cap']='95'; + + + vm_pool['quote:some_test_server_id_1']=new Array(); + vm_pool['quote:some_test_server_id_1']['server_name']='other_server'; + vm_pool['quote:some_test_server_id_1']['server_description']=' Some description for the server. '; + vm_pool['quote:some_test_server_id_1']['actual_memory']='2048'; + vm_pool['quote:some_test_server_id_1']['max_memory']='10240'; + vm_pool['quote:some_test_server_id_1']['cpu_usage']='10'; + + vm_pool['quote:some_test_server_id_1']['vm_list']=new Array(); + vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_0']=new Array(); + vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_0']['name_label']='backup-server'; + vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_0']['vm_description']='DDK virtual machine'; + vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_0']['actual_memory']='512'; + vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_0']['vm_cpus_count']='1'; + vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_0']['vm_cpus_weight']='256'; + vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_0']['vm_cpus_cap']='95'; + + vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_1']=new Array(); + vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_1']['name_label']='testvm2'; + vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_1']['vm_description']='Debian Backup Server'; + vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_1']['actual_memory']='512'; + vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_1']['vm_cpus_count']='2'; + vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_1']['vm_cpus_weight']='512'; + vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_1']['vm_cpus_cap']='150'; + // TODO: to get the arrays from the xcp server part + + + for ( var server_id in vm_pool ) + { + + vm_pool[server_id]['table_id']=self.addHost(server_id,vm_pool[server_id]); + + for ( var vm_id in vm_pool[server_id]['vm_list'] ) + { + self.addVM(vm_id,vm_pool[server_id]['vm_list'][vm_id],vm_pool[server_id]['table_id']); + } + + + } + */ + + + var vm_pool=xen_get_vm_list_hosts(); + for ( var server_id in vm_pool ) + { + vm_pool[server_id]['table_id']=self.addHost(server_id,vm_pool[server_id]); + + for ( var vm_id in vm_pool[server_id]['resident_VMs'] ) // every vm + { + var current_vm=xen_get_vm_list_vm(vm_pool[server_id]['resident_VMs'][vm_id]); + current_vm['max_memory']=vm_pool[server_id]['memory_total']; + self.addVM(vm_id,current_vm,vm_pool[server_id]['table_id']); + } + + } + + + } + +} + +var cp_vm_box = new Cloud_Pool_VM_box(); + + +function Cloud_Pool_submenus() +{ + +this.vm = function(param,e) + { + if (xcp_menu.getMenu(param)) { xcp_menu.dropMenu(param); } + var currentMenu = xcp_menu.createMenu(param); + if (typeof(currentMenu) == 'object') { + xcp_menu.appendInMenu(currentMenu,'console','Console',"",'/interface/img/menu_terminal.png'); + var subcurrent = xcp_menu.appendSubInMenu(currentMenu,'oprations','Operations','/interface/img/menu_operations.png'); + if (typeof(subcurrent) == 'object') { + xcp_menu.appendInMenu(subcurrent,'shutdown','Shutdown',"",'/interface/img/menu_shutdown.png'); + xcp_menu.appendInMenu(subcurrent,'hard_shutdown','Force Shutdown',"",'/interface/img/menu_shutdown.png'); + xcp_menu.appendInMenu(subcurrent,'reboot','Reboot',"",'/interface/img/menu_reboot.png'); + xcp_menu.appendInMenu(subcurrent,'hard_reboot','Force Reboot',"",'/interface/img/menu_reboot.png'); + xcp_menu.appendInMenu(subcurrent,'pause','Pause',"",'/interface/img/menu_pause.png'); + } + xcp_menu.appendInMenu(currentMenu,'graphics','Statistics',"",'/interface/img/menu_stats.png'); + xcp_menu.appendInMenu(currentMenu,'settings','Settings',"",'/interface/img/menu_settings.png'); + xcp_menu.openRightMenu('menu_'+param,e); + } + } + +this.host = function(param,e) + { + } + +} + +var cp_submenus = new Cloud_Pool_submenus(); + +//Load the template + +templates.LoadTemplate(interface_path+'/templates/cloud_pool.html','main_content',cp_vm_box.initBox); + diff -r b9279d8aaa76 -r dff069dff4b7 interface/templates/create_new.html diff -r b9279d8aaa76 -r dff069dff4b7 interface/templates/create_new.js diff -r b9279d8aaa76 -r dff069dff4b7 interface/templates/login.css --- a/interface/templates/login.css Tue Jun 15 00:58:46 2010 +0300 +++ b/interface/templates/login.css Tue Jul 13 01:15:04 2010 +0300 @@ -1,9 +1,7 @@ .login_box { -margin: 0 auto; -margin-top: 70px; -margin-bottom: 70px; +margin: 70px auto 20px auto; text-align: left; clear:both; width: 390px; @@ -63,3 +61,44 @@ cursor: pointer; { background-image: url(../img/login_button_active.png); } + +.login_box_loading +{ +margin: 0 auto; +clear:both; +width: 390px; +height: 24px; +background-color:#fff8d6; +border: 1px solid #fbc27f; +behavior: url("/interface/border-radius.htc"); +-moz-border-radius: 4px; +-webkit-border-radius: 4px; +border-radius: 4px; +font-family: Arial; +font-size: 13px; +font-weight: bold; +text-align: center; +padding-top: 4px; +} + +.login_box_error +{ +margin: 0 auto; +clear:both; +width: 390px; +height: 24px; +background-color:#ffd8d6; +border: 1px solid #fb7f7f; +behavior: url("/interface/border-radius.htc"); +-moz-border-radius: 4px; +-webkit-border-radius: 4px; +border-radius: 4px; +font-family: Arial; +font-size: 13px; +font-weight: bold; +text-align: center; +padding-top: 6px; +} + + + diff -r b9279d8aaa76 -r dff069dff4b7 interface/templates/login.html --- a/interface/templates/login.html Tue Jun 15 00:58:46 2010 +0300 +++ b/interface/templates/login.html Tue Jul 13 01:15:04 2010 +0300 @@ -10,6 +10,14 @@   + + + + + \ No newline at end of file diff -r b9279d8aaa76 -r dff069dff4b7 interface/templates/login.js --- a/interface/templates/login.js Tue Jun 15 00:58:46 2010 +0300 +++ b/interface/templates/login.js Tue Jul 13 01:15:04 2010 +0300 @@ -1,24 +1,39 @@ +templates.LoadImage('/interface/img/login_button_active.png'); +templates.LoadImage('/interface/img/loading.gif'); + function login_req() { +var username=''; +var password=''; this.try_login = function() { - xen_init(document.getElementById('login_username').value,document.getElementById('login_password').value,this.callback,this.callback_error); + var priv_username=document.getElementById('login_username').value; + var priv_password=document.getElementById('login_password').value; + if(priv_username==username && priv_password==password)return; + username=priv_username; + password=priv_password; + document.getElementById('error_box').style.display='none'; + document.getElementById('loading_box').style.display=''; + xen_init(priv_username,priv_password,this.callback,this.callback_error); return ; } this.callback = function() { + templates.LoadJS(interface_path+'/templates/main.js'); templates.LoadTemplate(interface_path+'/templates/main.html','content'); return ; } this.callback_error = function(raw,xmldoc,param_pass) { - alert('error'); + document.getElementById('loading_box').style.display='none'; + document.getElementById('error_box').style.display=''; return ; } } -var login = new login_req(); \ No newline at end of file +var login = new login_req(); + diff -r b9279d8aaa76 -r dff069dff4b7 interface/templates/main.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/templates/main.css Tue Jul 13 01:15:04 2010 +0300 @@ -0,0 +1,65 @@ +.header_menu +{ +padding-left: 30px; +text-align: left; +clear:both; +height: 66px; +} + +.header_menu .cloud_pool_button +{ +width: 210px; +height: 50px; +background-image: url(/interface/img/cloud_pool_button.png); +display: block; +cursor: pointer; +margin-right: 30px; +float: left; +clear: none; +} + +.header_menu .cloud_pool_button:hover +{ +background-image: url(/interface/img/cloud_pool_button_active.png) !important; +} + +.header_menu .create_new_button +{ +width: 210px; +height: 50px; +background-image: url(/interface/img/create_new_button.png); +display: block; +cursor: pointer; +margin-right: 30px; +float: left; +clear: none; +} + +.header_menu .create_new_button:hover +{ +background-image: url(/interface/img/create_new_button_active.png) !important; +} + +.header_menu .settings_button +{ +width: 210px; +height: 50px; +background-image: url(/interface/img/settings_button.png); +display: block; +cursor: pointer; +margin-right: 30px; +float: left; +clear: none; +} + +.header_menu .settings_button:hover +{ +background-image: url(/interface/img/settings_button_active.png) !important; +} + +.main_content +{ +float:left; +clear:both; +} + diff -r b9279d8aaa76 -r dff069dff4b7 interface/templates/main.html --- a/interface/templates/main.html Tue Jun 15 00:58:46 2010 +0300 +++ b/interface/templates/main.html Tue Jul 13 01:15:04 2010 +0300 @@ -1,2 +1,8 @@ -Logged !!! -The main template is loaded... now is time for the real content \ No newline at end of file +
+
+
+
+
+ +
+
\ No newline at end of file diff -r b9279d8aaa76 -r dff069dff4b7 interface/templates/main.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/templates/main.js Tue Jul 13 01:15:04 2010 +0300 @@ -0,0 +1,47 @@ +templates.LoadImage('/interface/img/cloud_pool_button_active.png'); +templates.LoadImage('/interface/img/create_new_button_active.png'); +templates.LoadImage('/interface/img/settings_button_active.png'); + +function main_buttons_req() +{ +var img_path ='/interface/img/' +var buttons = new Array('cloud_pool_button','create_new_button','settings_button'); + +var make_active = function(button_id) + { + var i; + + for (i in buttons) + { + document.getElementById(buttons[i]).style.backgroundImage = "url("+img_path+buttons[i]+".png)"; + } + document.getElementById(button_id).style.backgroundImage = "url("+img_path+button_id+"_active.png)"; + } + +this.cloud_pool = function() + { + make_active('cloud_pool_button'); + templates.LoadJS(interface_path+'/templates/cloud_pool.js'); + return ; + } + +this.create_new = function() + { + make_active('create_new_button'); + templates.LoadJS(interface_path+'/templates/create_new.js'); + templates.LoadTemplate(interface_path+'/templates/create_new.html','main_content'); + return ; + } + +this.settings = function() + { + make_active('settings_button'); + templates.LoadJS(interface_path+'/templates/settings.js'); + templates.LoadTemplate(interface_path+'/templates/settings.html','main_content'); + return ; + } + +} +var main_buttons = new main_buttons_req(); + +templates.LoadTemplate(interface_path+'/templates/main.html','content',main_buttons.cloud_pool); diff -r b9279d8aaa76 -r dff069dff4b7 interface/templates/settings.html diff -r b9279d8aaa76 -r dff069dff4b7 interface/templates/settings.js diff -r b9279d8aaa76 -r dff069dff4b7 interface/xcp.css --- a/interface/xcp.css Tue Jun 15 00:58:46 2010 +0300 +++ b/interface/xcp.css Tue Jul 13 01:15:04 2010 +0300 @@ -49,4 +49,132 @@ float:left; width:100%; float:left; clear:both; -} \ No newline at end of file +} + + +/* the submenus */ + +.rightmenu +{ + margin: 0px; + padding: 0px; + background-color: #f2f2f2; + font-size: 11px; + width: 160px; + font-family: Arial, Helvetica, sans-serif; + border: 1px solid #CCCCCC; + position: fixed; + _position:absolute; + z-index: 30!important; + z-index:30; + left: 0px; + top: 0px; + display: none; +} +.rightmenu li.sub +{ + background-color: #f2f2f2; + background-image: url(img/ico-arrow-right.png); + background-repeat: no-repeat; + background-position: 145px center; +} + +.rightmenu ul +{ + width:160px; + height:auto; + overflow:visible; + padding:0; + margin:0; +} +.rightmenu ul li +{ + list-style-image:none; + list-style:none; + list-style-type:none; + width:160px; + height:21px; + text-align:left; + margin:0; + padding:0; + margin-top:-1px; + clear:both; + overflow:visible; + position:relative; + padding-top:5px; + border-top: 1px solid #CCCCCC; + cursor:pointer; +} + +.rightmenu ul li a +{ + text-decoration:none; + color:#000000; +} + +.rightmenu ul li:hover +{ + color:#000000; + background-color: #9dd4fc; +} + +.rightmenu ul li ul +{ + position:absolute; + top:-30px; + left:145px; + padding:30px 50px 40px 0px; + display:none; + z-index:30; +} + +.rightmenu ul li ul li +{ + border-top-width: 1px; + border-right-width: 2px; + border-bottom-width: 2px; + border-left-width: 1px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-color: #CCCCCC; + border-right-color: #666666; + border-bottom-color: #666666; + border-left-color: #CCCCCC; + background-color: #f2f2f2; + margin-top:-2px; +} + +.rightmenu ul li:hover > ul +{ + display:block; +} + +.menu-ico +{ + padding:0; + float: left; + width: 16px; + margin-right: 6px; + padding-right:0; + padding-left:6px; + margin-top:-2px; +} + +.menu-ico input +{ + float:left; + margin:0; + margin-top:2px; +} + +.menu-ico-sub +{ + padding:0; + float: left; + width: 16px; + margin-right: 3px; + padding-right:3px; + padding-left:6px; +} diff -r b9279d8aaa76 -r dff069dff4b7 libxen/db_callbacks.js --- a/libxen/db_callbacks.js Tue Jun 15 00:58:46 2010 +0300 +++ b/libxen/db_callbacks.js Tue Jul 13 01:15:04 2010 +0300 @@ -1,1 +1,1 @@ -function invoke_event(array_name){if(typeof(xen_db_events[array_name])!='undefined'){xen_db_events[array_name]();}if(typeof(xen_db_events['*'])!='undefined'){xen_db_events['*']();}} var db_callbacks=new Array(); db_callbacks['session.login_with_password']=function(result) { xen_db['session_id']=result; xen_db['is_logged']=1; xen_db['logged']=1; return ; } db_callbacks['VM.get_all_records']=function(result){xen_db['VM']=result;invoke_event('VM');return;} db_callbacks['task.get_all_records']=function(result){xen_db['task']=result;invoke_event('task');return;} db_callbacks['VBD.get_all_records']=function(result){xen_db['VBD']=result;invoke_event('VBD');return;} db_callbacks['VBD_metrics.get_all_records']=function(result){xen_db['VBD_metrics']=result;invoke_event('VBD_metrics');return;} db_callbacks['VDI.get_all_records']=function(result){xen_db['VDI']=result;invoke_event('VDI');return;} db_callbacks['network.get_all_records']=function(result){xen_db['network']=result;invoke_event('network');return;} db_callbacks['PIF.get_all_records']=function(result){xen_db['PIF']=result;invoke_event('PIF');return;} db_callbacks['PIF_metrics.get_all_records']=function(result){xen_db['PIF_metrics']=result;invoke_event('PIF_metrics');return;} db_callbacks['PBD.get_all_records']=function(result){xen_db['PBD']=result;invoke_event('PBD');return;} db_callbacks['VIF.get_all_records']=function(result){xen_db['VIF']=result;invoke_event('VIF');return;} db_callbacks['VIF_metrics.get_all_records']=function(result){xen_db['VIF_metrics']=result;invoke_event('VIF_metrics');return;} db_callbacks['VM_guest_metrics.get_all_records']=function(result){xen_db['VM_guest_metrics']=result;invoke_event('VM_guest_metrics');return;} db_callbacks['VM_metrics.get_all_records']=function(result){xen_db['VM_metrics']=result;invoke_event('VM_metrics');return;} db_callbacks['host_metrics.get_all_records']=function(result){xen_db['host_metrics']=result;invoke_event('host_metrics');return;} db_callbacks['host_cpu.get_all_records']=function(result){xen_db['host_cpu']=result;invoke_event('host_cpu');return;} db_callbacks['Bond.get_all_records']=function(result){xen_db['Bond']=result;invoke_event('Bond');return;} db_callbacks['pool_patch.get_all_records']=function(result){xen_db['pool_patch']=result;invoke_event('pool_patch');return;} db_callbacks['host_patch.get_all_records']=function(result){xen_db['host_patch']=result;invoke_event('host_patch');return;} db_callbacks['console.get_all_records']=function(result){xen_db['console']=result;invoke_event('console');return;} db_callbacks['host.get_all_records']=function(result){xen_db['host']=result;invoke_event('host');return;} db_callbacks['pool.get_all_records']=function(result){xen_db['pool']=result;invoke_event('pool');return;} db_callbacks['SR.get_all_records']=function(result){xen_db['SR']=result;invoke_event('SR');return;} db_callbacks['message.get_all_records']=function(result){xen_db['message']=result;invoke_event('message');return;} db_callbacks['event.next']=function(result) { for ( var i in result ) { if(result[i].operation=='mod' || result[i].operation=='add') { if(typeof(xen_db[result[i].class][result[i].ref])!='undefined') { xen_db[result[i].class][result[i].ref]=result[i].snapshot; invoke_event(result[i].class); } else { alert("non existing class in xen_db class name:"+result[i].class+" reference:"+result[i].ref); } } if(result[i].operation=='del') { delete xen_db[result[i].class][result[i].ref]; invoke_event('del'); } } return; } \ No newline at end of file +function invoke_event(array_name){if(typeof(xen_db_events[array_name])!='undefined'){xen_db_events[array_name]();}if(typeof(xen_db_events['*'])!='undefined'){xen_db_events['*']();}} var db_callbacks=new Array(); db_callbacks['session.login_with_password']=function(result) { xen_db['session_id']=result; xen_db['is_logged']=1; xen_db['logged']=1; return ; } db_callbacks['VM.get_all_records']=function(result){xen_db['VM']=result;invoke_event('VM');return;} db_callbacks['task.get_all_records']=function(result){xen_db['task']=result;invoke_event('task');return;} db_callbacks['VBD.get_all_records']=function(result){xen_db['VBD']=result;invoke_event('VBD');return;} db_callbacks['VBD_metrics.get_all_records']=function(result){xen_db['VBD_metrics']=result;invoke_event('VBD_metrics');return;} db_callbacks['VDI.get_all_records']=function(result){xen_db['VDI']=result;invoke_event('VDI');return;} db_callbacks['network.get_all_records']=function(result){xen_db['network']=result;invoke_event('network');return;} db_callbacks['PIF.get_all_records']=function(result){xen_db['PIF']=result;invoke_event('PIF');return;} db_callbacks['PIF_metrics.get_all_records']=function(result){xen_db['PIF_metrics']=result;invoke_event('PIF_metrics');return;} db_callbacks['PBD.get_all_records']=function(result){xen_db['PBD']=result;invoke_event('PBD');return;} db_callbacks['VIF.get_all_records']=function(result){xen_db['VIF']=result;invoke_event('VIF');return;} db_callbacks['VIF_metrics.get_all_records']=function(result){xen_db['VIF_metrics']=result;invoke_event('VIF_metrics');return;} db_callbacks['VM_guest_metrics.get_all_records']=function(result){xen_db['VM_guest_metrics']=result;invoke_event('VM_guest_metrics');return;} db_callbacks['VM_metrics.get_all_records']=function(result){xen_db['VM_metrics']=result;invoke_event('VM_metrics');return;} db_callbacks['host_metrics.get_all_records']=function(result){xen_db['host_metrics']=result;invoke_event('host_metrics');return;} db_callbacks['host_cpu.get_all_records']=function(result){xen_db['host_cpu']=result;invoke_event('host_cpu');return;} db_callbacks['Bond.get_all_records']=function(result){xen_db['Bond']=result;invoke_event('Bond');return;} db_callbacks['pool_patch.get_all_records']=function(result){xen_db['pool_patch']=result;invoke_event('pool_patch');return;} db_callbacks['host_patch.get_all_records']=function(result){xen_db['host_patch']=result;invoke_event('host_patch');return;} db_callbacks['console.get_all_records']=function(result){xen_db['console']=result;invoke_event('console');return;} db_callbacks['host.get_all_records']=function(result){xen_db['host']=result;invoke_event('host');return;} db_callbacks['pool.get_all_records']=function(result){xen_db['pool']=result;invoke_event('pool');return;} db_callbacks['SR.get_all_records']=function(result){xen_db['SR']=result;invoke_event('SR');return;} db_callbacks['message.get_all_records']=function(result){xen_db['message']=result;invoke_event('message');return;} db_callbacks['event.next']=function(result) { for ( var i in result ) { if(result[i].operation=='mod' || result[i].operation=='add') { if(typeof(xen_db[result[i].class][result[i].ref])!='undefined') //TODO: some errors happen when there are no result[i].class, because it may load before xen_db { xen_db[result[i].class][result[i].ref]=result[i].snapshot; invoke_event(result[i].class); } else { alert("non existing class in xen_db class name:"+result[i].class+" reference:"+result[i].ref); } } if(result[i].operation=='del') { delete xen_db[result[i].class][result[i].ref]; invoke_event('del'); } } return; } \ No newline at end of file diff -r b9279d8aaa76 -r dff069dff4b7 libxen/libxen.js --- a/libxen/libxen.js Tue Jun 15 00:58:46 2010 +0300 +++ b/libxen/libxen.js Tue Jul 13 01:15:04 2010 +0300 @@ -21,4 +21,64 @@ function xen_register_db_event(db_array, //example 2 xen_register_db_event('*',make_UI_modifications); { xen_db_events[db_array]=function_call; -} \ No newline at end of file +} + + +//for the vm list box + +function xen_get_vm_list_hosts() +{ + +var vm_pool=new Array(); + + for ( var host_id in xen_db['host'] ) + { + vm_pool[host_id] = new Array(); + vm_pool[host_id]['name_label']=xen_db['host'][host_id]['name_label']; + vm_pool[host_id]['name_description']=xen_db['host'][host_id]['name_description']; + + //to get other things from the metrics + //get the cpu_usage + var cpu_usage=0; + var cpus=0 + for (var cpu_id in xen_db['host'][host_id]['host_CPUs']) + { + cpu_usage=parseInt(cpu_usage)+parseInt(xen_db['host_cpu'][xen_db['host'][host_id]['host_CPUs'][cpu_id]]['utilisation']); + cpus++; + } + cpu_usage=cpu_usage/cpus; + + vm_pool[host_id]['cpu_usage']=cpu_usage; + + vm_pool[host_id]['memory_free']=Math.floor(parseInt(xen_db['host_metrics'][xen_db['host'][host_id]['metrics']]['memory_free']) / (1024*1024)); + vm_pool[host_id]['memory_total']=Math.floor(parseInt(xen_db['host_metrics'][xen_db['host'][host_id]['metrics']]['memory_total']) / (1024*1024)); + + vm_pool[host_id]['resident_VMs']=new Array(); + for(var id in xen_db['host'][host_id]['resident_VMs']) + { + var vm_id=xen_db['host'][host_id]['resident_VMs'][id]; + if(!xen_db['VM'][vm_id]['is_a_snapshot'] && !xen_db['VM'][vm_id]['is_a_template'] && !xen_db['VM'][vm_id]['is_control_domain'])vm_pool[host_id]['resident_VMs'].push(vm_id); + } + + } + + return vm_pool; +} + +function xen_get_vm_list_vm(vm_id) +{ +var vm_pool = new Array(); + + vm_pool['name_label']=xen_db['VM'][vm_id]['name_label']; + vm_pool['name_description']=xen_db['VM'][vm_id]['name_description']; + if(vm_pool['name_description']=='')vm_pool['name_description']=xen_db['VM_guest_metrics'][xen_db['VM'][vm_id]['guest_metrics']]['os_version']['name']; + + vm_pool['memory_total']=Math.floor(parseInt(xen_db['VM'][vm_id]['memory_target']) / (1024*1024)); + vm_pool['power_state']=xen_db['VM'][vm_id]['power_state']; + vm_pool['vm_cpus_count']=xen_db['VM'][vm_id]['VCPUs_max']; + vm_pool['vm_cpus_weight']='';// TODO + vm_pool['vm_cpus_cap']='';// TODO +return vm_pool; +} + +//end of vm list box \ No newline at end of file diff -r b9279d8aaa76 -r dff069dff4b7 xcpweb_screenshot.png Binary file xcpweb_screenshot.png has changed