Skip to content

Commit 0102e85

Browse files
committed
CLOUDSTACK-10129: UX improvements and event timeline
- Fixes timezone issue where dates show up as nvalid in UI - Introduces new event timeline listing/filtering of events - Several UI improvements to add columns in list views - Bulk operations support in instance list view to shutdown and destroy multiple-selected VMs (limitation: after operation, redundant entries may show up in the list view, refreshing VM list view fixes that) - Align table thead/tbody to avoid splitting of tables Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent d0005d8 commit 0102e85

File tree

17 files changed

+412
-166
lines changed

17 files changed

+412
-166
lines changed

api/src/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ public class ApiConstants {
205205
public static final String OUTOFBANDMANAGEMENT_POWERSTATE = "outofbandmanagementpowerstate";
206206
public static final String OUTOFBANDMANAGEMENT_ENABLED = "outofbandmanagementenabled";
207207
public static final String PARAMS = "params";
208+
public static final String PARENT_ID = "parentid";
208209
public static final String PARENT_DOMAIN_ID = "parentdomainid";
209210
public static final String PASSWORD = "password";
210211
public static final String SHOULD_UPDATE_PASSWORD = "update_passwd_on_host";
@@ -274,6 +275,7 @@ public class ApiConstants {
274275
public static final String SNAPSHOT_QUIESCEVM = "quiescevm";
275276
public static final String SOURCE_ZONE_ID = "sourcezoneid";
276277
public static final String START_DATE = "startdate";
278+
public static final String START_ID = "startid";
277279
public static final String START_IP = "startip";
278280
public static final String START_IPV6 = "startipv6";
279281
public static final String START_PORT = "startport";

api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ public class ListEventsCmd extends BaseListProjectAndAccountResourcesCmd {
6565
@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "the event type (see event types)")
6666
private String type;
6767

68+
@Parameter(name = ApiConstants.START_ID, type = CommandType.UUID, entityType = EventResponse.class, description = "the parent/start ID of the event, when provided this will list all the events with the start/parent ID including the parent event")
69+
private Long startId;
70+
6871
/////////////////////////////////////////////////////
6972
/////////////////// Accessors ///////////////////////
7073
/////////////////////////////////////////////////////
@@ -97,6 +100,10 @@ public String getType() {
97100
return type;
98101
}
99102

103+
public Long getStartId() {
104+
return startId;
105+
}
106+
100107
/////////////////////////////////////////////////////
101108
/////////////// API Implementation///////////////////
102109
/////////////////////////////////////////////////////

api/src/org/apache/cloudstack/api/response/EventResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public class EventResponse extends BaseResponse implements ControlledViewEntityR
7878
@Param(description = "the state of the event")
7979
private Event.State state;
8080

81-
@SerializedName("parentid")
81+
@SerializedName(ApiConstants.PARENT_ID)
8282
@Param(description = "whether the event is parented")
8383
private String parentId;
8484

engine/schema/src/com/cloud/user/UserAccountVO.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
import com.cloud.utils.db.Encrypt;
3535
import com.cloud.utils.db.GenericDao;
36+
import com.google.common.base.Strings;
3637

3738
@Entity
3839
@Table(name = "user")
@@ -257,6 +258,9 @@ public void setAccountState(String accountState) {
257258

258259
@Override
259260
public String getTimezone() {
261+
if (Strings.isNullOrEmpty(timezone)) {
262+
return "UTC";
263+
}
260264
return timezone;
261265
}
262266

engine/schema/src/com/cloud/user/UserVO.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import com.cloud.user.Account.State;
3535
import com.cloud.utils.db.Encrypt;
3636
import com.cloud.utils.db.GenericDao;
37+
import com.google.common.base.Strings;
3738

3839
/**
3940
* A bean representing a user
@@ -233,6 +234,9 @@ public void setSecretKey(String secretKey) {
233234

234235
@Override
235236
public String getTimezone() {
237+
if (Strings.isNullOrEmpty(timezone)) {
238+
return "UTC";
239+
}
236240
return timezone;
237241
}
238242

server/src/com/cloud/api/query/QueryManagerImpl.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ private Pair<List<EventJoinVO>, Integer> searchForEventsInternal(ListEventsCmd c
520520
String keyword = cmd.getKeyword();
521521
Integer entryTime = cmd.getEntryTime();
522522
Integer duration = cmd.getDuration();
523+
Long startId = cmd.getStartId();
523524

524525
Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<Long, Boolean, ListProjectResourcesCriteria>(
525526
cmd.getDomainId(), cmd.isRecursive(), null);
@@ -542,7 +543,7 @@ private Pair<List<EventJoinVO>, Integer> searchForEventsInternal(ListEventsCmd c
542543
sb.and("createDateG", sb.entity().getCreateDate(), SearchCriteria.Op.GTEQ);
543544
sb.and("createDateL", sb.entity().getCreateDate(), SearchCriteria.Op.LTEQ);
544545
sb.and("state", sb.entity().getState(), SearchCriteria.Op.NEQ);
545-
sb.and("startId", sb.entity().getStartId(), SearchCriteria.Op.EQ);
546+
sb.or("startId", sb.entity().getStartId(), SearchCriteria.Op.EQ);
546547
sb.and("createDate", sb.entity().getCreateDate(), SearchCriteria.Op.BETWEEN);
547548
sb.and("displayEvent", sb.entity().getDisplay(), SearchCriteria.Op.EQ);
548549
sb.and("archived", sb.entity().getArchived(), SearchCriteria.Op.EQ);
@@ -561,6 +562,13 @@ private Pair<List<EventJoinVO>, Integer> searchForEventsInternal(ListEventsCmd c
561562
sc.setParameters("id", id);
562563
}
563564

565+
if (startId != null) {
566+
sc.setParameters("startId", startId);
567+
if (id == null) {
568+
sc.setParameters("id", startId);
569+
}
570+
}
571+
564572
if (keyword != null) {
565573
SearchCriteria<EventJoinVO> ssc = _eventJoinDao.createSearchCriteria();
566574
ssc.addOr("type", SearchCriteria.Op.LIKE, "%" + keyword + "%");

ui/css/cloudstack3.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ a:hover {
9696

9797
/*Table*/
9898
table {
99-
width: 940px;
99+
width: 955px;
100100
max-width: 977px;
101101
margin: 15px 15px 12px 12px;
102102
font-size: 13px;
@@ -1307,7 +1307,6 @@ div.panel div.list-view {
13071307

13081308
div.panel div.list-view div.data-table table {
13091309
width: 955px;
1310-
margin-top: 44px;
13111310
}
13121311

13131312
.detail-view div.list-view div.data-table table {

ui/l10n/en.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ var dictionary = {"ICMP.code":"ICMP Code",
558558
"label.console.proxy.vm":"Console Proxy VM",
559559
"label.continue":"Continue",
560560
"label.continue.basic.install":"Continue with basic installation",
561+
"label.control.ip":"Control IP",
561562
"label.copying.iso":"Copying ISO",
562563
"label.corrections.saved":"Corrections saved",
563564
"label.counter":"Counter",
@@ -751,6 +752,7 @@ var dictionary = {"ICMP.code":"ICMP Code",
751752
"label.event":"Event",
752753
"label.event.archived":"Event Archived",
753754
"label.event.deleted":"Event Deleted",
755+
"label.event.timeline":"Event Timeline",
754756
"label.every":"Every",
755757
"label.example":"Example",
756758
"label.expunge":"Expunge",
@@ -995,6 +997,7 @@ var dictionary = {"ICMP.code":"ICMP Code",
995997
"label.manage":"Manage",
996998
"label.manage.resources":"Manage Resources",
997999
"label.managed":"Managed",
1000+
"label.managed.state":"Managed State",
9981001
"label.management":"Management",
9991002
"label.management.ips":"Management IP Addresses",
10001003
"label.management.server":"Management Server",

ui/scripts/events.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@
4646
label: 'label.type',
4747
truncate: true
4848
},
49-
domain: {
50-
label: 'label.domain'
51-
},
5249
account: {
5350
label: 'label.account'
5451
},
52+
domain: {
53+
label: 'label.domain'
54+
},
5555
created: {
5656
label: 'label.date',
5757
converter: cloudStack.converters.toLocalDate
@@ -338,6 +338,14 @@
338338
var data = {};
339339
listViewDataProvider(args, data);
340340

341+
if ("events" in args.context) {
342+
var startId = args.context.events[0].parentid;
343+
if (!startId) {
344+
startId = args.context.events[0].id;
345+
}
346+
data.startid = startId;
347+
}
348+
341349
$.ajax({
342350
url: createURL('listEvents'),
343351
data: data,
@@ -357,8 +365,12 @@
357365
},
358366
detailView: {
359367
name: 'label.details',
360-
actions: {
368+
viewAll: {
369+
path: 'events',
370+
label: 'label.event.timeline',
371+
},
361372

373+
actions: {
362374
// Remove single event
363375
remove: {
364376
label: 'label.delete',

0 commit comments

Comments
 (0)