This is an automated email from the ASF dual-hosted git repository.

nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new f8920b9312 ui,api: fix api resourcename and user/project event 
resource (#6315)
f8920b9312 is described below

commit f8920b9312651694a0f613aa834884581564cb89
Author: Abhishek Kumar <[email protected]>
AuthorDate: Wed Apr 27 08:02:18 2022 +0530

    ui,api: fix api resourcename and user/project event resource (#6315)
    
    For user and project dashborad event resource details were not showing as 
shown in admin dashboard.
    API, UI shows name of the resource as event resourcename. Changed it to 
displaytext of the resource for consistency
    
    Signed-off-by: Abhishek Kumar <[email protected]>
---
 server/src/main/java/com/cloud/event/dao/EventJoinDaoImpl.java | 2 +-
 ui/src/views/dashboard/UsageDashboard.vue                      | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/com/cloud/event/dao/EventJoinDaoImpl.java 
b/server/src/main/java/com/cloud/event/dao/EventJoinDaoImpl.java
index a177d8d556..c73f57529b 100644
--- a/server/src/main/java/com/cloud/event/dao/EventJoinDaoImpl.java
+++ b/server/src/main/java/com/cloud/event/dao/EventJoinDaoImpl.java
@@ -54,7 +54,7 @@ public class EventJoinDaoImpl extends 
GenericDaoBase<EventJoinVO, Long> implemen
     EntityManager entityMgr;
 
     private String getResourceName(Object obj) {
-        String[] possibleMethods = {"getDisplayName", "getHostName","getName", 
"getAccountName", "getUsername"};
+        String[] possibleMethods = {"getDisplayName", "getDisplayText", 
"getHostName", "getName", "getAccountName", "getUsername"};
         for (String possibleMethodName : possibleMethods) {
             try {
                 Method m = obj.getClass().getMethod(possibleMethodName);
diff --git a/ui/src/views/dashboard/UsageDashboard.vue 
b/ui/src/views/dashboard/UsageDashboard.vue
index 677414221b..77eb16ef49 100644
--- a/ui/src/views/dashboard/UsageDashboard.vue
+++ b/ui/src/views/dashboard/UsageDashboard.vue
@@ -86,6 +86,7 @@
                 :color="getEventColour(event)">
                 <span :style="{ color: '#999' }"><small>{{ 
$toLocaleDate(event.created) }}</small></span><br/>
                 <span :style="{ color: '#666' }"><small><router-link :to="{ 
path: '/event/' + event.id }">{{ event.type }}</router-link></small></span><br/>
+                <resource-label :resourceType="event.resourcetype" 
:resourceId="event.resourceid" :resourceName="event.resourcename" />
                 <span :style="{ color: '#aaa' }">({{ event.username }}) {{ 
event.description }}</span>
               </a-timeline-item>
             </a-timeline>
@@ -102,12 +103,14 @@ import store from '@/store'
 
 import ChartCard from '@/components/widgets/ChartCard'
 import UsageDashboardChart from '@/views/dashboard/UsageDashboardChart'
+import ResourceLabel from '@/components/widgets/ResourceLabel'
 
 export default {
   name: 'UsageDashboard',
   components: {
     ChartCard,
-    UsageDashboardChart
+    UsageDashboardChart,
+    ResourceLabel
   },
   props: {
     resource: {

Reply via email to