From 7dc62cc293215ecbc73d59c931d37adcb4e7c451 Mon Sep 17 00:00:00 2001 From: abhishek Date: Fri, 24 Sep 2010 14:27:58 -0700 Subject: [PATCH 001/244] bug 6247: incremental checkin --- .../com/cloud/hypervisor/xen/resource/CitrixResourceBase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index b30a0996e92..4e9c7e7ca59 100644 --- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -1624,9 +1624,9 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR vmStatsAnswer.setNumCPUs(vmStatsAnswer.getNumCPUs() + 1); vmStatsAnswer.setCPUUtilization((vmStatsAnswer.getCPUUtilization() + getDataAverage(dataNode, col, numRows))*100); } else if (param.equals("vif_0_rx")) { - vmStatsAnswer.setNetworkReadKBs(getDataAverage(dataNode, col, numRows)); + vmStatsAnswer.setNetworkReadKBs(getDataAverage(dataNode, col, numRows)/(8*2)); } else if (param.equals("vif_0_tx")) { - vmStatsAnswer.setNetworkWriteKBs(getDataAverage(dataNode, col, numRows)); + vmStatsAnswer.setNetworkWriteKBs(getDataAverage(dataNode, col, numRows)/(8*2)); } } From 7abda2ee2dd86954d3f1e7b04cf64331426d1f92 Mon Sep 17 00:00:00 2001 From: abhishek Date: Fri, 24 Sep 2010 15:50:33 -0700 Subject: [PATCH 002/244] bug 6291: generating some events whilst starting vms, wrt volume creation status 6291: resolved fixed --- .../com/cloud/storage/StorageManagerImpl.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index 04c7f9bed39..0539b3a470b 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -939,6 +939,9 @@ public class StorageManagerImpl implements StorageManager { txn.start(); if (Storage.ImageFormat.ISO == template.getFormat()) { rootVol = new VolumeVO(VolumeType.ROOT, vm.getId(), vm.getInstanceName() + "-ROOT", dc.getId(), pod.getId(), account.getId(), account.getDomainId(),(size>0)? size : diskOffering.getDiskSizeInBytes()); + + createStartedEvent(account, rootVol); + rootVol.setDiskOfferingId(diskOffering.getId()); rootVol.setSourceType(SourceType.Template); rootVol.setSourceId(template.getId()); @@ -946,6 +949,9 @@ public class StorageManagerImpl implements StorageManager { rootVol = _volsDao.persist(rootVol); } else { rootVol = new VolumeVO(VolumeType.ROOT, vm.getId(), template.getId(), vm.getInstanceName() + "-ROOT", dc.getId(), pod.getId(), account.getId(), account.getDomainId(), offering.isRecreatable()); + + createStartedEvent(account, rootVol); + rootVol.setDiskOfferingId(offering.getId()); rootVol.setTemplateId(template.getId()); rootVol.setSourceId(template.getId()); @@ -955,6 +961,9 @@ public class StorageManagerImpl implements StorageManager { if (diskOffering != null && diskOffering.getDiskSizeInBytes() > 0) { dataVol = new VolumeVO(VolumeType.DATADISK, vm.getId(), vm.getInstanceName() + "-DATA", dc.getId(), pod.getId(), account.getId(), account.getDomainId(), (size>0)? size : diskOffering.getDiskSizeInBytes()); + + createStartedEvent(account, dataVol); + dataVol.setDiskOfferingId(diskOffering.getId()); dataVol.setSourceType(SourceType.DiskOffering); dataVol.setSourceId(diskOffering.getId()); @@ -994,6 +1003,16 @@ public class StorageManagerImpl implements StorageManager { throw new CloudRuntimeException("Unable to create volumes for " + vm, e); } } + + private void createStartedEvent(Account account, VolumeVO rootVol) { + EventVO event1 = new EventVO(); + event1.setAccountId(account.getId()); + event1.setUserId(1L); + event1.setType(EventTypes.EVENT_VOLUME_CREATE); + event1.setState(EventState.Started); + event1.setDescription("Create volume: " + rootVol.getName()+ "started"); + _eventDao.persist(event1); + } @Override From 461149a3904d3fd079ecdc947bfe46e6566ba198 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Fri, 24 Sep 2010 23:43:38 -0700 Subject: [PATCH 003/244] new UI - accounts page - implement Resource limits action. --- ui/new/jsp/account.jsp | 57 ++++++++++ ui/new/scripts/cloud.core2.account.js | 157 ++++++++++++++++++++++++-- 2 files changed, 202 insertions(+), 12 deletions(-) diff --git a/ui/new/jsp/account.jsp b/ui/new/jsp/account.jsp index e82770f784c..d4f0e263269 100644 --- a/ui/new/jsp/account.jsp +++ b/ui/new/jsp/account.jsp @@ -139,3 +139,60 @@ + + + + + + + \ No newline at end of file diff --git a/ui/new/scripts/cloud.core2.account.js b/ui/new/scripts/cloud.core2.account.js index 7bf04e1b8a1..28a3ff10457 100644 --- a/ui/new/scripts/cloud.core2.account.js +++ b/ui/new/scripts/cloud.core2.account.js @@ -1,5 +1,18 @@ -function afterLoadAccountJSP() { +var systemAccountId = 1; +var adminAccountId = 2; +function afterLoadAccountJSP() { + activateDialog($("#dialog_resource_limits").dialog({ + autoOpen: false, + modal: true, + zIndex: 2000 + })); + + activateDialog($("#dialog_disable_account").dialog({ + autoOpen: false, + modal: true, + zIndex: 2000 + })); } function accountToMidmenu(jsonObj, $midmenuItem1) { @@ -20,15 +33,135 @@ function accountToMidmenu(jsonObj, $midmenuItem1) { function accountToRigntPanel($midmenuItem) { var jsonObj = $midmenuItem.data("jsonObj"); + accountJsonToDetailsTab(jsonObj); +} + +function accountJsonToDetailsTab(jsonObj) { + var $detailsTab = $("#right_panel_content #tab_content_details"); + $detailsTab.data("jsonObj", jsonObj); + $detailsTab.find("#id").text(jsonObj.id); + $detailsTab.find("#role").text(toRole(jsonObj.accounttype)); + $detailsTab.find("#account").text(fromdb(jsonObj.name)); + $detailsTab.find("#domain").text(fromdb(jsonObj.domain)); + $detailsTab.find("#vm_total").text(jsonObj.vmtotal); + $detailsTab.find("#ip_total").text(jsonObj.iptotal); + $detailsTab.find("#bytes_received").text(jsonObj.receivedbytes); + $detailsTab.find("#bytes_sent").text(jsonObj.sentbytes); + $detailsTab.find("#state").text(jsonObj.state); - var $rightPanelContent = $("#right_panel_content"); - $rightPanelContent.find("#id").text(jsonObj.id); - $rightPanelContent.find("#role").text(toRole(jsonObj.accounttype)); - $rightPanelContent.find("#account").text(fromdb(jsonObj.name)); - $rightPanelContent.find("#domain").text(fromdb(jsonObj.domain)); - $rightPanelContent.find("#vm_total").text(jsonObj.vmtotal); - $rightPanelContent.find("#ip_total").text(jsonObj.iptotal); - $rightPanelContent.find("#bytes_received").text(jsonObj.receivedbytes); - $rightPanelContent.find("#bytes_sent").text(jsonObj.sentbytes); - $rightPanelContent.find("#state").text(jsonObj.state); -} \ No newline at end of file + //actions *** + var $actionMenu = $("#right_panel_content #tab_content_details #action_link #action_menu"); + $actionMenu.find("#action_list").empty(); + if(jsonObj.id != systemAccountId && jsonObj.id != adminAccountId) { + if (jsonObj.accounttype == roleTypeUser || jsonObj.accounttype == roleTypeDomainAdmin) + buildActionLinkForDetailsTab("Resource limits", accountActionMap, $actionMenu, accountListAPIMap); + +// if(jsonObj.state == "enabled") +// buildActionLinkForDetailsTab("Disable", accountActionMap, $actionMenu, accountListAPIMap); +// else if(jsonObj.state == "disabled") +// buildActionLinkForDetailsTab("Enable", accountActionMap, $actionMenu, accountListAPIMap); + } +} + +var accountActionMap = { + "Resource limits": { + customActionFn : doResourceLimits + } +}; + +var accountListAPIMap = { + listAPI: "listAccounts", + listAPIResponse: "listaccountsresponse", + listAPIResponseObj: "account" +}; + +function updateResourceLimit(domainId, account, type, max) { + $.ajax({ + data: createURL("command=updateResourceLimit&domainid="+domainId+"&account="+account+"&resourceType="+type+"&max="+max), + dataType: "json", + success: function(json) { + } + }); +} + +function doResourceLimits () { + var $detailsTab = $("#right_panel_content #tab_content_details"); + var jsonObj = $detailsTab.data("jsonObj"); + var domainId = jsonObj.domainid; + var account = jsonObj.name; + $.ajax({ + cache: false, + data: createURL("command=listResourceLimits&domainid="+domainId+"&account="+account), + dataType: "json", + success: function(json) { + var limits = json.listresourcelimitsresponse.resourcelimit; + var preInstanceLimit, preIpLimit, preDiskLimit, preSnapshotLimit, preTemplateLimit = -1; + if (limits != null) { + for (var i = 0; i < limits.length; i++) { + var limit = limits[i]; + switch (limit.resourcetype) { + case "0": + preInstanceLimit = limit.max; + $("#dialog_resource_limits #limits_vm").val(limit.max); + break; + case "1": + preIpLimit = limit.max; + $("#dialog_resource_limits #limits_ip").val(limit.max); + break; + case "2": + preDiskLimit = limit.max; + $("#dialog_resource_limits #limits_volume").val(limit.max); + break; + case "3": + preSnapshotLimit = limit.max; + $("#dialog_resource_limits #limits_snapshot").val(limit.max); + break; + case "4": + preTemplateLimit = limit.max; + $("#dialog_resource_limits #limits_template").val(limit.max); + break; + } + } + } + $("#dialog_resource_limits") + .dialog('option', 'buttons', { + "Save": function() { + // validate values + var isValid = true; + isValid &= validateNumber("Instance Limit", $("#dialog_resource_limits #limits_vm"), $("#dialog_resource_limits #limits_vm_errormsg"), -1, 32000, false); + isValid &= validateNumber("Public IP Limit", $("#dialog_resource_limits #limits_ip"), $("#dialog_resource_limits #limits_ip_errormsg"), -1, 32000, false); + isValid &= validateNumber("Disk Volume Limit", $("#dialog_resource_limits #limits_volume"), $("#dialog_resource_limits #limits_volume_errormsg"), -1, 32000, false); + isValid &= validateNumber("Snapshot Limit", $("#dialog_resource_limits #limits_snapshot"), $("#dialog_resource_limits #limits_snapshot_errormsg"), -1, 32000, false); + isValid &= validateNumber("Template Limit", $("#dialog_resource_limits #limits_template"), $("#dialog_resource_limits #limits_template_errormsg"), -1, 32000, false); + if (!isValid) return; + + var instanceLimit = trim($("#dialog_resource_limits #limits_vm").val()); + var ipLimit = trim($("#dialog_resource_limits #limits_ip").val()); + var diskLimit = trim($("#dialog_resource_limits #limits_volume").val()); + var snapshotLimit = trim($("#dialog_resource_limits #limits_snapshot").val()); + var templateLimit = trim($("#dialog_resource_limits #limits_template").val()); + + $(this).dialog("close"); + if (instanceLimit != preInstanceLimit) { + updateResourceLimit(domainId, account, 0, instanceLimit); + } + if (ipLimit != preIpLimit) { + updateResourceLimit(domainId, account, 1, ipLimit); + } + if (diskLimit != preDiskLimit) { + updateResourceLimit(domainId, account, 2, diskLimit); + } + if (snapshotLimit != preSnapshotLimit) { + updateResourceLimit(domainId, account, 3, snapshotLimit); + } + if (templateLimit != preTemplateLimit) { + updateResourceLimit(domainId, account, 4, templateLimit); + } + }, + "Cancel": function() { + $(this).dialog("close"); + } + }).dialog("open"); + } + }); +} From ae453b296179197af8423fed8640b5783b9ba97b Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sat, 25 Sep 2010 09:57:48 -0700 Subject: [PATCH 004/244] new UI - accounts page - implement Disable account action. --- ui/new/jsp/account.jsp | 23 +++------------- ui/new/scripts/cloud.core2.account.js | 39 +++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/ui/new/jsp/account.jsp b/ui/new/jsp/account.jsp index d4f0e263269..205ef23c8d9 100644 --- a/ui/new/jsp/account.jsp +++ b/ui/new/jsp/account.jsp @@ -176,23 +176,6 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/ui/new/scripts/cloud.core2.account.js b/ui/new/scripts/cloud.core2.account.js index 28a3ff10457..a0a811a4d3d 100644 --- a/ui/new/scripts/cloud.core2.account.js +++ b/ui/new/scripts/cloud.core2.account.js @@ -56,17 +56,30 @@ function accountJsonToDetailsTab(jsonObj) { if (jsonObj.accounttype == roleTypeUser || jsonObj.accounttype == roleTypeDomainAdmin) buildActionLinkForDetailsTab("Resource limits", accountActionMap, $actionMenu, accountListAPIMap); -// if(jsonObj.state == "enabled") -// buildActionLinkForDetailsTab("Disable", accountActionMap, $actionMenu, accountListAPIMap); -// else if(jsonObj.state == "disabled") -// buildActionLinkForDetailsTab("Enable", accountActionMap, $actionMenu, accountListAPIMap); + if(jsonObj.state == "enabled") { + buildActionLinkForDetailsTab("Disable account", accountActionMap, $actionMenu, accountListAPIMap); + //buildActionLinkForDetailsTab("Lock account", accountActionMap, $actionMenu, accountListAPIMap); + } +// else if(jsonObj.state == "disabled") { +// buildActionLinkForDetailsTab("Enable account", accountActionMap, $actionMenu, accountListAPIMap); +// } } } var accountActionMap = { "Resource limits": { customActionFn : doResourceLimits - } + } + , + "Disable account": { + isAsyncJob: true, + asyncJobResponse: "disableaccountresponse", + dialogBeforeActionFn : doDisableAccount, + inProcessText: "Disabling account....", + afterActionSeccessFn: function(jsonObj) { + accountJsonToDetailsTab(jsonObj); + } + } }; var accountListAPIMap = { @@ -165,3 +178,19 @@ function doResourceLimits () { } }); } + +function doDisableAccount($actionLink, listAPIMap, $detailsTab) { + var jsonObj = $detailsTab.data("jsonObj"); + + $("#dialog_disable_account") + .dialog('option', 'buttons', { + "Yes": function() { + $(this).dialog("close"); + var apiCommand = "command=disableAccount&account="+jsonObj.name+"&domainId="+jsonObj.domainid; + doActionToDetailsTab(jsonObj.id, $actionLink, apiCommand, listAPIMap); + }, + "Cancel": function() { + $(this).dialog("close"); + } + }).dialog("open"); +} From 13181b79f814ed530cd1560b94a996b543298a38 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sat, 25 Sep 2010 10:15:53 -0700 Subject: [PATCH 005/244] new UI - accounts page - implement Enable Account action. --- ui/new/jsp/account.jsp | 4 +++ ui/new/scripts/cloud.core2.account.js | 41 +++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/ui/new/jsp/account.jsp b/ui/new/jsp/account.jsp index 205ef23c8d9..9e243e2a4bc 100644 --- a/ui/new/jsp/account.jsp +++ b/ui/new/jsp/account.jsp @@ -178,4 +178,8 @@ + + \ No newline at end of file diff --git a/ui/new/scripts/cloud.core2.account.js b/ui/new/scripts/cloud.core2.account.js index a0a811a4d3d..4facf3c11d9 100644 --- a/ui/new/scripts/cloud.core2.account.js +++ b/ui/new/scripts/cloud.core2.account.js @@ -6,13 +6,17 @@ function afterLoadAccountJSP() { autoOpen: false, modal: true, zIndex: 2000 - })); - + })); activateDialog($("#dialog_disable_account").dialog({ autoOpen: false, modal: true, zIndex: 2000 })); + activateDialog($("#dialog_enable_account").dialog({ + autoOpen: false, + modal: true, + zIndex: 2000 + })); } function accountToMidmenu(jsonObj, $midmenuItem1) { @@ -60,9 +64,9 @@ function accountJsonToDetailsTab(jsonObj) { buildActionLinkForDetailsTab("Disable account", accountActionMap, $actionMenu, accountListAPIMap); //buildActionLinkForDetailsTab("Lock account", accountActionMap, $actionMenu, accountListAPIMap); } -// else if(jsonObj.state == "disabled") { -// buildActionLinkForDetailsTab("Enable account", accountActionMap, $actionMenu, accountListAPIMap); -// } + else if(jsonObj.state == "disabled" || jsonObj.state == "locked") { + buildActionLinkForDetailsTab("Enable account", accountActionMap, $actionMenu, accountListAPIMap); + } } } @@ -76,7 +80,18 @@ var accountActionMap = { asyncJobResponse: "disableaccountresponse", dialogBeforeActionFn : doDisableAccount, inProcessText: "Disabling account....", + afterActionSeccessFn: function(jsonObj) { + $("#midmenuItem_"+jsonObj.id).data("jsonObj", jsonObj); + accountJsonToDetailsTab(jsonObj); + } + } + , + "Enable account": { + isAsyncJob: false, + dialogBeforeActionFn : doEnableAccount, + inProcessText: "Enabling account....", afterActionSeccessFn: function(jsonObj) { + $("#midmenuItem_"+jsonObj.id).data("jsonObj", jsonObj); accountJsonToDetailsTab(jsonObj); } } @@ -194,3 +209,19 @@ function doDisableAccount($actionLink, listAPIMap, $detailsTab) { } }).dialog("open"); } + +function doEnableAccount($actionLink, listAPIMap, $detailsTab) { + var jsonObj = $detailsTab.data("jsonObj"); + + $("#dialog_enable_account") + .dialog('option', 'buttons', { + "Yes": function() { + $(this).dialog("close"); + var apiCommand = "command=enableAccount&account="+jsonObj.name+"&domainId="+jsonObj.domainid; + doActionToDetailsTab(jsonObj.id, $actionLink, apiCommand, listAPIMap); + }, + "Cancel": function() { + $(this).dialog("close"); + } + }).dialog("open"); +} \ No newline at end of file From e2114b195038131cd8983602790441861033a1cb Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sat, 25 Sep 2010 10:28:46 -0700 Subject: [PATCH 006/244] new UI - accounts page - implement Lock Account action. --- ui/new/jsp/account.jsp | 6 ++++- ui/new/scripts/cloud.core2.account.js | 33 ++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/ui/new/jsp/account.jsp b/ui/new/jsp/account.jsp index 9e243e2a4bc..f6ad235af2f 100644 --- a/ui/new/jsp/account.jsp +++ b/ui/new/jsp/account.jsp @@ -45,7 +45,7 @@
-
+
<%=t.t("id")%>:
@@ -180,6 +180,10 @@

Please confirm you want to disable account that will prevent account access to the cloud and shut down all existing virtual instances.

+ + \ No newline at end of file diff --git a/ui/new/scripts/cloud.core2.account.js b/ui/new/scripts/cloud.core2.account.js index 4facf3c11d9..bdc6d726366 100644 --- a/ui/new/scripts/cloud.core2.account.js +++ b/ui/new/scripts/cloud.core2.account.js @@ -12,6 +12,11 @@ function afterLoadAccountJSP() { modal: true, zIndex: 2000 })); + activateDialog($("#dialog_lock_account").dialog({ + autoOpen: false, + modal: true, + zIndex: 2000 + })); activateDialog($("#dialog_enable_account").dialog({ autoOpen: false, modal: true, @@ -62,7 +67,7 @@ function accountJsonToDetailsTab(jsonObj) { if(jsonObj.state == "enabled") { buildActionLinkForDetailsTab("Disable account", accountActionMap, $actionMenu, accountListAPIMap); - //buildActionLinkForDetailsTab("Lock account", accountActionMap, $actionMenu, accountListAPIMap); + buildActionLinkForDetailsTab("Lock account", accountActionMap, $actionMenu, accountListAPIMap); } else if(jsonObj.state == "disabled" || jsonObj.state == "locked") { buildActionLinkForDetailsTab("Enable account", accountActionMap, $actionMenu, accountListAPIMap); @@ -86,6 +91,16 @@ var accountActionMap = { } } , + "Lock account": { + isAsyncJob: false, + dialogBeforeActionFn : doLockAccount, + inProcessText: "Locking account....", + afterActionSeccessFn: function(jsonObj) { + $("#midmenuItem_"+jsonObj.id).data("jsonObj", jsonObj); + accountJsonToDetailsTab(jsonObj); + } + } + , "Enable account": { isAsyncJob: false, dialogBeforeActionFn : doEnableAccount, @@ -210,6 +225,22 @@ function doDisableAccount($actionLink, listAPIMap, $detailsTab) { }).dialog("open"); } +function doLockAccount($actionLink, listAPIMap, $detailsTab) { + var jsonObj = $detailsTab.data("jsonObj"); + + $("#dialog_lock_account") + .dialog('option', 'buttons', { + "Yes": function() { + $(this).dialog("close"); + var apiCommand = "command=lockAccount&account="+jsonObj.name+"&domainId="+jsonObj.domainid; + doActionToDetailsTab(jsonObj.id, $actionLink, apiCommand, listAPIMap); + }, + "Cancel": function() { + $(this).dialog("close"); + } + }).dialog("open"); +} + function doEnableAccount($actionLink, listAPIMap, $detailsTab) { var jsonObj = $detailsTab.data("jsonObj"); From fc6a551ac7eb3ce0ee50ab89976c73e231798ebf Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sat, 25 Sep 2010 15:41:56 -0700 Subject: [PATCH 007/244] new UI - slowly slide up snapshot after deleting it. --- ui/new/scripts/cloud.core2.volume.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/new/scripts/cloud.core2.volume.js b/ui/new/scripts/cloud.core2.volume.js index ad6b218b802..86203144d97 100644 --- a/ui/new/scripts/cloud.core2.volume.js +++ b/ui/new/scripts/cloud.core2.volume.js @@ -861,8 +861,10 @@ var volumeSnapshotActionMap = { isAsyncJob: true, asyncJobResponse: "deletesnapshotresponse", inProcessText: "Deleting snapshot....", - afterActionSeccessFn: function(id) { - $("#volume_snapshot_"+id).remove(); + afterActionSeccessFn: function(id) { + $("#volume_snapshot_"+id).slideUp("slow", function() { + $(this).remove(); + }); } } , From 9163ffea6764dbb2d0adc9fc18f46e7164f7ec52 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sat, 25 Sep 2010 17:52:02 -0700 Subject: [PATCH 008/244] new UI - dashboard page - populate zone field and pod field. --- ui/new/index.jsp | 2 + ui/new/jsp/dashboard.jsp | 713 +++++++++++++----------- ui/new/scripts/cloud.core2.dashboard.js | 72 +++ ui/new/scripts/cloud.core2.init.js | 4 +- 4 files changed, 453 insertions(+), 338 deletions(-) create mode 100644 ui/new/scripts/cloud.core2.dashboard.js diff --git a/ui/new/index.jsp b/ui/new/index.jsp index 99d3c2a695f..4e38f48bb02 100644 --- a/ui/new/index.jsp +++ b/ui/new/index.jsp @@ -55,6 +55,8 @@ long milliseconds = new Date().getTime(); + + Cloud.com CloudStack diff --git a/ui/new/jsp/dashboard.jsp b/ui/new/jsp/dashboard.jsp index 3f5be1504cf..7574ac5c5de 100644 --- a/ui/new/jsp/dashboard.jsp +++ b/ui/new/jsp/dashboard.jsp @@ -1,337 +1,376 @@ -<%@ page import="java.util.*" %> -<%@ page import="com.cloud.utils.*" %> - -<% - Locale browserLocale = request.getLocale(); - CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale); -%> - - -
- -
- Event
- -

Dashboard -

-
- - -
- - -
-
-
-
System Wide Capacity
-
-
-
- - -
-
-
-
-
-
-

Public IP Addresses

-
-

Used: 2 / 11

-
-
-
-
-
-
-
-
18.2 %
-
-
- -
-
-
-

Private IP Addresses

-
-

Used: 2 / 10

-
-
-
-
-
-
-
-
20 %
-
-
- -
-
-
-

Memory Allocated

-
-

Used: 2.12 GB / 3.22 GB

-
-
-
-
-
-
-
-
65.8 %
-
-
- -
-
-
-

CPU

-
-

Used: 8 MHZ / 9.60 MHZ

-
-
-
-
-
-
-
-
83.3 %
-
-
- -
-
-
-

Primary Storage Allocated

-
-

Used: Used: 4.00 GB / 3.50 TB

-
-
-
-
-
-
-
-
15.2 %
-
-
- -
-
-
-

Primary Storage Used

-
-

Used: 999.17 GB / 1.75 TB

-
-
-
-
-
-
-
-
40.12 %
-
-
- -
-
-
-

Secondary Storage Used

-
-

Used: 599.17 GB / 1.75 TB

-
-
-
-
-
-
-
-
20.12 %
-
-
- -
- - -
-
-
-
General Alerts
-
-
-
-
-
-
-
-
-
-
-
- -
-
Alerts name
-
Details about the alert will appear here
-
- -
-
09/17/2010 14:33:49
-
-
- -
-
-
-
- -
-
Alerts name
-
Details about the alert will appear here
-
- -
-
09/17/2010 14:33:49
-
-
- -
-
-
-
- -
-
Alerts name
-
Details about the alert will appear here
-
- -
-
09/17/2010 14:33:49
-
-
- -
-
-
-
- -
-
Alerts name
-
Details about the alert will appear here
-
- -
-
09/17/2010 14:33:49
-
-
- -
-
-
-
- -
-
Alerts name
-
Details about the alert will appear here
-
- -
-
09/17/2010 14:33:49
-
-
-
- - - -
-
-
-
General Alerts
-
-
-
-
-
-
-
-
-
-
-
- -
-
Alerts name
-
Details about the alert will appear here
-
- -
-
09/17/2010 14:33:49
-
-
- -
-
-
-
- -
-
Alerts name
-
Details about the alert will appear here
-
- -
-
09/17/2010 14:33:49
-
-
- -
-
-
-
- -
-
Alerts name
-
Details about the alert will appear here
-
- -
-
09/17/2010 14:33:49
-
-
- -
-
-
-
- -
-
Alerts name
-
Details about the alert will appear here
-
- -
-
09/17/2010 14:33:49
-
-
- -
-
-
-
- -
-
Alerts name
-
Details about the alert will appear here
-
- -
-
09/17/2010 14:33:49
-
-
-
- -
- - +<%@ page import="java.util.*" %> + +<%@ page import="com.cloud.utils.*" %> + +<% + Locale browserLocale = request.getLocale(); + CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale); +%> + +
+
+ Event
+

+ Dashboard +

+
+ +
+ +
+
+
+
+ System Wide Capacity
+
+
+
+ + +
+
+
+
+
+
+

+ Public IP Addresses

+
+

+ Used: 2 / 11 +

+
+
+
+
+
+
+
+
+
+ 18.2 %
+
+
+
+
+
+

+ Private IP Addresses

+
+

+ Used: 2 / 10 +

+
+
+
+
+
+
+
+
+
+ 20 %
+
+
+
+
+
+

+ Memory Allocated

+
+

+ Used: 2.12 GB / 3.22 GB +

+
+
+
+
+
+
+
+
+
+ 65.8 %
+
+
+
+
+
+

+ CPU

+
+

+ Used: 8 MHZ / 9.60 MHZ +

+
+
+
+
+
+
+
+
+
+ 83.3 %
+
+
+
+
+
+

+ Primary Storage Allocated

+
+

+ Used: Used: 4.00 GB / 3.50 TB +

+
+
+
+
+
+
+
+
+
+ 15.2 %
+
+
+
+
+
+

+ Primary Storage Used

+
+

+ Used: 999.17 GB / 1.75 TB +

+
+
+
+
+
+
+
+
+
+ 40.12 %
+
+
+
+
+
+

+ Secondary Storage Used

+
+

+ Used: 599.17 GB / 1.75 TB +

+
+
+
+
+
+
+
+
+
+ 20.12 %
+
+
+
+ +
+
+
+
+ General Alerts
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Alerts name
+
+ Details about the alert will appear here
+
+
+
+ 09/17/2010 14:33:49
+
+
+
+
+
+
+
+
+
+ Alerts name
+
+ Details about the alert will appear here
+
+
+
+ 09/17/2010 14:33:49
+
+
+
+
+
+
+
+
+
+ Alerts name
+
+ Details about the alert will appear here
+
+
+
+ 09/17/2010 14:33:49
+
+
+
+
+
+
+
+
+
+ Alerts name
+
+ Details about the alert will appear here
+
+
+
+ 09/17/2010 14:33:49
+
+
+
+
+
+
+
+
+
+ Alerts name
+
+ Details about the alert will appear here
+
+
+
+ 09/17/2010 14:33:49
+
+
+
+ +
+
+
+
+ General Alerts
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Alerts name
+
+ Details about the alert will appear here
+
+
+
+ 09/17/2010 14:33:49
+
+
+
+
+
+
+
+
+
+ Alerts name
+
+ Details about the alert will appear here
+
+
+
+ 09/17/2010 14:33:49
+
+
+
+
+
+
+
+
+
+ Alerts name
+
+ Details about the alert will appear here
+
+
+
+ 09/17/2010 14:33:49
+
+
+
+
+
+
+
+
+
+ Alerts name
+
+ Details about the alert will appear here
+
+
+
+ 09/17/2010 14:33:49
+
+
+
+
+
+
+
+
+
+ Alerts name
+
+ Details about the alert will appear here
+
+
+
+ 09/17/2010 14:33:49
+
+
+
+
diff --git a/ui/new/scripts/cloud.core2.dashboard.js b/ui/new/scripts/cloud.core2.dashboard.js new file mode 100644 index 00000000000..a3e07b91e55 --- /dev/null +++ b/ui/new/scripts/cloud.core2.dashboard.js @@ -0,0 +1,72 @@ +function afterLoadDashboardJSP() { + if (isAdmin()) { + var sessionExpired = false; + var zones = null; + var noZones = false; + var noPods = true; + //$("#menutab_dashboard_root, #menutab_vm, #menutab_networking_old, #menutab_networking, #menutab_templates, #menutab_events, #menutab_hosts, #menutab_storage, #menutab_accounts, #menutab_domain").hide(); + + $.ajax({ + data: createURL("command=listZones&available=true"+maxPageSize), + dataType: "json", + async: false, + success: function(json) { + zones = json.listzonesresponse.zone; + var zoneSelect = $("#capacity_zone_select").empty(); + if (zones != null && zones.length > 0) { + for (var i = 0; i < zones.length; i++) { + zoneSelect.append(""); + if(noPods == true) { + $.ajax({ + data: createURL("command=listPods&zoneId="+zones[i].id), + dataType: "json", + async: false, + success: function(json) { + var pods = json.listpodsresponse.pod; + if (pods != null && pods.length > 0) { + noPods = false; + //$("#menutab_dashboard_root, #menutab_vm, #menutab_networking_old, #menutab_networking, #menutab_templates, #menutab_events, #menutab_hosts, #menutab_storage, #menutab_accounts, #menutab_domain").show(); + } + } + }); + } + } + } else { + noZones = true; + } + } + }); + + + $("#capacity_zone_select").bind("change", function(event) { + var zoneId = $(this).val(); + $.ajax({ + data: createURL("command=listPods&zoneId="+zoneId+maxPageSize), + dataType: "json", + async: false, + success: function(json) { + var pods = json.listpodsresponse.pod; + var podSelect = $("#capacity_pod_select").empty(); + if (pods != null && pods.length > 0) { + podSelect.append(""); + for (var i = 0; i < pods.length; i++) { + podSelect.append(""); + } + } + $("#capacity_pod_select").change(); + } + }); + }); + $("#capacity_zone_select").change(); + } + else if (isDomainAdmin()) { + + } + else if(isUser()) { + + } + else { //no role + logout(false); + return; + } +} \ No newline at end of file diff --git a/ui/new/scripts/cloud.core2.init.js b/ui/new/scripts/cloud.core2.init.js index 1ae6b076e3d..4f06e793ef1 100644 --- a/ui/new/scripts/cloud.core2.init.js +++ b/ui/new/scripts/cloud.core2.init.js @@ -96,7 +96,9 @@ $(document).ready(function() { $("#leftmenu_dashboard").bind("click", function(event) { hideMiddleMenu(); - $("#right_panel").load("jsp/dashboard.jsp", function(){}); + $("#right_panel").load("jsp/dashboard.jsp", function(){ + afterLoadDashboardJSP(); + }); return false; }); From 84a2cea56dd013dca3a91d067ae2389dc6fcf6c5 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sat, 25 Sep 2010 23:20:21 -0700 Subject: [PATCH 009/244] new UI - dashboard page - implement system wide capacity area. --- ui/new/jsp/dashboard.jsp | 51 +++--- ui/new/scripts/cloud.core2.dashboard.js | 220 +++++++++++++++++++++++- 2 files changed, 241 insertions(+), 30 deletions(-) diff --git a/ui/new/jsp/dashboard.jsp b/ui/new/jsp/dashboard.jsp index 7574ac5c5de..13f8831fe16 100644 --- a/ui/new/jsp/dashboard.jsp +++ b/ui/new/jsp/dashboard.jsp @@ -20,7 +20,7 @@

-
+
@@ -35,14 +35,14 @@
-
+

Public IP Addresses

- Used: 2 / 11 + Used: N/A

@@ -52,18 +52,17 @@
-
- 18.2 %
+
-
+

Private IP Addresses

- Used: 2 / 10 + Used: N/A

@@ -73,18 +72,17 @@
-
- 20 %
+
-
+

Memory Allocated

- Used: 2.12 GB / 3.22 GB + Used: N/A

@@ -94,18 +92,17 @@
-
- 65.8 %
+
-
+

CPU

- Used: 8 MHZ / 9.60 MHZ + Used: N/A

@@ -115,18 +112,17 @@
-
- 83.3 %
+
-
+

Primary Storage Allocated

- Used: Used: 4.00 GB / 3.50 TB + Used: N/A

@@ -136,18 +132,17 @@
-
- 15.2 %
+
-
+

Primary Storage Used

- Used: 999.17 GB / 1.75 TB + Used: N/A

@@ -157,18 +152,17 @@
-
- 40.12 %
+
-
+

Secondary Storage Used

- Used: 599.17 GB / 1.75 TB + Used: N/A

@@ -178,8 +172,7 @@
-
- 20.12 %
+
diff --git a/ui/new/scripts/cloud.core2.dashboard.js b/ui/new/scripts/cloud.core2.dashboard.js index a3e07b91e55..308351d40b1 100644 --- a/ui/new/scripts/cloud.core2.dashboard.js +++ b/ui/new/scripts/cloud.core2.dashboard.js @@ -1,5 +1,5 @@ function afterLoadDashboardJSP() { - if (isAdmin()) { + if (isAdmin()) { var sessionExpired = false; var zones = null; var noZones = false; @@ -37,6 +37,224 @@ function afterLoadDashboardJSP() { } }); + //??? + if (sessionExpired) + return false; + + if (noZones || noPods) { +// $("#tab_dashboard_user").hide(); +// $("#menutab_role_user").hide(); +// $("#menutab_role_root").show(); +// $("#menutab_configuration").click(); + return false; + } + + var capacities = null; + $.ajax({ + cache: false, + async: false, + data: createURL("command=listCapacity"), + dataType: "json", + success: function(json) { + capacities = json.listcapacityresponse.capacity; + } + }); + + $("#capacity_pod_select").bind("change", function(event) { + // Reset to Defaults + /* + $("#public_ip_total, #storage_total, #storage_alloc_total, #sec_storage_total, #memory_total, #cpu_total, #private_ip_total").text("N/A"); + $("#public_ip_used, #storage_used, #storage_alloc, #sec_storage_used, #memory_used, #cpu_used, #private_ip_used,").attr("style", "width:50%").text("N/A"); + $(".db_bargraph_barbox_safezone").attr("style", "width:0%"); + $(".db_bargraph_barbox_unsafezone").attr("style", "width:0%"); + */ + + var selectedZone = $("#capacity_zone_select option:selected").text(); + var selectedPod = $("#capacity_pod_select").val(); + + var $capacityContainer = $("#system_wide_capacity_container"); + + if (capacities != null && capacities.length > 0) { + for (var i = 0; i < capacities.length; i++) { + var capacity = capacities[i]; + if (capacity.zonename == selectedZone) { + + // Public IPs Addresses + if (capacity.type == "4") { + var $c = $capacityContainer.find("#public_ip_address"); + $c.find("#capacityused").text(capacity.capacityused); + $c.find("#capacitytotal").text(capacity.capacitytotal); + $c.find("#percentused").text(capacity.percentused + "%"); + /* + $("#public_ip_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + capacity.capacityused + " / " + capacity.percentused + "%"); + $("#public_ip_total").text("Total: " + capacity.capacitytotal); + var usedPercentage = parseInt(capacity.percentused); + if (usedPercentage > 70) { + $("#capacity_public_ip .db_bargraph_barbox_safezone").attr("style", "width:70%"); + if(usedPercentage <= 100) + $("#capacity_public_ip .db_bargraph_barbox_unsafezone").attr("style", "width:"+(usedPercentage - 70)+"%"); + else + $("#capacity_public_ip .db_bargraph_barbox_unsafezone").attr("style", "width:30%"); + } else { + $("#capacity_public_ip .db_bargraph_barbox_safezone").attr("style", "width:"+usedPercentage+"%"); + $("#capacity_public_ip .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); + } + */ + } + + // Secondary Storage Used + else if (capacity.type == "6") { + var $c = $capacityContainer.find("#secondary_storage_used"); + $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); + $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); + $c.find("#percentused").text(capacity.percentused + "%"); + /* + $("#sec_storage_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertBytes(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); + $("#sec_storage_total").text("Total: " + convertBytes(parseInt(capacity.capacitytotal))); + var usedPercentage = parseInt(capacity.percentused); + if (usedPercentage > 70) { + $("#capacity_sec_storage .db_bargraph_barbox_safezone").attr("style", "width:70%"); + if(usedPercentage <= 100) + $("#capacity_sec_storage .db_bargraph_barbox_unsafezone").attr("style", "width:"+(usedPercentage - 70)+"%"); + else + $("#capacity_sec_storage .db_bargraph_barbox_unsafezone").attr("style", "width:30%"); + } else { + $("#capacity_sec_storage .db_bargraph_barbox_safezone").attr("style", "width:"+usedPercentage+"%"); + $("#capacity_sec_storage .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); + } + */ + } + + else { + if (capacity.podname == selectedPod) { + // Memory Allocated + if (capacity.type == "0") { + var $c = $capacityContainer.find("#memory_allocated"); + $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); + $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); + $c.find("#percentused").text(capacity.percentused + "%"); + + /* + $("#memory_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertBytes(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); + $("#memory_total").text("Total: " + convertBytes(parseInt(capacity.capacitytotal))); + var usedPercentage = parseInt(capacity.percentused); + if (usedPercentage > 70) { + $("#capacity_memory .db_bargraph_barbox_safezone").attr("style", "width:70%"); + if(usedPercentage <= 100) + $("#capacity_memory .db_bargraph_barbox_unsafezone").attr("style", "width:"+(usedPercentage - 70)+"%"); + else + $("#capacity_memory .db_bargraph_barbox_unsafezone").attr("style", "width:30%"); + } else { + $("#capacity_memory .db_bargraph_barbox_safezone").attr("style", "width:"+usedPercentage+"%"); + $("#capacity_memory .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); + } + */ + } + + // CPU + else if (capacity.type == "1") { + var $c = $capacityContainer.find("#cpu"); + $c.find("#capacityused").text(convertHz(parseInt(capacity.capacityused))); + $c.find("#capacitytotal").text(convertHz(parseInt(capacity.capacitytotal))); + $c.find("#percentused").text(capacity.percentused + "%"); + + /* + $("#cpu_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertHz(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); + $("#cpu_total").text("Total: " + convertHz(parseInt(capacity.capacitytotal))); + var usedPercentage = parseInt(capacity.percentused); + if (usedPercentage > 70) { + $("#capacity_cpu .db_bargraph_barbox_safezone").attr("style", "width:70%"); + if(usedPercentage <= 100) + $("#capacity_cpu .db_bargraph_barbox_unsafezone").attr("style", "width:"+(usedPercentage - 70)+"%"); + else + $("#capacity_cpu .db_bargraph_barbox_unsafezone").attr("style", "width:30%"); + } else { + $("#capacity_cpu .db_bargraph_barbox_safezone").attr("style", "width:"+usedPercentage+"%"); + $("#capacity_cpu .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); + } + */ + } + + // Primary Storage Used + else if (capacity.type == "2") { + var $c = $capacityContainer.find("#primary_storage_used"); + $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); + $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); + $c.find("#percentused").text(capacity.percentused + "%"); + + /* + $("#storage_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertBytes(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); + $("#storage_total").text("Total: " + convertBytes(parseInt(capacity.capacitytotal))); + var usedPercentage = parseInt(capacity.percentused); + if (usedPercentage > 70) { + $("#capacity_storage .db_bargraph_barbox_safezone").attr("style", "width:70%"); + if(usedPercentage <= 100) + $("#capacity_storage .db_bargraph_barbox_unsafezone").attr("style", "width:"+(usedPercentage - 70)+"%"); + else + $("#capacity_storage .db_bargraph_barbox_unsafezone").attr("style", "width:30%"); + } else { + $("#capacity_storage .db_bargraph_barbox_safezone").attr("style", "width:"+usedPercentage+"%"); + $("#capacity_storage .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); + } + */ + } + + // Primary Storage Allocated + else if (capacity.type == "3") { + var $c = $capacityContainer.find("#primary_storage_allocated"); + $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); + $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); + $c.find("#percentused").text(capacity.percentused + "%"); + + /* + $("#storage_alloc").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertBytes(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); + $("#storage_alloc_total").text("Total: " + convertBytes(parseInt(capacity.capacitytotal))); + var usedPercentage = parseInt(capacity.percentused); + if (usedPercentage > 70) { + $("#capacity_storage_alloc .db_bargraph_barbox_safezone").attr("style", "width:70%"); + if(usedPercentage <= 100) + $("#capacity_storage_alloc .db_bargraph_barbox_unsafezone").attr("style", "width:"+(usedPercentage - 70)+"%"); + else + $("#capacity_storage_alloc .db_bargraph_barbox_unsafezone").attr("style", "width:30%"); + } else { + $("#capacity_storage_alloc .db_bargraph_barbox_safezone").attr("style", "width:"+usedPercentage+"%"); + $("#capacity_storage_alloc .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); + } + */ + } + + // Private IP Addresses + else if (capacity.type == "5") { + var $c = $capacityContainer.find("#private_ip_address"); + $c.find("#capacityused").text(capacity.capacityused); + $c.find("#capacitytotal").text(capacity.capacitytotal); + $c.find("#percentused").text(capacity.percentused + "%"); + + /* + $("#private_ip_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + capacity.capacityused + " / " + capacity.percentused + "%"); + $("#private_ip_total").text("Total: " + capacity.capacitytotal); + var usedPercentage = parseInt(capacity.percentused); + if (usedPercentage > 70) { + $("#capacity_private_ip .db_bargraph_barbox_safezone").attr("style", "width:70%"); + if(usedPercentage <= 100) + $("#capacity_private_ip .db_bargraph_barbox_unsafezone").attr("style", "width:"+(usedPercentage - 70)+"%"); + else + $("#capacity_private_ip .db_bargraph_barbox_unsafezone").attr("style", "width:30%"); + } else { + $("#capacity_private_ip .db_bargraph_barbox_safezone").attr("style", "width:"+usedPercentage+"%"); + $("#capacity_private_ip .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); + } + */ + } + + + } + } + } + } + } + }); + //??? $("#capacity_zone_select").bind("change", function(event) { var zoneId = $(this).val(); From 75499ab39303efb68f395be710ca52cafb49bda7 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sat, 25 Sep 2010 23:40:50 -0700 Subject: [PATCH 010/244] new UI - dashboard page - system wide capacity - reset to default everytime pod field or zone field is changed. --- ui/new/scripts/cloud.core2.dashboard.js | 39 +++++++++++++------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/ui/new/scripts/cloud.core2.dashboard.js b/ui/new/scripts/cloud.core2.dashboard.js index 308351d40b1..071673d1145 100644 --- a/ui/new/scripts/cloud.core2.dashboard.js +++ b/ui/new/scripts/cloud.core2.dashboard.js @@ -60,26 +60,28 @@ function afterLoadDashboardJSP() { } }); - $("#capacity_pod_select").bind("change", function(event) { - // Reset to Defaults + $("#capacity_pod_select").bind("change", function(event) { + event.stopPropagation(); + var selectedZone = $("#capacity_zone_select option:selected").text(); + var selectedPod = $("#capacity_pod_select").val(); + + // Reset to Defaults + var $capacityContainer = $("#system_wide_capacity_container"); + var $allSections = $capacityContainer.find("#public_ip_address, #secondary_storage_used, #memory_allocated, #cpu, #primary_storage_used, #primary_storage_allocated, #private_ip_address"); + $allSections.find("#capacityused").text("N"); + $allSections.find("#capacitytotal").text("A"); + $allSections.find("#percentused").text(""); /* - $("#public_ip_total, #storage_total, #storage_alloc_total, #sec_storage_total, #memory_total, #cpu_total, #private_ip_total").text("N/A"); - $("#public_ip_used, #storage_used, #storage_alloc, #sec_storage_used, #memory_used, #cpu_used, #private_ip_used,").attr("style", "width:50%").text("N/A"); $(".db_bargraph_barbox_safezone").attr("style", "width:0%"); $(".db_bargraph_barbox_unsafezone").attr("style", "width:0%"); - */ - - var selectedZone = $("#capacity_zone_select option:selected").text(); - var selectedPod = $("#capacity_pod_select").val(); - - var $capacityContainer = $("#system_wide_capacity_container"); + */ if (capacities != null && capacities.length > 0) { for (var i = 0; i < capacities.length; i++) { var capacity = capacities[i]; if (capacity.zonename == selectedZone) { - // Public IPs Addresses + // ***** Public IPs Addresses ***** if (capacity.type == "4") { var $c = $capacityContainer.find("#public_ip_address"); $c.find("#capacityused").text(capacity.capacityused); @@ -102,7 +104,7 @@ function afterLoadDashboardJSP() { */ } - // Secondary Storage Used + // ***** Secondary Storage Used ***** else if (capacity.type == "6") { var $c = $capacityContainer.find("#secondary_storage_used"); $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); @@ -127,7 +129,7 @@ function afterLoadDashboardJSP() { else { if (capacity.podname == selectedPod) { - // Memory Allocated + // ***** Memory Allocated ***** if (capacity.type == "0") { var $c = $capacityContainer.find("#memory_allocated"); $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); @@ -151,7 +153,7 @@ function afterLoadDashboardJSP() { */ } - // CPU + // ***** CPU ***** else if (capacity.type == "1") { var $c = $capacityContainer.find("#cpu"); $c.find("#capacityused").text(convertHz(parseInt(capacity.capacityused))); @@ -175,7 +177,7 @@ function afterLoadDashboardJSP() { */ } - // Primary Storage Used + // ***** Primary Storage Used ***** else if (capacity.type == "2") { var $c = $capacityContainer.find("#primary_storage_used"); $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); @@ -199,7 +201,7 @@ function afterLoadDashboardJSP() { */ } - // Primary Storage Allocated + // ***** Primary Storage Allocated ***** else if (capacity.type == "3") { var $c = $capacityContainer.find("#primary_storage_allocated"); $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); @@ -223,7 +225,7 @@ function afterLoadDashboardJSP() { */ } - // Private IP Addresses + // ***** Private IP Addresses ***** else if (capacity.type == "5") { var $c = $capacityContainer.find("#private_ip_address"); $c.find("#capacityused").text(capacity.capacityused); @@ -245,8 +247,7 @@ function afterLoadDashboardJSP() { $("#capacity_private_ip .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); } */ - } - + } } } From 23641a4398a2dc90f4012e6f358ce0c0d2596baa Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sun, 26 Sep 2010 11:57:32 -0700 Subject: [PATCH 011/244] new UI - dashboard - implement bar chart. --- ui/new/jsp/dashboard.jsp | 14 +++---- ui/new/scripts/cloud.core2.dashboard.js | 54 ++++++++++++++----------- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/ui/new/jsp/dashboard.jsp b/ui/new/jsp/dashboard.jsp index 13f8831fe16..11518f83af4 100644 --- a/ui/new/jsp/dashboard.jsp +++ b/ui/new/jsp/dashboard.jsp @@ -48,7 +48,7 @@
-
+
@@ -68,7 +68,7 @@
-
+
@@ -88,7 +88,7 @@
-
+
@@ -108,7 +108,7 @@
-
+
@@ -128,7 +128,7 @@
-
+
@@ -148,7 +148,7 @@
-
+
@@ -168,7 +168,7 @@
-
+
diff --git a/ui/new/scripts/cloud.core2.dashboard.js b/ui/new/scripts/cloud.core2.dashboard.js index 071673d1145..a5a59909826 100644 --- a/ui/new/scripts/cloud.core2.dashboard.js +++ b/ui/new/scripts/cloud.core2.dashboard.js @@ -67,10 +67,11 @@ function afterLoadDashboardJSP() { // Reset to Defaults var $capacityContainer = $("#system_wide_capacity_container"); - var $allSections = $capacityContainer.find("#public_ip_address, #secondary_storage_used, #memory_allocated, #cpu, #primary_storage_used, #primary_storage_allocated, #private_ip_address"); - $allSections.find("#capacityused").text("N"); - $allSections.find("#capacitytotal").text("A"); - $allSections.find("#percentused").text(""); + //var $allSections = $capacityContainer.find("#public_ip_address, #secondary_storage_used, #memory_allocated, #cpu, #primary_storage_used, #primary_storage_allocated, #private_ip_address"); + $capacityContainer.find("#capacityused").text("N"); + $capacityContainer.find("#capacitytotal").text("A"); + $capacityContainer.find("#percentused").text(""); + $capacityContainer.find("#bar_chart").removeClass().addClass("db_barbox").css("width", "0%"); /* $(".db_bargraph_barbox_safezone").attr("style", "width:0%"); $(".db_bargraph_barbox_unsafezone").attr("style", "width:0%"); @@ -85,8 +86,8 @@ function afterLoadDashboardJSP() { if (capacity.type == "4") { var $c = $capacityContainer.find("#public_ip_address"); $c.find("#capacityused").text(capacity.capacityused); - $c.find("#capacitytotal").text(capacity.capacitytotal); - $c.find("#percentused").text(capacity.percentused + "%"); + $c.find("#capacitytotal").text(capacity.capacitytotal); + capacityBarChart($c, capacity.percentused); /* $("#public_ip_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + capacity.capacityused + " / " + capacity.percentused + "%"); $("#public_ip_total").text("Total: " + capacity.capacitytotal); @@ -108,8 +109,8 @@ function afterLoadDashboardJSP() { else if (capacity.type == "6") { var $c = $capacityContainer.find("#secondary_storage_used"); $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); - $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); - $c.find("#percentused").text(capacity.percentused + "%"); + $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); + capacityBarChart($c, capacity.percentused); /* $("#sec_storage_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertBytes(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); $("#sec_storage_total").text("Total: " + convertBytes(parseInt(capacity.capacitytotal))); @@ -133,9 +134,8 @@ function afterLoadDashboardJSP() { if (capacity.type == "0") { var $c = $capacityContainer.find("#memory_allocated"); $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); - $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); - $c.find("#percentused").text(capacity.percentused + "%"); - + $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); + capacityBarChart($c, capacity.percentused); /* $("#memory_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertBytes(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); $("#memory_total").text("Total: " + convertBytes(parseInt(capacity.capacitytotal))); @@ -157,9 +157,8 @@ function afterLoadDashboardJSP() { else if (capacity.type == "1") { var $c = $capacityContainer.find("#cpu"); $c.find("#capacityused").text(convertHz(parseInt(capacity.capacityused))); - $c.find("#capacitytotal").text(convertHz(parseInt(capacity.capacitytotal))); - $c.find("#percentused").text(capacity.percentused + "%"); - + $c.find("#capacitytotal").text(convertHz(parseInt(capacity.capacitytotal))); + capacityBarChart($c, capacity.percentused); /* $("#cpu_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertHz(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); $("#cpu_total").text("Total: " + convertHz(parseInt(capacity.capacitytotal))); @@ -181,9 +180,8 @@ function afterLoadDashboardJSP() { else if (capacity.type == "2") { var $c = $capacityContainer.find("#primary_storage_used"); $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); - $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); - $c.find("#percentused").text(capacity.percentused + "%"); - + $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); + capacityBarChart($c, capacity.percentused); /* $("#storage_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertBytes(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); $("#storage_total").text("Total: " + convertBytes(parseInt(capacity.capacitytotal))); @@ -205,9 +203,8 @@ function afterLoadDashboardJSP() { else if (capacity.type == "3") { var $c = $capacityContainer.find("#primary_storage_allocated"); $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); - $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); - $c.find("#percentused").text(capacity.percentused + "%"); - + $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); + capacityBarChart($c, capacity.percentused); /* $("#storage_alloc").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertBytes(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); $("#storage_alloc_total").text("Total: " + convertBytes(parseInt(capacity.capacitytotal))); @@ -229,9 +226,8 @@ function afterLoadDashboardJSP() { else if (capacity.type == "5") { var $c = $capacityContainer.find("#private_ip_address"); $c.find("#capacityused").text(capacity.capacityused); - $c.find("#capacitytotal").text(capacity.capacitytotal); - $c.find("#percentused").text(capacity.percentused + "%"); - + $c.find("#capacitytotal").text(capacity.capacitytotal); + capacityBarChart($c, capacity.percentused); /* $("#private_ip_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + capacity.capacityused + " / " + capacity.percentused + "%"); $("#private_ip_total").text("Total: " + capacity.capacitytotal); @@ -288,4 +284,16 @@ function afterLoadDashboardJSP() { logout(false); return; } +} + +function capacityBarChart($capacity, percentused) { + var percentused2 = (percentused + "%"); + $capacity.find("#percentused").text(percentused2); + + if (percentused <= 60) + $capacity.find("#bar_chart").removeClass().addClass("db_barbox low").css("width", percentused2); + else if (percentused > 60 && percentused <= 80 ) + $capacity.find("#bar_chart").removeClass().addClass("db_barbox mid").css("width", percentused2); + else if (percentused > 80 ) + $capacity.find("#bar_chart").removeClass().addClass("db_barbox high").css("width", percentused2); } \ No newline at end of file From bea86479d8ac3cf27a44b6d88c882a4a1da2b585 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sun, 26 Sep 2010 14:37:32 -0700 Subject: [PATCH 012/244] new UI - dashboard - implement General Alert section. --- ui/new/jsp/dashboard.jsp | 99 +++----------- ui/new/scripts/cloud.core2.dashboard.js | 163 ++++++------------------ 2 files changed, 55 insertions(+), 207 deletions(-) diff --git a/ui/new/jsp/dashboard.jsp b/ui/new/jsp/dashboard.jsp index 11518f83af4..9f0efcac724 100644 --- a/ui/new/jsp/dashboard.jsp +++ b/ui/new/jsp/dashboard.jsp @@ -189,87 +189,12 @@
- -
-
-
-
+
+
+
+ No Recent Alerts
-
-
- Alerts name
-
- Details about the alert will appear here
-
-
-
- 09/17/2010 14:33:49
-
-
-
-
-
-
-
-
-
- Alerts name
-
- Details about the alert will appear here
-
-
-
- 09/17/2010 14:33:49
-
-
-
-
-
-
-
-
-
- Alerts name
-
- Details about the alert will appear here
-
-
-
- 09/17/2010 14:33:49
-
-
-
-
-
-
-
-
-
- Alerts name
-
- Details about the alert will appear here
-
-
-
- 09/17/2010 14:33:49
-
-
-
-
-
-
-
-
-
- Alerts name
-
- Details about the alert will appear here
-
-
-
- 09/17/2010 14:33:49
-
-
+
@@ -367,3 +292,17 @@
+ + diff --git a/ui/new/scripts/cloud.core2.dashboard.js b/ui/new/scripts/cloud.core2.dashboard.js index a5a59909826..07226ffaf34 100644 --- a/ui/new/scripts/cloud.core2.dashboard.js +++ b/ui/new/scripts/cloud.core2.dashboard.js @@ -36,8 +36,7 @@ function afterLoadDashboardJSP() { } } }); - - //??? + if (sessionExpired) return false; @@ -67,42 +66,21 @@ function afterLoadDashboardJSP() { // Reset to Defaults var $capacityContainer = $("#system_wide_capacity_container"); - //var $allSections = $capacityContainer.find("#public_ip_address, #secondary_storage_used, #memory_allocated, #cpu, #primary_storage_used, #primary_storage_allocated, #private_ip_address"); - $capacityContainer.find("#capacityused").text("N"); + $capacityContainer.find("#capacityused").text("N"); $capacityContainer.find("#capacitytotal").text("A"); $capacityContainer.find("#percentused").text(""); $capacityContainer.find("#bar_chart").removeClass().addClass("db_barbox").css("width", "0%"); - /* - $(".db_bargraph_barbox_safezone").attr("style", "width:0%"); - $(".db_bargraph_barbox_unsafezone").attr("style", "width:0%"); - */ - + if (capacities != null && capacities.length > 0) { for (var i = 0; i < capacities.length; i++) { var capacity = capacities[i]; - if (capacity.zonename == selectedZone) { - + if (capacity.zonename == selectedZone) { // ***** Public IPs Addresses ***** if (capacity.type == "4") { var $c = $capacityContainer.find("#public_ip_address"); $c.find("#capacityused").text(capacity.capacityused); $c.find("#capacitytotal").text(capacity.capacitytotal); - capacityBarChart($c, capacity.percentused); - /* - $("#public_ip_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + capacity.capacityused + " / " + capacity.percentused + "%"); - $("#public_ip_total").text("Total: " + capacity.capacitytotal); - var usedPercentage = parseInt(capacity.percentused); - if (usedPercentage > 70) { - $("#capacity_public_ip .db_bargraph_barbox_safezone").attr("style", "width:70%"); - if(usedPercentage <= 100) - $("#capacity_public_ip .db_bargraph_barbox_unsafezone").attr("style", "width:"+(usedPercentage - 70)+"%"); - else - $("#capacity_public_ip .db_bargraph_barbox_unsafezone").attr("style", "width:30%"); - } else { - $("#capacity_public_ip .db_bargraph_barbox_safezone").attr("style", "width:"+usedPercentage+"%"); - $("#capacity_public_ip .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); - } - */ + capacityBarChart($c, capacity.percentused); } // ***** Secondary Storage Used ***** @@ -110,22 +88,7 @@ function afterLoadDashboardJSP() { var $c = $capacityContainer.find("#secondary_storage_used"); $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); - capacityBarChart($c, capacity.percentused); - /* - $("#sec_storage_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertBytes(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); - $("#sec_storage_total").text("Total: " + convertBytes(parseInt(capacity.capacitytotal))); - var usedPercentage = parseInt(capacity.percentused); - if (usedPercentage > 70) { - $("#capacity_sec_storage .db_bargraph_barbox_safezone").attr("style", "width:70%"); - if(usedPercentage <= 100) - $("#capacity_sec_storage .db_bargraph_barbox_unsafezone").attr("style", "width:"+(usedPercentage - 70)+"%"); - else - $("#capacity_sec_storage .db_bargraph_barbox_unsafezone").attr("style", "width:30%"); - } else { - $("#capacity_sec_storage .db_bargraph_barbox_safezone").attr("style", "width:"+usedPercentage+"%"); - $("#capacity_sec_storage .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); - } - */ + capacityBarChart($c, capacity.percentused); } else { @@ -135,22 +98,7 @@ function afterLoadDashboardJSP() { var $c = $capacityContainer.find("#memory_allocated"); $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); - capacityBarChart($c, capacity.percentused); - /* - $("#memory_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertBytes(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); - $("#memory_total").text("Total: " + convertBytes(parseInt(capacity.capacitytotal))); - var usedPercentage = parseInt(capacity.percentused); - if (usedPercentage > 70) { - $("#capacity_memory .db_bargraph_barbox_safezone").attr("style", "width:70%"); - if(usedPercentage <= 100) - $("#capacity_memory .db_bargraph_barbox_unsafezone").attr("style", "width:"+(usedPercentage - 70)+"%"); - else - $("#capacity_memory .db_bargraph_barbox_unsafezone").attr("style", "width:30%"); - } else { - $("#capacity_memory .db_bargraph_barbox_safezone").attr("style", "width:"+usedPercentage+"%"); - $("#capacity_memory .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); - } - */ + capacityBarChart($c, capacity.percentused); } // ***** CPU ***** @@ -158,22 +106,7 @@ function afterLoadDashboardJSP() { var $c = $capacityContainer.find("#cpu"); $c.find("#capacityused").text(convertHz(parseInt(capacity.capacityused))); $c.find("#capacitytotal").text(convertHz(parseInt(capacity.capacitytotal))); - capacityBarChart($c, capacity.percentused); - /* - $("#cpu_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertHz(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); - $("#cpu_total").text("Total: " + convertHz(parseInt(capacity.capacitytotal))); - var usedPercentage = parseInt(capacity.percentused); - if (usedPercentage > 70) { - $("#capacity_cpu .db_bargraph_barbox_safezone").attr("style", "width:70%"); - if(usedPercentage <= 100) - $("#capacity_cpu .db_bargraph_barbox_unsafezone").attr("style", "width:"+(usedPercentage - 70)+"%"); - else - $("#capacity_cpu .db_bargraph_barbox_unsafezone").attr("style", "width:30%"); - } else { - $("#capacity_cpu .db_bargraph_barbox_safezone").attr("style", "width:"+usedPercentage+"%"); - $("#capacity_cpu .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); - } - */ + capacityBarChart($c, capacity.percentused); } // ***** Primary Storage Used ***** @@ -181,22 +114,7 @@ function afterLoadDashboardJSP() { var $c = $capacityContainer.find("#primary_storage_used"); $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); - capacityBarChart($c, capacity.percentused); - /* - $("#storage_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertBytes(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); - $("#storage_total").text("Total: " + convertBytes(parseInt(capacity.capacitytotal))); - var usedPercentage = parseInt(capacity.percentused); - if (usedPercentage > 70) { - $("#capacity_storage .db_bargraph_barbox_safezone").attr("style", "width:70%"); - if(usedPercentage <= 100) - $("#capacity_storage .db_bargraph_barbox_unsafezone").attr("style", "width:"+(usedPercentage - 70)+"%"); - else - $("#capacity_storage .db_bargraph_barbox_unsafezone").attr("style", "width:30%"); - } else { - $("#capacity_storage .db_bargraph_barbox_safezone").attr("style", "width:"+usedPercentage+"%"); - $("#capacity_storage .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); - } - */ + capacityBarChart($c, capacity.percentused); } // ***** Primary Storage Allocated ***** @@ -204,22 +122,7 @@ function afterLoadDashboardJSP() { var $c = $capacityContainer.find("#primary_storage_allocated"); $c.find("#capacityused").text(convertBytes(parseInt(capacity.capacityused))); $c.find("#capacitytotal").text(convertBytes(parseInt(capacity.capacitytotal))); - capacityBarChart($c, capacity.percentused); - /* - $("#storage_alloc").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + convertBytes(parseInt(capacity.capacityused)) + " / " + capacity.percentused + "%"); - $("#storage_alloc_total").text("Total: " + convertBytes(parseInt(capacity.capacitytotal))); - var usedPercentage = parseInt(capacity.percentused); - if (usedPercentage > 70) { - $("#capacity_storage_alloc .db_bargraph_barbox_safezone").attr("style", "width:70%"); - if(usedPercentage <= 100) - $("#capacity_storage_alloc .db_bargraph_barbox_unsafezone").attr("style", "width:"+(usedPercentage - 70)+"%"); - else - $("#capacity_storage_alloc .db_bargraph_barbox_unsafezone").attr("style", "width:30%"); - } else { - $("#capacity_storage_alloc .db_bargraph_barbox_safezone").attr("style", "width:"+usedPercentage+"%"); - $("#capacity_storage_alloc .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); - } - */ + capacityBarChart($c, capacity.percentused); } // ***** Private IP Addresses ***** @@ -227,32 +130,15 @@ function afterLoadDashboardJSP() { var $c = $capacityContainer.find("#private_ip_address"); $c.find("#capacityused").text(capacity.capacityused); $c.find("#capacitytotal").text(capacity.capacitytotal); - capacityBarChart($c, capacity.percentused); - /* - $("#private_ip_used").attr("style", "width: " + ((parseFloat(capacity.percentused) < 50) ? "50%" : capacity.percentused + "%")).text("Used: " + capacity.capacityused + " / " + capacity.percentused + "%"); - $("#private_ip_total").text("Total: " + capacity.capacitytotal); - var usedPercentage = parseInt(capacity.percentused); - if (usedPercentage > 70) { - $("#capacity_private_ip .db_bargraph_barbox_safezone").attr("style", "width:70%"); - if(usedPercentage <= 100) - $("#capacity_private_ip .db_bargraph_barbox_unsafezone").attr("style", "width:"+(usedPercentage - 70)+"%"); - else - $("#capacity_private_ip .db_bargraph_barbox_unsafezone").attr("style", "width:30%"); - } else { - $("#capacity_private_ip .db_bargraph_barbox_safezone").attr("style", "width:"+usedPercentage+"%"); - $("#capacity_private_ip .db_bargraph_barbox_unsafezone").attr("style", "width:0%"); - } - */ - } - + capacityBarChart($c, capacity.percentused); + } } } } } } }); - //??? - + $("#capacity_zone_select").bind("change", function(event) { var zoneId = $(this).val(); $.ajax({ @@ -273,6 +159,29 @@ function afterLoadDashboardJSP() { }); }); $("#capacity_zone_select").change(); + + //??? + // Show Recent Alerts + $.ajax({ + data: createURL("command=listAlerts"), + dataType: "json", + success: function(json) { + var alerts = json.listalertsresponse.alert; + if (alerts != null && alerts.length > 0) { + var alertGrid = $("#alert_grid_content").empty(); + var length = (alerts.length>=5) ? 5 : alerts.length; + var $alertTemplate = $("#alert_template"); + for (var i = 0; i < length; i++) { + var template = $alertTemplate.clone(true); + template.find("#type").text(toAlertType(alerts[i].type)); + template.find("#descripton").append(sanitizeXSS(alerts[i].description)); + setDateField(alerts[i].sent, template.find("#sent")); + alertGrid.append(template.show()); + } + } + } + }); + //??? } else if (isDomainAdmin()) { From 0a03ca672124bb34d67c4bb537d2fad65f66e6c7 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sun, 26 Sep 2010 14:48:46 -0700 Subject: [PATCH 013/244] new UI - dashboard - implement Hosts Alerts section. --- ui/new/jsp/dashboard.jsp | 91 +++---------------------- ui/new/scripts/cloud.core2.dashboard.js | 34 +++++++-- 2 files changed, 35 insertions(+), 90 deletions(-) diff --git a/ui/new/jsp/dashboard.jsp b/ui/new/jsp/dashboard.jsp index 9f0efcac724..ff01f151cb7 100644 --- a/ui/new/jsp/dashboard.jsp +++ b/ui/new/jsp/dashboard.jsp @@ -196,12 +196,12 @@ - +
- General Alerts
+ Hosts Alerts
@@ -209,87 +209,12 @@
- -
-
-
-
+
+
+
+ No Recent Alerts
-
-
- Alerts name
-
- Details about the alert will appear here
-
-
-
- 09/17/2010 14:33:49
-
-
-
-
-
-
-
-
-
- Alerts name
-
- Details about the alert will appear here
-
-
-
- 09/17/2010 14:33:49
-
-
-
-
-
-
-
-
-
- Alerts name
-
- Details about the alert will appear here
-
-
-
- 09/17/2010 14:33:49
-
-
-
-
-
-
-
-
-
- Alerts name
-
- Details about the alert will appear here
-
-
-
- 09/17/2010 14:33:49
-
-
-
-
-
-
-
-
-
- Alerts name
-
- Details about the alert will appear here
-
-
-
- 09/17/2010 14:33:49
-
-
+
@@ -303,6 +228,6 @@
-
+
diff --git a/ui/new/scripts/cloud.core2.dashboard.js b/ui/new/scripts/cloud.core2.dashboard.js index 07226ffaf34..78d00e576d4 100644 --- a/ui/new/scripts/cloud.core2.dashboard.js +++ b/ui/new/scripts/cloud.core2.dashboard.js @@ -159,9 +159,10 @@ function afterLoadDashboardJSP() { }); }); $("#capacity_zone_select").change(); + + // General Alerts + var $alertTemplate = $("#alert_template"); - //??? - // Show Recent Alerts $.ajax({ data: createURL("command=listAlerts"), dataType: "json", @@ -169,19 +170,38 @@ function afterLoadDashboardJSP() { var alerts = json.listalertsresponse.alert; if (alerts != null && alerts.length > 0) { var alertGrid = $("#alert_grid_content").empty(); - var length = (alerts.length>=5) ? 5 : alerts.length; - var $alertTemplate = $("#alert_template"); + var length = (alerts.length>=5) ? 5 : alerts.length; for (var i = 0; i < length; i++) { var template = $alertTemplate.clone(true); template.find("#type").text(toAlertType(alerts[i].type)); - template.find("#descripton").append(sanitizeXSS(alerts[i].description)); - setDateField(alerts[i].sent, template.find("#sent")); + template.find("#description").append(fromdb(alerts[i].description)); + setDateField(alerts[i].sent, template.find("#date")); alertGrid.append(template.show()); } } } }); - //??? + + // Hosts Alerts + $.ajax({ + data: createURL("command=listHosts&state=Alert"), + dataType: "json", + success: function(json) { + var alerts = json.listhostsresponse.host; + if (alerts != null && alerts.length > 0) { + var alertGrid = $("#host_alert_grid_content").empty(); + var length = (alerts.length>=4) ? 4 : alerts.length; + for (var i = 0; i < length; i++) { + var template = $alertTemplate.clone(true); + template.find("#type").text("Host - Alert State"); + template.find("#description").append("Host - " + fromdb(alerts[i].name) + " has been detected in Alert state."); + setDateField(alerts[i].disconnected, template.find("#date")); + alertGrid.append(template.show()); + } + } + } + }); + } else if (isDomainAdmin()) { From 26fc22160c4fb54ff5c6fb486f5df526ef8583f9 Mon Sep 17 00:00:00 2001 From: nit Date: Mon, 27 Sep 2010 12:10:49 +0530 Subject: [PATCH 014/244] bug 5871: Correcting the ostypeid and ostypename returned by the listIsos --- server/src/com/cloud/api/commands/ListIsosCmd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/com/cloud/api/commands/ListIsosCmd.java b/server/src/com/cloud/api/commands/ListIsosCmd.java index 26c3fdbd1ec..7f1c97fde25 100644 --- a/server/src/com/cloud/api/commands/ListIsosCmd.java +++ b/server/src/com/cloud/api/commands/ListIsosCmd.java @@ -192,7 +192,7 @@ public class ListIsosCmd extends BaseCmd { isoData.add(new Pair(BaseCmd.Properties.CROSS_ZONES.getName(), Boolean.valueOf(iso.isCrossZones()).toString())); GuestOS os = getManagementServer().findGuestOSById(iso.getGuestOSId()); - if(os != null) { + if(os != null && !iso.getName().startsWith("xs-tools")) { isoData.add(new Pair(BaseCmd.Properties.OS_TYPE_ID.getName(), os.getId())); isoData.add(new Pair(BaseCmd.Properties.OS_TYPE_NAME.getName(), os.getDisplayName())); } else { From 6e4fa7fcd1ba1c3217bf18ce66a9c47fd17088e2 Mon Sep 17 00:00:00 2001 From: kishan Date: Mon, 27 Sep 2010 16:26:56 +0530 Subject: [PATCH 015/244] bug 6176: Included domR name in networkUsage command status 6176: resolved fixed --- core/src/com/cloud/agent/api/NetworkUsageCommand.java | 8 +++++++- server/src/com/cloud/network/NetworkManagerImpl.java | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/com/cloud/agent/api/NetworkUsageCommand.java b/core/src/com/cloud/agent/api/NetworkUsageCommand.java index c9c88279f6d..5ecf9741959 100644 --- a/core/src/com/cloud/agent/api/NetworkUsageCommand.java +++ b/core/src/com/cloud/agent/api/NetworkUsageCommand.java @@ -20,20 +20,26 @@ package com.cloud.agent.api; public class NetworkUsageCommand extends Command { private String privateIP; + private String domRName; protected NetworkUsageCommand() { } - public NetworkUsageCommand(String privateIP) + public NetworkUsageCommand(String privateIP, String domRName) { this.privateIP = privateIP; + this.domRName = domRName; } public String getPrivateIP() { return privateIP; } + public String getDomRName() { + return domRName; + } + /** * {@inheritDoc} */ diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index a86194ab76d..5dd5ec4ec74 100644 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -2559,7 +2559,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager for (DomainRouterVO router : routers) { String privateIP = router.getPrivateIpAddress(); if(privateIP != null){ - final NetworkUsageCommand usageCmd = new NetworkUsageCommand(privateIP); + final NetworkUsageCommand usageCmd = new NetworkUsageCommand(privateIP, router.getName()); final NetworkUsageAnswer answer = (NetworkUsageAnswer)_agentMgr.easySend(router.getHostId(), usageCmd); if(answer != null){ Transaction txn = Transaction.open(Transaction.CLOUD_DB); From ec4755a60e5d70fb18d39cf2b1938a9ad96e6648 Mon Sep 17 00:00:00 2001 From: kishan Date: Mon, 27 Sep 2010 16:57:31 +0530 Subject: [PATCH 016/244] bug 6123: Include last id in the vlan range status 6123: resolved fixed --- core/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java | 2 +- .../src/com/cloud/configuration/ConfigurationManagerImpl.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java b/core/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java index 43ba290d2ea..bedc5d30941 100755 --- a/core/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java +++ b/core/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java @@ -60,7 +60,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase Date: Mon, 27 Sep 2010 17:22:12 +0530 Subject: [PATCH 017/244] bug 4177: registerTemplate/registerIso commands would start accepting account/domainId params. status 4177: resolved fixed --- .../com/cloud/server/ManagementServer.java | 5 ++- .../cloud/api/commands/RegisterIsoCmd.java | 44 ++++++++++++------ .../api/commands/RegisterTemplateCmd.java | 45 ++++++++++++------- .../cloud/server/ManagementServerImpl.java | 16 +++---- .../com/cloud/template/TemplateManager.java | 3 +- .../cloud/template/TemplateManagerImpl.java | 11 ++--- 6 files changed, 76 insertions(+), 48 deletions(-) mode change 100644 => 100755 server/src/com/cloud/api/commands/RegisterIsoCmd.java mode change 100644 => 100755 server/src/com/cloud/api/commands/RegisterTemplateCmd.java diff --git a/core/src/com/cloud/server/ManagementServer.java b/core/src/com/cloud/server/ManagementServer.java index f3973baa180..6ec6cc889be 100755 --- a/core/src/com/cloud/server/ManagementServer.java +++ b/core/src/com/cloud/server/ManagementServer.java @@ -1174,7 +1174,8 @@ public interface ManagementServer { /** * Creates a template by downloading to all zones - * @param createdBy userId of the template creater + * @param createdBy userId of the template creator + * @param accountId accountId under which the template will get created. * @param zoneId optional zoneId. if null, assumed to be all zones * @param name - user specified name for the template * @param displayText user readable name. @@ -1194,7 +1195,7 @@ public interface ManagementServer { * @throws ResourceAllocationException * @throws InvalidParameterValueException */ - Long createTemplate(long createdBy, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, String format, String diskType, String url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable) throws IllegalArgumentException, ResourceAllocationException, InvalidParameterValueException; + Long createTemplate(long createdBy, long accountId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, String format, String diskType, String url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable) throws IllegalArgumentException, ResourceAllocationException, InvalidParameterValueException; /** * Deletes a template from all secondary storage servers diff --git a/server/src/com/cloud/api/commands/RegisterIsoCmd.java b/server/src/com/cloud/api/commands/RegisterIsoCmd.java old mode 100644 new mode 100755 index f6de4345ccd..29917fe3ed1 --- a/server/src/com/cloud/api/commands/RegisterIsoCmd.java +++ b/server/src/com/cloud/api/commands/RegisterIsoCmd.java @@ -45,8 +45,10 @@ public class RegisterIsoCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.NAME, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.DISPLAY_TEXT, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.URL, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.IS_FEATURED, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.OS_TYPE_ID, Boolean.TRUE)); @@ -65,7 +67,9 @@ public class RegisterIsoCmd extends BaseCmd { @Override public List> execute(Map params) { - Account account = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName()); + Account account = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName()); + String accountName = (String)params.get(BaseCmd.Properties.ACCOUNT.getName()); + Long domainId = (Long)params.get(BaseCmd.Properties.DOMAIN_ID.getName()); Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName()); String name = (String)params.get(BaseCmd.Properties.NAME.getName()); String displayText = (String)params.get(BaseCmd.Properties.DISPLAY_TEXT.getName()); @@ -84,19 +88,31 @@ public class RegisterIsoCmd extends BaseCmd { zoneId = null; } - long accountId = 1L; // default to system account - if (account != null) { - accountId = account.getId(); - } - - Account accountObj; - if (account == null) { - accountObj = getManagementServer().findAccountById(accountId); + Long accountId = null; + if ((account == null) || isAdmin(account.getType())) { + if (domainId != null) { + if ((account != null) && !getManagementServer().isChildDomain(account.getDomainId(), domainId)) { + throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid domain id (" + domainId + ") "); + } + if (accountName != null) { + Account userAccount = getManagementServer().findActiveAccount(accountName, domainId); + if (userAccount == null) { + throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to find account " + accountName + " in domain " + domainId); + } + accountId = userAccount.getId(); + } + } else { + accountId = ((account != null) ? account.getId() : null); + } } else { - accountObj = account; + accountId = account.getId(); + } + + if (accountId == null) { + throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "No valid account specified for registering ISO."); } - boolean isAdmin = (accountObj.getType() == Account.ACCOUNT_TYPE_ADMIN); + boolean isAdmin = getManagementServer().findAccountById(accountId).getType() == Account.ACCOUNT_TYPE_ADMIN; if (!isAdmin && zoneId == null) { throw new ServerApiException(BaseCmd.PARAM_ERROR, "Please specify a valid zone Id."); @@ -132,7 +148,7 @@ public class RegisterIsoCmd extends BaseCmd { Long templateId; try { - templateId = getManagementServer().createTemplate(userId, zoneId, name, displayText, isPublic.booleanValue(), featured.booleanValue(), ImageFormat.ISO.toString(), FileSystem.cdfs.toString(), url, null, true, 64 /*bits*/, false, guestOSId, bootable); + templateId = getManagementServer().createTemplate(userId, accountId, zoneId, name, displayText, isPublic.booleanValue(), featured.booleanValue(), ImageFormat.ISO.toString(), FileSystem.cdfs.toString(), url, null, true, 64 /*bits*/, false, guestOSId, bootable); } catch (Exception ex) { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); } diff --git a/server/src/com/cloud/api/commands/RegisterTemplateCmd.java b/server/src/com/cloud/api/commands/RegisterTemplateCmd.java old mode 100644 new mode 100755 index c3a8439ec13..01a9150e1a0 --- a/server/src/com/cloud/api/commands/RegisterTemplateCmd.java +++ b/server/src/com/cloud/api/commands/RegisterTemplateCmd.java @@ -51,8 +51,10 @@ public class RegisterTemplateCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.REQUIRES_HVM, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.IS_PUBLIC, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.IS_FEATURED, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); + s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.FORMAT, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.OS_TYPE_ID, Boolean.TRUE)); s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); @@ -71,7 +73,9 @@ public class RegisterTemplateCmd extends BaseCmd { @Override public List> execute(Map params) { - Account account = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName()); + Account account = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName()); + String accountName = (String)params.get(BaseCmd.Properties.ACCOUNT.getName()); + Long domainId = (Long)params.get(BaseCmd.Properties.DOMAIN_ID.getName()); Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName()); String name = (String)params.get(BaseCmd.Properties.NAME.getName()); String displayText = (String)params.get(BaseCmd.Properties.DISPLAY_TEXT.getName()); @@ -103,20 +107,31 @@ public class RegisterTemplateCmd extends BaseCmd { zoneId = null; } - long accountId = 1L; // default to system account - if (account != null) { + Long accountId = null; + if ((account == null) || isAdmin(account.getType())) { + if (domainId != null) { + if ((account != null) && !getManagementServer().isChildDomain(account.getDomainId(), domainId)) { + throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid domain id (" + domainId + ") "); + } + if (accountName != null) { + Account userAccount = getManagementServer().findActiveAccount(accountName, domainId); + if (userAccount == null) { + throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to find account " + accountName + " in domain " + domainId); + } + accountId = userAccount.getId(); + } + } else { + accountId = ((account != null) ? account.getId() : null); + } + } else { accountId = account.getId(); } - - Account accountObj; - if (account == null) { - accountObj = getManagementServer().findAccountById(accountId); - } else { - accountObj = account; + + if (accountId == null) { + throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "No valid account specified for registering template."); } - boolean isAdmin = (accountObj.getType() == Account.ACCOUNT_TYPE_ADMIN); - + boolean isAdmin = getManagementServer().findAccountById(accountId).getType() == Account.ACCOUNT_TYPE_ADMIN; if (!isAdmin && zoneId == null) { throw new ServerApiException(BaseCmd.PARAM_ERROR, "Please specify a valid zone Id."); } @@ -131,7 +146,7 @@ public class RegisterTemplateCmd extends BaseCmd { &&(!url.toLowerCase().endsWith("qcow2.bz2"))&&(!url.toLowerCase().endsWith("qcow2.gz")))){ throw new ServerApiException(BaseCmd.PARAM_ERROR, "Please specify a valid "+format.toLowerCase()); } - + boolean allowPublicUserTemplates = Boolean.parseBoolean(getManagementServer().getConfigurationValue("allow.public.user.templates")); if (!isAdmin && !allowPublicUserTemplates && isPublic) { throw new ServerApiException(BaseCmd.PARAM_ERROR, "Only private templates can be created."); @@ -148,7 +163,7 @@ public class RegisterTemplateCmd extends BaseCmd { Long templateId; try { - templateId = getManagementServer().createTemplate(userId, zoneId, name, displayText, isPublic, featured, format, "ext3", url, null, requiresHVM, bits, passwordEnabled, guestOSId, true); + templateId = getManagementServer().createTemplate(userId, accountId, zoneId, name, displayText, isPublic, featured, format, "ext3", url, null, requiresHVM, bits, passwordEnabled, guestOSId, true); } catch (InvalidParameterValueException ipve) { throw new ServerApiException(BaseCmd.PARAM_ERROR, "Internal error registering template " + name + "; " + ipve.getMessage()); } catch (IllegalArgumentException iae) { diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 3bf8a1c0f2b..39bc8aec0bd 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -4911,11 +4911,12 @@ public class ManagementServerImpl implements ManagementServer { throw new InternalErrorException(errorString); } - + String volumeLocalPath = "volumes/"+volume.getId()+"/"+cvAnswer.getVolumePath()+".vhd"; uploadJob.setUploadState(UploadVO.Status.COPY_COMPLETE); uploadJob.setLastUpdated(new Date()); _uploadDao.update(uploadJob.getId(), uploadJob); - _uploadMonitor.extractVolume(uploadJob, sserver, volume, url, zoneId, "volumes/"+volume.getId()+"/"+cvAnswer.getVolumePath()+".vhd", eventId, asyncJobId, _asyncMgr); + + _uploadMonitor.extractVolume(uploadJob, sserver, volume, url, zoneId, volumeLocalPath, eventId, asyncJobId, _asyncMgr); } @@ -4986,7 +4987,7 @@ public class ManagementServerImpl implements ManagementServer { } @Override - public Long createTemplate(long userId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, String format, String diskType, String url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable) throws InvalidParameterValueException,IllegalArgumentException, ResourceAllocationException { + public Long createTemplate(long userId, long accountId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, String format, String diskType, String url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable) throws InvalidParameterValueException,IllegalArgumentException, ResourceAllocationException { try { if (name.length() > 32) @@ -5030,11 +5031,10 @@ public class ManagementServerImpl implements ManagementServer { } // Check that the resource limit for templates/ISOs won't be exceeded - UserVO user = _userDao.findById(userId); - if (user == null) { - throw new IllegalArgumentException("Unable to find user with id " + userId); + AccountVO account = _accountDao.findById(accountId); + if (account == null) { + throw new InvalidParameterValueException("Unable to find account: " + accountId); } - AccountVO account = _accountDao.findById(user.getAccountId()); if (_accountMgr.resourceLimitExceeded(account, ResourceType.template)) { ResourceAllocationException rae = new ResourceAllocationException("Maximum number of templates and ISOs for account: " + account.getAccountName() + " has been exceeded."); rae.setResourceType("template"); @@ -5052,7 +5052,7 @@ public class ManagementServerImpl implements ManagementServer { throw new IllegalArgumentException("Cannot use reserved names for templates"); } - return _tmpltMgr.create(userId, zoneId, name, displayText, isPublic, featured, imgfmt, fileSystem, uri, chksum, requiresHvm, bits, enablePassword, guestOSId, bootable); + return _tmpltMgr.create(userId, accountId, zoneId, name, displayText, isPublic, featured, imgfmt, fileSystem, uri, chksum, requiresHvm, bits, enablePassword, guestOSId, bootable); } catch (URISyntaxException e) { throw new IllegalArgumentException("Invalid URL " + url); } diff --git a/server/src/com/cloud/template/TemplateManager.java b/server/src/com/cloud/template/TemplateManager.java index 7644e5bb22e..b0ed035edb4 100755 --- a/server/src/com/cloud/template/TemplateManager.java +++ b/server/src/com/cloud/template/TemplateManager.java @@ -46,6 +46,7 @@ public interface TemplateManager extends Manager { * Creates a Template * * @param userId the Id of the user + * @param accountId of the template to be created. * @param zoneId (optional) the zone to download the template to * @param name - user specified name for the template * @param displayText user readable name. @@ -62,7 +63,7 @@ public interface TemplateManager extends Manager { * @param bootable true if this template will represent a bootable ISO * @return id of the template created. */ - Long create(long userId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, ImageFormat format, FileSystem fs, URI url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable); + Long create(long userId, long accountId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, ImageFormat format, FileSystem fs, URI url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable); /** * Creates a Template diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java index a1aea47fe1b..698d30ca11a 100755 --- a/server/src/com/cloud/template/TemplateManagerImpl.java +++ b/server/src/com/cloud/template/TemplateManagerImpl.java @@ -117,11 +117,9 @@ public class TemplateManagerImpl implements TemplateManager { @Override - public Long create(long userId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, ImageFormat format, FileSystem fs, URI url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable) { + public Long create(long userId, long accountId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, ImageFormat format, FileSystem fs, URI url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable) { Long id = _tmpltDao.getNextInSequence(Long.class, "id"); - - UserVO user = _userDao.findById(userId); - long accountId = user.getAccountId(); + AccountVO account = _accountDao.findById(accountId); if (account.getType() != Account.ACCOUNT_TYPE_ADMIN && zoneId == null) { throw new IllegalArgumentException("Only admins can create templates in all zones"); @@ -139,12 +137,9 @@ public class TemplateManagerImpl implements TemplateManager { _tmpltDao.addTemplateToZone(template, zoneId); } - - UserAccount userAccount = _userAccountDao.findById(userId); - _downloadMonitor.downloadTemplateToStorage(id, zoneId); - _accountMgr.incrementResourceCount(userAccount.getAccountId(), ResourceType.template); + _accountMgr.incrementResourceCount(accountId, ResourceType.template); return id; } From 6c683e733a4f2afbe76f8b37e71620f64634c2d7 Mon Sep 17 00:00:00 2001 From: kishan Date: Mon, 27 Sep 2010 18:29:02 +0530 Subject: [PATCH 018/244] bug 5851,6312: fixed start event ids for router start/stop events status 5851,6312: resolved fixed --- server/src/com/cloud/network/NetworkManagerImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 5dd5ec4ec74..ec603e50dc9 100644 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -2018,7 +2018,10 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager event.setState(EventState.Started); event.setDescription("Stopping Router with Id: "+routerId); event.setStartId(eventId); - _eventDao.persist(event); + event = _eventDao.persist(event); + if(eventId == 0){ + eventId = event.getId(); + } try { @@ -2230,7 +2233,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager @Override public DomainRouterVO addVirtualMachineToGuestNetwork(UserVmVO vm, String password, long startEventId) throws ConcurrentOperationException { try { - DomainRouterVO router = start(vm.getDomainRouterId(), startEventId); + DomainRouterVO router = start(vm.getDomainRouterId(), 0); if (router == null) { s_logger.error("Can't find a domain router to start VM: " + vm.getName()); return null; From 27a32380f2bb656c442d03059eaefffa26198ba6 Mon Sep 17 00:00:00 2001 From: nit Date: Mon, 27 Sep 2010 20:39:05 +0530 Subject: [PATCH 019/244] bug 5360: Adding scheduled and started events for USER.DELETE. status 5360: resolved fixed --- .../async/executor/DeleteUserExecutor.java | 15 ++++++++--- .../cloud/async/executor/DeleteUserParam.java | 25 +++++++++++++++++++ .../cloud/server/ManagementServerImpl.java | 7 +++++- 3 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 server/src/com/cloud/async/executor/DeleteUserParam.java diff --git a/server/src/com/cloud/async/executor/DeleteUserExecutor.java b/server/src/com/cloud/async/executor/DeleteUserExecutor.java index 40b8dd0730f..c1214b1e180 100644 --- a/server/src/com/cloud/async/executor/DeleteUserExecutor.java +++ b/server/src/com/cloud/async/executor/DeleteUserExecutor.java @@ -25,8 +25,10 @@ import com.cloud.async.AsyncJobManager; import com.cloud.async.AsyncJobResult; import com.cloud.async.AsyncJobVO; import com.cloud.async.BaseAsyncJobExecutor; +import com.cloud.event.EventTypes; import com.cloud.serializer.GsonHelper; import com.cloud.server.ManagementServer; +import com.cloud.user.User; import com.google.gson.Gson; public class DeleteUserExecutor extends BaseAsyncJobExecutor { @@ -37,10 +39,15 @@ public class DeleteUserExecutor extends BaseAsyncJobExecutor { AsyncJobManager asyncMgr = getAsyncJobMgr(); AsyncJobVO job = getJob(); ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer(); - Long param = gson.fromJson(job.getCmdInfo(), Long.class); + DeleteUserParam param = gson.fromJson(job.getCmdInfo(), DeleteUserParam.class); - try { - if(managementServer.deleteUser(param.longValue())) { + try { + User user = managementServer.getUser(param.getUserId(), true); + String description = "Starting deleting User " + user.getUsername() + " (id: " + param.getUserId() + + ") for accountId = " + user.getAccountId(); + managementServer.saveStartedEvent(1L, 1L, EventTypes.EVENT_USER_DELETE, description, param.getEventId()); + + if(managementServer.deleteUser(param.getUserId())) { asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_SUCCEEDED, 0, "success"); } else { @@ -48,7 +55,7 @@ public class DeleteUserExecutor extends BaseAsyncJobExecutor { "operation failed"); } } catch(Exception e) { - s_logger.warn("Unable to delete User " + param.longValue() + ": " + e.getMessage(), e); + s_logger.warn("Unable to delete User " + param.getUserId() + ": " + e.getMessage(), e); asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, e.getMessage()); } diff --git a/server/src/com/cloud/async/executor/DeleteUserParam.java b/server/src/com/cloud/async/executor/DeleteUserParam.java new file mode 100644 index 00000000000..97974992c1f --- /dev/null +++ b/server/src/com/cloud/async/executor/DeleteUserParam.java @@ -0,0 +1,25 @@ +package com.cloud.async.executor; + +public class DeleteUserParam { + + private Long userId; + private Long eventId; + + public DeleteUserParam() {} + + public DeleteUserParam(Long userId, Long eventId) { + this.userId = userId; + this.eventId = eventId; + + } + + public Long getUserId() { + return userId; + } + + public Long getEventId() { + return eventId; + } + + +} diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 39bc8aec0bd..d94d221c5c9 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -97,6 +97,7 @@ import com.cloud.async.executor.CreatePrivateTemplateParam; import com.cloud.async.executor.DeleteDomainParam; import com.cloud.async.executor.DeleteRuleParam; import com.cloud.async.executor.DeleteTemplateParam; +import com.cloud.async.executor.DeleteUserParam; import com.cloud.async.executor.DeployVMParam; import com.cloud.async.executor.DisassociateIpAddressParam; import com.cloud.async.executor.ExtractJobResultObject; @@ -903,7 +904,11 @@ public class ManagementServerImpl implements ManagementServer { @Override public long deleteUserAsync(long userId) { - Long param = new Long(userId); + User user = getUser(userId, true); + String description = "User " + user.getUsername() + " (id: " + userId + + ") and accountId = " + user.getAccountId(); + long eventId = saveScheduledEvent(1L, 1L, EventTypes.EVENT_USER_DELETE, description); + DeleteUserParam param = new DeleteUserParam(userId, eventId); Gson gson = GsonHelper.getBuilder().create(); AsyncJobVO job = new AsyncJobVO(); From 4a305631f9d693aef931fb97618c38f410c51cff Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 27 Sep 2010 10:49:52 -0700 Subject: [PATCH 020/244] fix a bug - showXXXXXXXTab() is not defined. --- ui/jsp/tab_accounts.jsp | 1 + ui/jsp/tab_configuration.jsp | 1 + ui/jsp/tab_domains.jsp | 1 + ui/jsp/tab_events.jsp | 1 + ui/jsp/tab_hosts.jsp | 1 + ui/jsp/tab_instances.jsp | 1 + ui/jsp/tab_networking.jsp | 1 + ui/jsp/tab_storage.jsp | 1 + ui/jsp/tab_templates.jsp | 1 + 9 files changed, 9 insertions(+) diff --git a/ui/jsp/tab_accounts.jsp b/ui/jsp/tab_accounts.jsp index 8bd1bb882b8..df4da1544c5 100755 --- a/ui/jsp/tab_accounts.jsp +++ b/ui/jsp/tab_accounts.jsp @@ -2,6 +2,7 @@ <% long milliseconds = new Date().getTime(); %> + @@ -287,7 +287,7 @@
- 24 VM(s)
+ ? VM(s)
@@ -305,7 +305,7 @@
- 48 VM(s)
+ ? VM(s)
@@ -422,7 +422,7 @@
- 3
+
@@ -432,7 +432,7 @@
- Niki
+
@@ -442,7 +442,7 @@
- User
+
@@ -452,7 +452,7 @@
- Root
+
diff --git a/ui/new/scripts/cloud.core2.dashboard.js b/ui/new/scripts/cloud.core2.dashboard.js index aa9c28b777b..b4f8deb2985 100644 --- a/ui/new/scripts/cloud.core2.dashboard.js +++ b/ui/new/scripts/cloud.core2.dashboard.js @@ -210,6 +210,73 @@ function afterLoadDashboardJSP() { } else if(isUser()) { showDashboard("dashboard_user"); + + //$("#launch_test").hide(); + $.ajax({ + cache: false, + data: createURL("command=listAccounts"), + dataType: "json", + success: function(json) { + var accounts = json.listaccountsresponse.account; + if (accounts != null && accounts.length > 0) { + var statJSON = accounts[0]; + /* + var sent = parseInt(statJSON.sentbytes); + var rec = parseInt(statJSON.receivedbytes); + + if(sent==0 && rec==0) + $("#network_bandwidth_panel").hide(); + else + $("#network_bandwidth_panel").show(); + + $("#menutab_role_user").show(); + $("#menutab_role_root").hide(); + $("#menutab_role_domain").hide(); + $("#tab_dashboard_user").show(); + $("#tab_dashboard_root, #tab_dashboard_domain, #loading_gridtable").hide(); + + // This is in bytes, so let's change to KB + sent = Math.round(sent / 1024); + rec = Math.round(rec / 1024); + $("#db_sent").text(sent + "KB"); + $("#db_received").text(rec + "KB"); + $("#db_available_public_ips").text(statJSON.ipavailable); + $("#db_owned_public_ips").text(statJSON.iptotal); + */ + $("#db_running_vms").text(statJSON.vmrunning); + $("#db_stopped_vms").text(statJSON.vmstopped); + $("#db_total_vms").text(statJSON.vmtotal); + //$("#db_avail_vms").text(statJSON.vmavailable); + $("#db_account_id").text(statJSON.id); + $("#db_account").text(statJSON.name); + $("#db_type").text(toRole(statJSON.accounttype)); + $("#db_domain").text(statJSON.domain); + } + + // Events + $.ajax({ + data: createURL("command=listEvents&level=ERROR"), + dataType: "json", + success: function(json) { + var events = json.listeventsresponse.event; + if (events != null && events.length > 0) { + var errorGrid = $("#error_grid_content").empty(); + var length = (events.length>=3) ? 3 : events.length; + for (var i = 0; i < length; i++) { + var errorTemplate = $("#recent_error_template").clone(true); + errorTemplate.find("#db_error_type").text(events[i].type); + errorTemplate.find("#db_error_msg").text(fromdb(events[i].description)); + setDateField(events[i].created, errorTemplate.find("#db_error_date")); + errorGrid.append(errorTemplate.show()); + } + } + } + }); + }, + beforeSend: function(XMLHttpRequest) { + return true; + } + }); } else { //no role logout(false); From 58a850c374cb4ed3425efcaf60e11b6d4d88e2a9 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sat, 2 Oct 2010 12:45:51 -0700 Subject: [PATCH 157/244] new UI - dashboad of user - implement Public IPs section. --- ui/new/jsp/dashboard.jsp | 4 ++-- ui/new/scripts/cloud.core2.dashboard.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/new/jsp/dashboard.jsp b/ui/new/jsp/dashboard.jsp index 4f4c7df5b84..cc306befbc5 100644 --- a/ui/new/jsp/dashboard.jsp +++ b/ui/new/jsp/dashboard.jsp @@ -327,7 +327,7 @@
- Unlimited
+
@@ -338,7 +338,7 @@
- 5
+
diff --git a/ui/new/scripts/cloud.core2.dashboard.js b/ui/new/scripts/cloud.core2.dashboard.js index b4f8deb2985..b638a64bdc9 100644 --- a/ui/new/scripts/cloud.core2.dashboard.js +++ b/ui/new/scripts/cloud.core2.dashboard.js @@ -240,9 +240,9 @@ function afterLoadDashboardJSP() { rec = Math.round(rec / 1024); $("#db_sent").text(sent + "KB"); $("#db_received").text(rec + "KB"); - $("#db_available_public_ips").text(statJSON.ipavailable); - $("#db_owned_public_ips").text(statJSON.iptotal); */ + $("#db_available_public_ips").text(statJSON.ipavailable); + $("#db_owned_public_ips").text(statJSON.iptotal); $("#db_running_vms").text(statJSON.vmrunning); $("#db_stopped_vms").text(statJSON.vmstopped); $("#db_total_vms").text(statJSON.vmtotal); From ac82ee7dc29e3852a34ac264e3f3fa6d888b4b0b Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sat, 2 Oct 2010 15:10:01 -0700 Subject: [PATCH 158/244] new UI - dashboard of user - implement Recent Errors section. --- ui/new/jsp/dashboard.jsp | 104 +++++++----------------- ui/new/scripts/cloud.core2.dashboard.js | 75 ++++++++--------- 2 files changed, 69 insertions(+), 110 deletions(-) diff --git a/ui/new/jsp/dashboard.jsp b/ui/new/jsp/dashboard.jsp index cc306befbc5..4a2001d7dfc 100644 --- a/ui/new/jsp/dashboard.jsp +++ b/ui/new/jsp/dashboard.jsp @@ -14,7 +14,7 @@ - + - - + - + - + - - - + + + + diff --git a/ui/new/scripts/cloud.core2.instance.js b/ui/new/scripts/cloud.core2.instance.js index 48137f4ee7d..dc3c8bc3b24 100644 --- a/ui/new/scripts/cloud.core2.instance.js +++ b/ui/new/scripts/cloud.core2.instance.js @@ -69,14 +69,8 @@ function clickInstanceGroupHeader($arrowIcon) { initDialog("dialog_attach_iso"); initDialog("dialog_change_name"); initDialog("dialog_change_group"); - - activateDialog($("#dialog_change_service_offering").dialog({ - width: 600, - autoOpen: false, - modal: true, - zIndex: 2000 - })); - + initDialog("dialog_change_service_offering"); + activateDialog($("#dialog_create_template").dialog({ width: 400, autoOpen: false, @@ -914,7 +908,7 @@ function doChangeService($t, selectedItemsInMidMenu, vmListAPIMap) { $("#dialog_change_service_offering") .dialog('option', 'buttons', { - "Change": function() { + "OK": function() { var thisDialog = $(this); thisDialog.dialog("close"); @@ -1282,7 +1276,7 @@ function doCreateTemplateFromVmVolume($actionLink, listAPIMap, $subgridItem) { $("#dialog_create_template") .dialog('option', 'buttons', { - "Create": function() { + "OK": function() { var thisDialog = $(this); thisDialog.dialog("close"); From 4fda60cce00a946ee0963dc7a609a8f51b3ed8ec Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sun, 3 Oct 2010 11:22:13 -0700 Subject: [PATCH 163/244] new UI - localize create template of disk volume dialog. --- .../classes/resources/resource.properties | 6 + ui/new/jsp/instance.jsp | 104 +++++++++--------- ui/new/scripts/cloud.core2.instance.js | 1 - 3 files changed, 58 insertions(+), 53 deletions(-) diff --git a/client/WEB-INF/classes/resources/resource.properties b/client/WEB-INF/classes/resources/resource.properties index daf03658290..f2b791ada78 100644 --- a/client/WEB-INF/classes/resources/resource.properties +++ b/client/WEB-INF/classes/resources/resource.properties @@ -8,3 +8,9 @@ please.specify.the.new.group.you.want.to.assign.the.virtual.machine.to = Please group.name = Group Name after.changing.service.offering.you.must.restart.the.virtual.machine.for.new.service.offering.to.take.effect = After changing service offering, you must restart the virtual machine for the new service offering to take effect. service.offering = Service Offering +creating.a.template.of.disk.volume.could.take.up.to.several.hours.depending.on.the.size.of.the.disk.volume = Creating a template of disk volume could take up to several hours depending on the size of the disk volume +name = Name +display.text = Display Text +os.type = OS Type +public = Public +password.enabled = Password Enabled diff --git a/ui/new/jsp/instance.jsp b/ui/new/jsp/instance.jsp index 9d97e43e0e0..72464236396 100644 --- a/ui/new/jsp/instance.jsp +++ b/ui/new/jsp/instance.jsp @@ -765,57 +765,6 @@ - - - - +
+
+
+ <%=t.t("crossZones")%>:
+
+
+
+
+
+
@@ -252,3 +262,16 @@
+ + + + + diff --git a/ui/new/scripts/cloud.core2.iso.js b/ui/new/scripts/cloud.core2.iso.js index 65fddf021a9..f985fefa956 100644 --- a/ui/new/scripts/cloud.core2.iso.js +++ b/ui/new/scripts/cloud.core2.iso.js @@ -151,6 +151,9 @@ function afterLoadIsoJSP() { }); //initialize dialog box *** + initDialog("dialog_confirmation_delete_iso_all_zones"); + initDialog("dialog_confirmation_delete_iso"); + activateDialog($("#dialog_copy_iso").dialog({ width:300, autoOpen: false, @@ -213,13 +216,14 @@ function isoJsonToDetailsTab(jsonObj) { if(jsonObj.size != null) $detailsTab.find("#size").text(convertBytes(parseInt(jsonObj.size))); - + var status = "Ready"; if (jsonObj.isready == "false") status = jsonObj.isostatus; $detailsTab.find("#status").text(status); - - setBooleanField(jsonObj.bootable, $detailsTab.find("#bootable")); + + setBooleanField(jsonObj.bootable, $detailsTab.find("#bootable")); + setBooleanField(jsonObj.crossZones, $detailsTab.find("#crossZones")); setDateField(jsonObj.created, $detailsTab.find("#created")); @@ -348,14 +352,13 @@ function doDeleteIso($actionLink, listAPIMap, $detailsTab) { if (zoneId != null) moreCriteria.push("&zoneid="+zoneId); - var htmlMsg; + var $dialog1; if(jsonObj.crossZones == "true") - htmlMsg = "

ISO "+name+" is used by all zones. Please confirm you want to delete it from all zones.

"; + $dialog1 = $("#dialog_confirmation_delete_iso_all_zones"); else - htmlMsg = "

Please confirm you want to delete ISO "+name+".

"; - - $("#dialog_confirmation") - .html(htmlMsg) + $dialog1 = $("#dialog_confirmation_delete_iso"); + + $dialog1 .dialog('option', 'buttons', { "Confirm": function() { $(this).dialog("close"); From fcbcbb720106f28e7bd3118978f651e33a9a9fec Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sun, 3 Oct 2010 18:10:55 -0700 Subject: [PATCH 171/244] new UI - localize delete template for single zone dialog, delete template for all zones dialog. --- .../WEB-INF/classes/resources/resource.properties | 2 ++ ui/new/jsp/template.jsp | 12 ++++++++++++ ui/new/scripts/cloud.core2.template.js | 14 ++++++++------ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/client/WEB-INF/classes/resources/resource.properties b/client/WEB-INF/classes/resources/resource.properties index 27da32e667e..53a3f177047 100644 --- a/client/WEB-INF/classes/resources/resource.properties +++ b/client/WEB-INF/classes/resources/resource.properties @@ -22,4 +22,6 @@ please.confirm.you.want.to.enable.HA.for.your.virtual.machine.once.HA.is.enabled please.confirm.you.want.to.disable.HA.for.the.virtual.machine.once.HA.is.disabled.the.virtual.machine.will.no.longer.be.automatically.restarted.in.the.event.of.a.failure = Please confirm you want to disable HA for the virtual machine. Once HA is disabled, the virtual machine will no longer be be automatically restarted in the event of a failure. the.ISO.is.used.by.all.zones.please.confirm.you.want.to.delete.it.from.all.zones = The ISO is used by all zones. Please confirm you want to delete it from all zones. please.confirm.you.want.to.delete.the.ISO = Please confirm you want to delete the ISO +the.template.is.used.by.all.zones.please.confirm.you.want.to.delete.it.from.all.zones = The template is used by all zones. Please confirm you want to delete it from all zones. +please.confirm.you.want.to.delete.the.template = Please confirm you want to delete the template diff --git a/ui/new/jsp/template.jsp b/ui/new/jsp/template.jsp index e6170b9d823..898622d14ff 100644 --- a/ui/new/jsp/template.jsp +++ b/ui/new/jsp/template.jsp @@ -333,3 +333,15 @@ + + + + diff --git a/ui/new/scripts/cloud.core2.template.js b/ui/new/scripts/cloud.core2.template.js index 135a7652330..1a6ead76c46 100644 --- a/ui/new/scripts/cloud.core2.template.js +++ b/ui/new/scripts/cloud.core2.template.js @@ -152,6 +152,9 @@ function afterLoadTemplateJSP() { }); //initialize dialog box *** + initDialog("dialog_confirmation_delete_template_all_zones"); + initDialog("dialog_confirmation_delete_template"); + activateDialog($("#dialog_add_template").dialog({ width:450, autoOpen: false, @@ -438,14 +441,13 @@ function doDeleteTemplate($actionLink, listAPIMap, $detailsTab) { if (zoneId != null) moreCriteria.push("&zoneid="+zoneId); - var htmlMsg; + var $dialog1; if(jsonObj.crossZones == "true") - htmlMsg = "

Template "+name+" is used by all zones. Please confirm you want to delete it from all zones.

"; + $dialog1 = $("#dialog_confirmation_delete_template_all_zones"); else - htmlMsg = "

Please confirm you want to delete template "+name+".

"; - - $("#dialog_confirmation") - .html(htmlMsg) + $dialog1 = $("#dialog_confirmation_delete_template"); + + $dialog1 .dialog('option', 'buttons', { "Confirm": function() { $(this).dialog("close"); From 12db8ca6133732dd91a507d651fa2469da97cfcf Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sun, 3 Oct 2010 19:31:56 -0700 Subject: [PATCH 172/244] new UI - accounts page - localize resource limits dialog, disable account dialog, lock account dialog, enable account dialog. --- .../classes/resources/resource.properties | 10 +++++++ ui/new/jsp/account.jsp | 26 ++++++++++++------- ui/new/scripts/cloud.core2.account.js | 24 +++-------------- ui/new/scripts/cloud.core2.instance.js | 10 ++----- ui/new/scripts/cloud.core2.js | 23 +++++++++++----- 5 files changed, 49 insertions(+), 44 deletions(-) diff --git a/client/WEB-INF/classes/resources/resource.properties b/client/WEB-INF/classes/resources/resource.properties index 53a3f177047..8b1c06f5ec1 100644 --- a/client/WEB-INF/classes/resources/resource.properties +++ b/client/WEB-INF/classes/resources/resource.properties @@ -24,4 +24,14 @@ the.ISO.is.used.by.all.zones.please.confirm.you.want.to.delete.it.from.all.zones please.confirm.you.want.to.delete.the.ISO = Please confirm you want to delete the ISO the.template.is.used.by.all.zones.please.confirm.you.want.to.delete.it.from.all.zones = The template is used by all zones. Please confirm you want to delete it from all zones. please.confirm.you.want.to.delete.the.template = Please confirm you want to delete the template +please.specify.limits.to.the.various.resources.-1.means.the.resource.has.no.limits = Please specify limits to the various resources. -1 means the resource has no limits. +instance.limit = Instance Limit +public.ip.limit = Public IP Limit +disk.volume.limit = Disk Volume Limit +snapshot.limit = Snapshot Limit +template.limit = Template Limit +please.confirm.you.want.to.disable.account.that.will.prevent.account.access.to.the.cloud.and.shut.down.all.existing.virtual.machines = Please confirm you want to disable account that will prevent account access to the cloud and shut down all existing virtual machines. +please.confirm.you.want.to.lock.account.that.will.prevent.account.access.to.the.cloud = Please confirm you want to lock account that will prevent account access to the cloud. +please.confirm.you.want.to.enable.account = Please confirm you want to enable account. + diff --git a/ui/new/jsp/account.jsp b/ui/new/jsp/account.jsp index 9b39eddd060..99446c9aed3 100644 --- a/ui/new/jsp/account.jsp +++ b/ui/new/jsp/account.jsp @@ -142,32 +142,34 @@ @@ -389,8 +236,8 @@ long milliseconds = new Date().getTime();
- Instances
- Instances + Instance + <%=t.t("instance")%> @@ -401,8 +248,8 @@ long milliseconds = new Date().getTime();
- Instances
- Instances + Instance + <%=t.t("instance")%>
@@ -411,14 +258,14 @@ long milliseconds = new Date().getTime();
- Routers
- Routers + Router
+ <%=t.t("router")%>
- Storage
+ System
System
@@ -430,7 +277,7 @@ long milliseconds = new Date().getTime();
Host
- Hosts + Host @@ -439,7 +286,7 @@ long milliseconds = new Date().getTime();
Host
- Hosts + Host
@@ -449,8 +296,8 @@ long milliseconds = new Date().getTime();
- storage
- Storage + Storage + <%=t.t("storage")%> @@ -458,29 +305,29 @@ long milliseconds = new Date().getTime();
- storage
+ Primary Storage
Primary Storage
- storage
+ secondary Storage
secondary Storage
- storage
- Volumes + Volume
+ <%=t.t("volume")%>
- storage
- Snapshots + Snapshot
+ <%=t.t("snapshot")%>
@@ -490,8 +337,8 @@ long milliseconds = new Date().getTime();
- Network
- Network + IP Address + <%=t.t("ip.address")%> @@ -499,17 +346,10 @@ long milliseconds = new Date().getTime();
- Network
- IP Addresses + IP Address
+ <%=t.t("ip.address")%>
- -
-
-
- Network
- Network Groups -
-
+
@@ -517,8 +357,8 @@ long milliseconds = new Date().getTime();
- Templates
- Templates + Template
+ <%=t.t("template")%>
@@ -527,33 +367,33 @@ long milliseconds = new Date().getTime();
- Templates
- Template + Template
+ <%=t.t("template")%>
-
+ My Template
- My Templates
+ <%=t.t("my.template")%>
-
+ Community Template
- Community
+ <%=t.t("community.template")%>
@@ -563,7 +403,7 @@ long milliseconds = new Date().getTime();
Templates
- ISO + <%=t.t("iso")%>
@@ -572,7 +412,7 @@ long milliseconds = new Date().getTime();
- My ISOs
+ <%=t.t("my.iso")%>
@@ -588,7 +428,7 @@ long milliseconds = new Date().getTime();
- Community
+ <%=t.t("community.iso")%>
@@ -600,8 +440,8 @@ long milliseconds = new Date().getTime();
- Accounts
- Accounts + Account + <%=t.t("account")%> @@ -609,8 +449,8 @@ long milliseconds = new Date().getTime();
- Accounts
- Accounts + Account
+ <%=t.t("account")%>
@@ -621,7 +461,7 @@ long milliseconds = new Date().getTime();
Domain
- Domain + <%=t.t("domain")%> @@ -630,7 +470,7 @@ long milliseconds = new Date().getTime();
Domain
- Domain + <%=t.t("domain")%>
@@ -640,8 +480,8 @@ long milliseconds = new Date().getTime();
- Events
- Events + Event + <%=t.t("event")%> @@ -649,15 +489,15 @@ long milliseconds = new Date().getTime();
- Events
- Events + Event
+ <%=t.t("event")%>
- Events
- Alerts + Alert
+ <%=t.t("alert")%>
@@ -708,7 +548,7 @@ long milliseconds = new Date().getTime(); <%=t.t("ip.address")%> diff --git a/ui/new/jsp/account.jsp b/ui/new/jsp/account.jsp index 99446c9aed3..ac92ce2a965 100644 --- a/ui/new/jsp/account.jsp +++ b/ui/new/jsp/account.jsp @@ -27,15 +27,10 @@ -
-
+