Copilot commented on code in PR #13642:
URL: https://github.com/apache/cloudstack/pull/13642#discussion_r3604208112


##########
ui/src/components/view/ListView.vue:
##########
@@ -655,8 +655,7 @@
       <template v-if="column.key === 'usageType'">
         {{ usageTypeMap[record.usagetype] }}
       </template>
-
-      <template v-if="column.key === 'clustername'">
+<template v-if="column.key === 'clustername'">

Review Comment:
   This <template> tag is missing the indentation used by surrounding blocks, 
which makes the template harder to read and is inconsistent with the rest of 
this file.



##########
ui/src/components/view/ListView.vue:
##########
@@ -690,19 +689,24 @@
             </span>
           </template>
         </template>
-        <template v-if="text">
+        <template v-else-if="text">
           <template v-if="!text.startsWith('PrjAcct-')">
             <router-link
-              v-if="$route.path.startsWith('/quotasummary') && 
$router.resolve(`${$route.path}/${record.accountid}`).matched[0].redirect !== 
'/exception/404'"
+              v-if="$route.path.startsWith('/quotasummary')"
               :to="{ path: `${$route.path}/${record.accountid}` }">{{ text 
}}</router-link>
-            <span v-else>{{ text }}</span>
-          </template>
-          <template v-else>
+            <router-link v-else-if="record.accountid" :to="{ path: '/account/' 
+ record.accountid }">{{ text }}</router-link>
             <router-link
-              v-if="$route.path.startsWith('/quotasummary') && 
$router.resolve(`${$route.path}/${record.accountid}`).matched[0].redirect !== 
'/exception/404'"
-              :to="{ path: `${$route.path}/${record.accountid}` }">{{ 
(record.projectname || record.account).concat(' 
(').concat($t('label.project')).concat(')') }}</router-link>
+              v-else-if="$store.getters.userInfo.roletype !== 'User'"
+              :to="{ path: '/account', query: { name: record.account, 
domainid: record.domainid, dataView: true } }">
+              {{ text }}
+            </router-link>
             <span v-else>{{ text }}</span>

Review Comment:
   This branch renders an /account/:id link even for roletype === 'User'. In 
the existing record.owner path above, Users are intentionally shown plain text 
(no link). As-is, regular Users may get a clickable link that leads to an 
unauthorized/404 view.



##########
ui/src/components/view/ListView.vue:
##########
@@ -690,19 +689,24 @@
             </span>
           </template>
         </template>
-        <template v-if="text">
+        <template v-else-if="text">
           <template v-if="!text.startsWith('PrjAcct-')">
             <router-link
-              v-if="$route.path.startsWith('/quotasummary') && 
$router.resolve(`${$route.path}/${record.accountid}`).matched[0].redirect !== 
'/exception/404'"
+              v-if="$route.path.startsWith('/quotasummary')"
               :to="{ path: `${$route.path}/${record.accountid}` }">{{ text 
}}</router-link>
-            <span v-else>{{ text }}</span>
-          </template>
-          <template v-else>
+            <router-link v-else-if="record.accountid" :to="{ path: '/account/' 
+ record.accountid }">{{ text }}</router-link>
             <router-link
-              v-if="$route.path.startsWith('/quotasummary') && 
$router.resolve(`${$route.path}/${record.accountid}`).matched[0].redirect !== 
'/exception/404'"
-              :to="{ path: `${$route.path}/${record.accountid}` }">{{ 
(record.projectname || record.account).concat(' 
(').concat($t('label.project')).concat(')') }}</router-link>
+              v-else-if="$store.getters.userInfo.roletype !== 'User'"
+              :to="{ path: '/account', query: { name: record.account, 
domainid: record.domainid, dataView: true } }">
+              {{ text }}
+            </router-link>
             <span v-else>{{ text }}</span>
           </template>
+          <template v-else-if="$route.path.startsWith('/quotasummary')">
+            <router-link :to="{ path: `${$route.path}/${record.accountid}` }">
+              {{ (record.projectname || record.account).concat(' 
(').concat($t('label.project')).concat(')') }}
+            </router-link>
+          </template>

Review Comment:
   When text starts with 'PrjAcct-' and the current route is NOT /quotasummary, 
this block renders nothing (no link and no span), leaving the Account cell 
blank. There should be a non-quotasummary fallback render for project accounts 
similar to the quotasummary label formatting.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to