Skip to content

Commit

Permalink
area/ui: strip attributes from context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
yomete committed Feb 25, 2025
1 parent 2d9db72 commit 0f2e829
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ const MetricsContextMenu = ({
<Item
key={label.name}
id={label.name}
onClick={() => onAddLabelMatcher({key: label.name, value: label.value})}
onClick={() => {
onAddLabelMatcher({
key: transformUtilizationLabels(label.name, utilizationMetrics),
value: label.value,
});
}}
className="max-w-[400px] overflow-hidden"
>
<div className="mr-3 inline-block rounded-lg bg-gray-200 px-2 py-1 text-xs font-bold text-gray-700 dark:bg-gray-700 dark:text-gray-300">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,14 +446,15 @@ const RawUtilizationMetrics = ({
<g className="lines fill-transparent">
{series.map((s, i) => {
let isSelected = false;
if (
selectedSeriesMatchers != null &&
selectedSeriesMatchers.length > 0 &&
selectedSeriesMatchers.length === s.metric.length
) {
if (selectedSeriesMatchers != null && selectedSeriesMatchers.length > 0) {
isSelected = selectedSeriesMatchers.every(m => {
for (let i = 0; i < s.metric.length; i++) {
if (s.metric[i].name === m.key && s.metric[i].value === m.value) {
if (
s.metric[i].name
.replace('attributes_resource.', '')
.replace('attributes.', '') === m.key &&
s.metric[i].value === m.value
) {
return true;
}
}
Expand Down

0 comments on commit 0f2e829

Please sign in to comment.