mirror of https://github.com/apache/cloudstack.git
api, ui: listing archived events (#7396)
Fixes #7217 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
parent
59a2b3137e
commit
62b332e0de
|
|
@ -32,6 +32,7 @@ public class ApiConstants {
|
|||
public static final String ALLOCATED_ONLY = "allocatedonly";
|
||||
public static final String ANNOTATION = "annotation";
|
||||
public static final String API_KEY = "apikey";
|
||||
public static final String ARCHIVED = "archived";
|
||||
public static final String ASYNC_BACKUP = "asyncbackup";
|
||||
public static final String AUTO_SELECT = "autoselect";
|
||||
public static final String USER_API_KEY = "userapikey";
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ public class ListEventsCmd extends BaseListProjectAndAccountResourcesCmd {
|
|||
@Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, description = "the type of the resource associated with the event", since="4.17.0")
|
||||
private String resourceType;
|
||||
|
||||
@Parameter(name = ApiConstants.ARCHIVED, type = CommandType.BOOLEAN, description = "true to list archived events otherwise false", since="4.19.0")
|
||||
private Boolean archived;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -116,6 +119,10 @@ public class ListEventsCmd extends BaseListProjectAndAccountResourcesCmd {
|
|||
return resourceType;
|
||||
}
|
||||
|
||||
public boolean getArchived() {
|
||||
return archived != null && archived;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -93,6 +93,10 @@ public class EventResponse extends BaseResponse implements ControlledViewEntityR
|
|||
@Param(description = "whether the event is parented")
|
||||
private String parentId;
|
||||
|
||||
@SerializedName(ApiConstants.ARCHIVED)
|
||||
@Param(description = "whether the event has been archived or not")
|
||||
private Boolean archived;
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
|
@ -173,4 +177,8 @@ public class EventResponse extends BaseResponse implements ControlledViewEntityR
|
|||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public void setArchived(Boolean archived) {
|
||||
this.archived = archived;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -790,7 +790,9 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
|
|||
sc.setParameters("resourceType", resourceType.toString());
|
||||
}
|
||||
|
||||
sc.setParameters("archived", false);
|
||||
if (id == null) {
|
||||
sc.setParameters("archived", cmd.getArchived());
|
||||
}
|
||||
|
||||
Pair<List<EventJoinVO>, Integer> eventPair = null;
|
||||
// event_view will not have duplicate rows for each event, so
|
||||
|
|
|
|||
|
|
@ -110,6 +110,9 @@ public class EventJoinDaoImpl extends GenericDaoBase<EventJoinVO, Long> implemen
|
|||
responseEvent.setParentId(event.getStartUuid());
|
||||
responseEvent.setState(event.getState());
|
||||
responseEvent.setUsername(event.getUserName());
|
||||
if (event.getArchived()) {
|
||||
responseEvent.setArchived(true);
|
||||
}
|
||||
Long resourceId = event.getResourceId();
|
||||
responseEvent.setResourceType(event.getResourceType());
|
||||
ApiCommandResourceType resourceType = ApiCommandResourceType.fromString(event.getResourceType());
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@
|
|||
"label.action.vmsnapshot.revert": "Revert to VM snapshot",
|
||||
"label.action.vmstoragesnapshot.create": "Take VM volume snapshot",
|
||||
"label.actions": "Actions",
|
||||
"label.active": "Active",
|
||||
"label.activate.project": "Activate project",
|
||||
"label.activeviewersessions": "Active sessions",
|
||||
"label.add": "Add",
|
||||
|
|
@ -329,6 +330,7 @@
|
|||
"label.apply.tungsten.network.policy": "Apply Network Policy",
|
||||
"label.apply.tungsten.tag": "Apply tag",
|
||||
"label.archive": "Archive",
|
||||
"label.archived": "Archived",
|
||||
"label.archive.alerts": "Archive alerts",
|
||||
"label.archive.events": "Archive events",
|
||||
"label.as.default": "as default",
|
||||
|
|
|
|||
|
|
@ -84,6 +84,9 @@
|
|||
<a-tag v-if="resource.internetprotocol && ['IPv6', 'DualStack'].includes(resource.internetprotocol)">
|
||||
{{ resource.internetprotocol ? $t('label.ip.v4.v6') : resource.internetprotocol }}
|
||||
</a-tag>
|
||||
<a-tag v-if="resource.archived" :color="this.$config.theme['@warning-color']">
|
||||
{{ $t('label.archived') }}
|
||||
</a-tag>
|
||||
<a-tooltip placement="right" >
|
||||
<template #title>
|
||||
<span>{{ $t('label.view.console') }}</span>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ export default {
|
|||
title: 'label.event.timeline',
|
||||
param: 'startid'
|
||||
}],
|
||||
filters: () => {
|
||||
return ['active', 'archived']
|
||||
},
|
||||
actions: [
|
||||
{
|
||||
api: 'archiveEvents',
|
||||
|
|
@ -45,6 +48,12 @@ export default {
|
|||
ids: {
|
||||
value: (record) => { return record.id }
|
||||
}
|
||||
},
|
||||
show: (record) => {
|
||||
return !(record.archived)
|
||||
},
|
||||
groupShow: (selectedItems) => {
|
||||
return selectedItems.filter(x => { return !(x.archived) }).length > 0
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,12 +53,7 @@
|
|||
<a-select
|
||||
v-if="!dataView && filters && filters.length > 0"
|
||||
:placeholder="$t('label.filterby')"
|
||||
:value="$route.query.filter || (projectView && $route.name === 'vm' ||
|
||||
['Admin', 'DomainAdmin'].includes($store.getters.userInfo.roletype) && ['vm', 'iso', 'template'].includes($route.name)
|
||||
? 'all' : ['publicip'].includes($route.name)
|
||||
? 'allocated' : ['guestnetwork', 'guestvlans'].includes($route.name)
|
||||
? 'all' : ['volume'].includes($route.name)
|
||||
? 'user' : 'self')"
|
||||
:value="filterValue"
|
||||
style="min-width: 120px; margin-left: 10px"
|
||||
@change="changeFilter"
|
||||
showSearch
|
||||
|
|
@ -670,6 +665,25 @@ export default {
|
|||
return [...new Set(sizes)].sort(function (a, b) {
|
||||
return a - b
|
||||
}).map(String)
|
||||
},
|
||||
filterValue () {
|
||||
if (this.$route.query.filter) {
|
||||
return this.$route.query.filter
|
||||
}
|
||||
const routeName = this.$route.name
|
||||
if ((this.projectView && routeName === 'vm') || (['Admin', 'DomainAdmin'].includes(this.$store.getters.userInfo.roletype) && ['vm', 'iso', 'template'].includes(routeName)) || ['guestnetwork', 'guestvlans'].includes(routeName)) {
|
||||
return 'all'
|
||||
}
|
||||
if (['publicip'].includes(routeName)) {
|
||||
return 'allocated'
|
||||
}
|
||||
if (['volume'].includes(routeName)) {
|
||||
return 'user'
|
||||
}
|
||||
if (['event'].includes(routeName)) {
|
||||
return 'active'
|
||||
}
|
||||
return 'self'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -1593,6 +1607,12 @@ export default {
|
|||
} else if (filter === 'allocatedonly') {
|
||||
query.allocatedonly = 'true'
|
||||
}
|
||||
} else if (this.$route.name === 'event') {
|
||||
if (filter === 'archived') {
|
||||
query.archived = true
|
||||
} else {
|
||||
delete query.archived
|
||||
}
|
||||
}
|
||||
query.filter = filter
|
||||
query.page = '1'
|
||||
|
|
|
|||
Loading…
Reference in New Issue