diff --git a/api/src/com/cloud/api/commands/ListEventsCmd.java b/api/src/com/cloud/api/commands/ListEventsCmd.java index f5f9254eb09..20c1447d18a 100644 --- a/api/src/com/cloud/api/commands/ListEventsCmd.java +++ b/api/src/com/cloud/api/commands/ListEventsCmd.java @@ -27,6 +27,7 @@ import com.cloud.api.ApiConstants; import com.cloud.api.BaseListCmd; import com.cloud.api.Implementation; import com.cloud.api.Parameter; +import com.cloud.api.BaseCmd.CommandType; import com.cloud.api.response.EventResponse; import com.cloud.api.response.ListResponse; import com.cloud.event.Event; @@ -47,6 +48,9 @@ public class ListEventsCmd extends BaseListCmd { @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID for the event. If used with the account parameter, returns all events for an account in the specified domain ID.") private Long domainId; + @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the event") + private Long id; + @Parameter(name=ApiConstants.DURATION, type=CommandType.INTEGER, description="the duration of the event") private Integer duration; @@ -77,6 +81,10 @@ public class ListEventsCmd extends BaseListCmd { return domainId; } + public Long getId() { + return id; + } + public Integer getDuration() { return duration; } diff --git a/api/src/com/cloud/api/commands/ListRoutersCmd.java b/api/src/com/cloud/api/commands/ListRoutersCmd.java index 3f8f5cd4a27..e390c85f5ea 100644 --- a/api/src/com/cloud/api/commands/ListRoutersCmd.java +++ b/api/src/com/cloud/api/commands/ListRoutersCmd.java @@ -52,7 +52,7 @@ public class ListRoutersCmd extends BaseListCmd { @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="the host ID of the router") private Long hostId; - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the disk volume") + @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the disk router") private Long id; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the router") diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 1b1dfff730d..a7b2633a038 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -2023,6 +2023,7 @@ public class ManagementServerImpl implements ManagementServer { Filter searchFilter = new Filter(EventVO.class, "createDate", false, cmd.getStartIndex(), cmd.getPageSizeVal()); + Object id = cmd.getId(); Object type = cmd.getType(); Object level = cmd.getLevel(); Date startDate = cmd.getStartDate(); @@ -2039,6 +2040,7 @@ public class ManagementServerImpl implements ManagementServer { } SearchBuilder sb = _eventDao.createSearchBuilder(); + sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); sb.and("levelL", sb.entity().getLevel(), SearchCriteria.Op.LIKE); sb.and("levelEQ", sb.entity().getLevel(), SearchCriteria.Op.EQ); sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ); @@ -2057,6 +2059,9 @@ public class ManagementServerImpl implements ManagementServer { } SearchCriteria sc = sb.create(); + if (id != null) { + sc.setParameters("id", id); + } if (keyword != null) { SearchCriteria ssc = _eventDao.createSearchCriteria(); ssc.addOr("type", SearchCriteria.Op.LIKE, "%" + keyword + "%"); diff --git a/ui/scripts/cloud.core.event.js b/ui/scripts/cloud.core.event.js index 2d9e95bd6b2..1796a7561bd 100644 --- a/ui/scripts/cloud.core.event.js +++ b/ui/scripts/cloud.core.event.js @@ -97,9 +97,7 @@ function eventJsonToDetailsTab() { var $thisTab = $("#right_panel_content #tab_content_details"); $thisTab.find("#tab_container").hide(); $thisTab.find("#tab_spinning_wheel").show(); - - //uncomment the following section when Bug 8577("listAlerts API, listEvents API doesn't take in id parameter correctly") is fixed - /* + $.ajax({ data: createURL("command=listEvents&id="+jsonObj.id), dataType: "json", @@ -112,8 +110,7 @@ function eventJsonToDetailsTab() { } } }); - */ - + $thisTab.find("#id").text(fromdb(jsonObj.id)); $thisTab.find("#username").text(fromdb(jsonObj.username)); $thisTab.find("#account").text(fromdb(jsonObj.account));