Copilot commented on code in PR #817:
URL: 
https://github.com/apache/skywalking-banyandb/pull/817#discussion_r2443680608


##########
ui/src/components/Trace/TraceRead.vue:
##########
@@ -152,11 +155,10 @@
 name: ${data.name}
 offset: 0
 limit: 10
-tagProjection: ["start_time", "service_id"]
+tagProjection: ${data.indexRule?.tags?.length > 0 ? 
`[${data.indexRule?.tags}]` : []}

Review Comment:
   The fallback [] is a JavaScript array which coerces to an empty string when 
interpolated, resulting in an invalid YAML line like 'tagProjection: ' and 
causing yamlToJson to fail. Also, interpolating [${data.indexRule?.tags}] uses 
Array.toString(), dropping quotes and escaping for string values. Replace with 
a stringified array to produce valid YAML in both cases, e.g.: tagProjection: 
${Array.isArray(data.indexRule?.tags) && data.indexRule.tags.length ? 
JSON.stringify(data.indexRule.tags) : '[]'}.
   ```suggestion
   tagProjection: ${Array.isArray(data.indexRule?.tags) && 
data.indexRule.tags.length ? JSON.stringify(data.indexRule.tags) : '[]'}
   ```



##########
ui/src/components/Trace/TraceRead.vue:
##########
@@ -87,13 +93,13 @@
     try {
       const response = await getindexRuleList(data.group);
       if (response.status === 200 && response.data.indexRule && 
response.data.indexRule.length > 0) {
-        data.indexRule = response.data.indexRule[0].metadata;
+        data.indexRule = response.data.indexRule[0];
       } else {
-        data.indexRule = '';
+        data.indexRule = null;
       }
     } catch (err) {
       console.error('Failed to fetch indexRule:', err);
-      data.indexRule = '';
+      data.indexRule = null;
       ElMessage({
         message: 'Failed to fetch index rule: ' + err,

Review Comment:
   Concatenating err may render '[object Object]'. Prefer err?.message or 
String(err) to show a meaningful message, e.g., message: `Failed to fetch index 
rule: ${err?.message || String(err)}`.
   ```suggestion
           message: 'Failed to fetch index rule: ' + (err?.message || 
String(err)),
   ```



-- 
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