bug 8577: Make listEvents API take in id parameter.

This commit is contained in:
Jessica Wang 2011-02-16 15:20:05 -08:00
parent c475aacc08
commit 35397d7176
4 changed files with 16 additions and 6 deletions

View File

@ -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;
}

View File

@ -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")

View File

@ -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<EventVO> 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<EventVO> sc = sb.create();
if (id != null) {
sc.setParameters("id", id);
}
if (keyword != null) {
SearchCriteria<EventVO> ssc = _eventDao.createSearchCriteria();
ssc.addOr("type", SearchCriteria.Op.LIKE, "%" + keyword + "%");

View File

@ -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));