Skip to content

Commit fcf45e2

Browse files
authored
fix: tooltip not clickable on overview tab (#1645)
Signed-off-by: Efren Lim <elim@linuxfoundation.org>
1 parent c037129 commit fcf45e2

File tree

4 files changed

+57
-20
lines changed

4 files changed

+57
-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: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,56 @@ 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+
:disabled="scoreDisplay[option.value as keyof typeof scoreDisplay]"
16+
>
17+
<template #content>
18+
<p
19+
v-if="!scoreDisplay[option.value as keyof typeof scoreDisplay]"
20+
class="max-w-60"
21+
>
22+
{{ option.label }} metrics are unavailable because the required data isn't available for this project.
23+
<a
24+
:href="links.securityScore"
25+
target="_blank"
26+
rel="noopener noreferrer"
27+
class="text-brand-500"
28+
>Learn more</a
29+
>
30+
</p>
31+
</template>
1332
<div
14-
class="text-sm tab-label"
33+
class="flex flex-col gap-2 items-start"
1534
:class="{
16-
'text-neutral-400': !scoreDisplay[option.value as keyof typeof scoreDisplay],
17-
'text-neutral-900': scoreDisplay[option.value as keyof typeof scoreDisplay],
35+
'cursor-not-allowed': !scoreDisplay[option.value as keyof typeof scoreDisplay],
1836
}"
1937
>
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%"
38+
<div
39+
class="text-sm tab-label"
40+
:class="{
41+
'text-neutral-400': !scoreDisplay[option.value as keyof typeof scoreDisplay],
42+
'text-neutral-900': scoreDisplay[option.value as keyof typeof scoreDisplay],
43+
}"
2744
>
28-
<lfx-progress-bar
29-
size="small"
30-
:values="[getValues(option.value)]"
31-
:color="getColor(getValues(option.value))"
32-
/>
33-
</lfx-skeleton-state>
45+
{{ option.label }}
46+
</div>
47+
<div class="text-sm text-gray-500 w-full">
48+
<lfx-skeleton-state
49+
:status="status"
50+
height=".188rem"
51+
width="100%"
52+
>
53+
<lfx-progress-bar
54+
size="small"
55+
:values="[getValues(option.value)]"
56+
:color="getColor(getValues(option.value))"
57+
/>
58+
</lfx-skeleton-state>
59+
</div>
3460
</div>
35-
</div>
61+
</lfx-tooltip>
3662
</template>
3763
</lfx-tabs>
3864
<template
@@ -85,6 +111,8 @@ import type { ScoreDisplay } from '~~/types/overview/score-display.types';
85111
import LfxProjectLoadState from '~~/app/components/modules/project/components/shared/load-state.vue';
86112
import LfxSkeletonState from '~/components/modules/project/components/shared/skeleton-state.vue';
87113
import type { WidgetArea } from '~/components/modules/widget/types/widget-area';
114+
import { links } from '~/config/links';
115+
import LfxTooltip from '~/components/uikit/tooltip/tooltip.vue';
88116
89117
const props = defineProps<{
90118
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)