mirror of https://github.com/apache/cloudstack.git
bug 8577: Make listEvents API take in id parameter.
This commit is contained in:
parent
c475aacc08
commit
35397d7176
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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 + "%");
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in New Issue