Copilot commented on code in PR #826:
URL:
https://github.com/apache/skywalking-banyandb/pull/826#discussion_r2464308907
##########
ui/src/components/TraceTree/Table/TableItem.vue:
##########
@@ -101,20 +101,32 @@ limitations under the License. -->
const tagsDialogVisible = ref(false);
const MAX_VISIBLE_TAGS = 1;
- const outterPercent = computed(() => {
+ const execPercent = computed(() => {
if (props.data.level === 1) {
return '100%';
}
- const exec = props.data.endTime - props.data.startTime ?
props.data.endTime - props.data.startTime : 0;
- let result = (exec / props.data.totalExec) * 100;
- result = result > 100 ? 100 : result;
- const resultStr = result.toFixed(2) + '%';
- return resultStr === '0.00%' ? '0.9%' : resultStr;
+ const exec = props.data.endTime - props.data.startTime;
+ if (exec < 0) {
+ return '-';
+ }
+ const result = (exec / props.data.totalExec) * 100;
+ if (isNaN(result)) {
+ return '-';
+ }
+ if (result <= 0) {
+ return '0';
+ }
+ return `${result.toFixed(2)}%`;
});
- const innerPercent = computed(() => {
+ const durationPercent = computed(() => {
const result = (props.data.selfDuration / props.data.duration) * 100;
- const resultStr = result.toFixed(2) + '%';
- return resultStr === '0.00%' ? '0.9%' : resultStr;
+ if (isNaN(result)) {
+ return '-';
+ }
+ if (result <= 0) {
+ return '0';
Review Comment:
The function returns '0' (string) instead of '0%' for consistency with other
percentage returns. This creates inconsistent display formatting where some
outputs have '%' and others don't.
##########
ui/src/components/TraceTree/Table/TableItem.vue:
##########
@@ -101,20 +101,32 @@ limitations under the License. -->
const tagsDialogVisible = ref(false);
const MAX_VISIBLE_TAGS = 1;
- const outterPercent = computed(() => {
+ const execPercent = computed(() => {
if (props.data.level === 1) {
return '100%';
}
- const exec = props.data.endTime - props.data.startTime ?
props.data.endTime - props.data.startTime : 0;
- let result = (exec / props.data.totalExec) * 100;
- result = result > 100 ? 100 : result;
- const resultStr = result.toFixed(2) + '%';
- return resultStr === '0.00%' ? '0.9%' : resultStr;
+ const exec = props.data.endTime - props.data.startTime;
+ if (exec < 0) {
+ return '-';
+ }
+ const result = (exec / props.data.totalExec) * 100;
+ if (isNaN(result)) {
+ return '-';
+ }
+ if (result <= 0) {
+ return '0';
Review Comment:
The function returns '0' (string) instead of '0%' for consistency with other
percentage returns. This creates inconsistent display formatting where some
outputs have '%' and others don't.
--
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]