Skip to content

Commit

Permalink
add tooltip to show decimal/octal rep
Browse files Browse the repository at this point in the history
  • Loading branch information
fariss committed Aug 16, 2024
1 parent 348e0b3 commit 854759c
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion web/explorer/src/components/columns/RuleColumn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@
<template v-else-if="node.data.type === 'feature'">
<span>
- {{ node.data.typeValue }}:
<span :class="{ 'text-green-700': node.data.typeValue !== 'regex' }" class="font-monospace">
<span
:class="{ 'text-green-700': node.data.typeValue !== 'regex' }"
class="font-monospace"
v-tooltip.top="{
value: getTooltipContent(node.data),
showDelay: 1000,
hideDelay: 300
}"
>
{{ node.data.name }}
</span>
</span>
Expand Down Expand Up @@ -63,4 +71,14 @@ defineProps({
required: true
}
});
const getTooltipContent = (data) => {
if (data.typeValue === "number" || data.typeValue === "offset") {
const decimalValue = parseInt(data.name, 16);
const octalValue = "0o" + decimalValue.toString(8);
return `Decimal: ${decimalValue}
Octal: ${octalValue}`;
}
return null;
};
</script>

0 comments on commit 854759c

Please sign in to comment.