Skip to content

Commit dfa6e7e

Browse files
committed
fix: tooltip not clickable on overview tab
Signed-off-by: Efren Lim <elim@linuxfoundation.org>
1 parent c037129 commit dfa6e7e

File tree

4 files changed

+66
-20
lines changed

4 files changed

+66
-20
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ node_modules
1212
**/.env*
1313
!.env.dist
1414
database/Dockerfile.flyway
15-
database/flyway_migrate.sh
15+
database/flyway_migrate.sh
16+
17+
**/AGENTS.md

frontend/app/components/modules/project/components/overview/score-details/score-tab-view.vue

Lines changed: 55 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,65 @@ SPDX-License-Identifier: MIT
99
:tabs="tabsOptions"
1010
>
1111
<template #slotItem="{ option }">
12-
<div class="flex flex-col gap-2 items-start">
12+
<lfx-tooltip
13+
class="!w-full"
14+
:allow-pass-through="true"
15+
>
16+
<template #content>
17+
<p
18+
v-if="!scoreDisplay[option.value as keyof typeof scoreDisplay]"
19+
class="max-w-60"
20+
>
21+
{{ option.label }} metrics are unavailable because the required data isn't available for this project.
22+
<a
23+
:href="links.securityScore"
24+
target="_blank"
25+
class="text-brand-500"
26+
>Learn more</a
27+
>
28+
</p>
29+
<p
30+
v-else
31+
class="max-w-60"
32+
>
33+
<a
34+
:href="links.securityScore"
35+
target="_blank"
36+
class="text-brand-500"
37+
>Learn more</a
38+
>
39+
</p>
40+
</template>
1341
<div
14-
class="text-sm tab-label"
42+
class="flex flex-col gap-2 items-start"
1543
:class="{
16-
'text-neutral-400': !scoreDisplay[option.value as keyof typeof scoreDisplay],
17-
'text-neutral-900': scoreDisplay[option.value as keyof typeof scoreDisplay],
44+
'cursor-not-allowed': !scoreDisplay[option.value as keyof typeof scoreDisplay],
1845
}"
1946
>
20-
{{ option.label }}
21-
</div>
22-
<div class="text-sm text-gray-500 w-full">
23-
<lfx-skeleton-state
24-
:status="status"
25-
height=".188rem"
26-
width="100%"
47+
<div
48+
class="text-sm tab-label"
49+
:class="{
50+
'text-neutral-400': !scoreDisplay[option.value as keyof typeof scoreDisplay],
51+
'text-neutral-900': scoreDisplay[option.value as keyof typeof scoreDisplay],
52+
}"
2753
>
28-
<lfx-progress-bar
29-
size="small"
30-
:values="[getValues(option.value)]"
31-
:color="getColor(getValues(option.value))"
32-
/>
33-
</lfx-skeleton-state>
54+
{{ option.label }}
55+
</div>
56+
<div class="text-sm text-gray-500 w-full">
57+
<lfx-skeleton-state
58+
:status="status"
59+
height=".188rem"
60+
width="100%"
61+
>
62+
<lfx-progress-bar
63+
size="small"
64+
:values="[getValues(option.value)]"
65+
:color="getColor(getValues(option.value))"
66+
/>
67+
</lfx-skeleton-state>
68+
</div>
3469
</div>
35-
</div>
70+
</lfx-tooltip>
3671
</template>
3772
</lfx-tabs>
3873
<template
@@ -85,6 +120,8 @@ import type { ScoreDisplay } from '~~/types/overview/score-display.types';
85120
import LfxProjectLoadState from '~~/app/components/modules/project/components/shared/load-state.vue';
86121
import LfxSkeletonState from '~/components/modules/project/components/shared/skeleton-state.vue';
87122
import type { WidgetArea } from '~/components/modules/widget/types/widget-area';
123+
import { links } from '~/config/links';
124+
import LfxTooltip from '~/components/uikit/tooltip/tooltip.vue';
88125
89126
const props = defineProps<{
90127
trustScoreSummary: TrustScoreSummary | undefined;

frontend/app/components/uikit/popover/popover.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const props = withDefaults(
4747
matchWidth?: boolean;
4848
isModal?: boolean;
4949
popoverClass?: string;
50+
allowPassThrough?: boolean;
5051
}>(),
5152
{
5253
placement: 'bottom-start',
@@ -57,6 +58,7 @@ const props = withDefaults(
5758
matchWidth: false,
5859
isModal: false,
5960
popoverClass: '',
61+
allowPassThrough: false,
6062
},
6163
);
6264
@@ -128,7 +130,9 @@ const closePopover = () => {
128130
};
129131
130132
const handleClick = (e: Event) => {
131-
e.stopPropagation();
133+
if (!props.allowPassThrough) {
134+
e.stopPropagation();
135+
}
132136
if (props.triggerEvent === 'click') {
133137
if (isVisible.value) {
134138
closePopover();

frontend/app/components/uikit/tooltip/tooltip.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SPDX-License-Identifier: MIT
77
:placement="props.placement"
88
:disabled="props.disabled"
99
trigger-event="hover"
10+
:allow-pass-through="props.allowPassThrough"
1011
>
1112
<slot />
1213

@@ -32,11 +33,13 @@ const props = withDefaults(
3233
placement?: Placement;
3334
content?: string;
3435
disabled?: boolean;
36+
allowPassThrough?: boolean;
3537
}>(),
3638
{
3739
placement: 'top',
3840
content: '',
3941
disabled: false,
42+
allowPassThrough: false,
4043
},
4144
);
4245
</script>

0 commit comments

Comments
 (0)