Skip to content

Commit

Permalink
Merge pull request rancher#11880 from momesgin/11763-floating-vue-fixes
Browse files Browse the repository at this point in the history
Fix Tooltip and Dropdown issues
  • Loading branch information
rak-phillip authored Sep 17, 2024
2 parents 7bbcf9c + 567a1e4 commit 6e02fbb
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default defineComponent({
>
<template v-if="hover">
<i
v-clean-tooltip="isObject(value) ? { ...{content: value.content, classes: [`tooltip-${status}`]}, ...value } : value"
v-clean-tooltip="isObject(value) ? { ...{content: value.content, popperClass: [`tooltip-${status}`]}, ...value } : value"
:class="{'hover':!value, [iconClass]: true}"
class="icon status-icon"
/>
Expand Down Expand Up @@ -92,39 +92,10 @@ export default defineComponent({
z-index: z-index(hoverOverContent);
}
// I DON'T THINK iT NEEDS FiXING... I think we delete it... CHECK EDIT->PODS->GENERAL TAB-> PULL SECRETS ::TODO-ALEX
.tooltip {
position: absolute;
width: calc(100% + 2px);
top: calc(100% + 6px);
.tooltip-arrow {
right: 30px;
}
.tooltip-inner {
padding: 10px;
}
}
@mixin tooltipColors($color) {
.status-icon {
color: $color;
}
.tooltip {
.tooltip-inner {
color: var(--input-bg);
background: $color;
border-color: $color;
}
.tooltip-arrow {
border-bottom-color: $color;
&:after {
border: none;
}
}
}
}
&.error {
Expand All @@ -146,9 +117,9 @@ export default defineComponent({
}
// Ensure code blocks inside tootips don't look awful
.tooltip {
.tooltip-inner {
> pre {
.v-popper__popper.v-popper--theme-tooltip {
.v-popper__inner {
pre {
padding: 2px;
vertical-align: middle;
}
Expand Down
9 changes: 9 additions & 0 deletions shell/assets/styles/global/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ HEADER {
outline: 0;
}

&[data-popper-placement^="top"] {
.v-popper__arrow-container {
.v-popper__arrow-inner {
top: 0;
border-color: var(--tooltip-bg);
}
}
}

li {
padding: 8px 20px;

Expand Down
14 changes: 13 additions & 1 deletion shell/assets/styles/global/_tooltip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
color: var(--popover-text);
padding: 10px;
border-radius: var(--border-radius);
box-shadow: 0 5px 20px var(--shadow);
border: none;

a {
Expand All @@ -133,6 +132,19 @@

.v-popper__arrow-container {
border-color: transparent;
.v-popper__arrow-outer {
border-color: transparent;
}
}
}

.v-popper__popper.v-popper--theme-dropdown {
z-index: z-index('tooltip');

&.containerLogsDropdown {
.v-popper__arrow-container {
display: none;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion shell/components/ActionDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default {
placement="bottom"
:container="false"
:disabled="disableButton"
:popper-options="{modifiers: { flip: { enabled: false } } }"
:flip="false"
>
<slot
name="button-content"
Expand Down
6 changes: 4 additions & 2 deletions shell/components/LocaleSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ export default {
<div v-if="mode === 'login'">
<div v-if="showLocale">
<v-dropdown
popover-class="localeSelector"
popperClass="localeSelector"
placement="top"
trigger="click"
distance="8"
skidding="12"
:triggers="['click']"
>
<a
data-testid="locale-selector"
Expand Down
2 changes: 1 addition & 1 deletion shell/components/auth/SelectPrincipal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default {
v-clean-tooltip="{
content: tooltipContent,
placement: 'bottom',
classes: ['select-principal-tooltip']
popperClass: ['select-principal-tooltip']
}"
:mode="mode"
:label="label"
Expand Down
4 changes: 2 additions & 2 deletions shell/components/fleet/FleetStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ function toPercent(value, min, max) {
ref="popover"
placement="bottom-end"
offset="-10"
trigger="manual"
:triggers="[]"
:delay="{show: 0, hide: 0}"
:popper-options="{modifiers: { flip: { enabled: false } } }"
:flip="false"
:container="false"
>
<div class="meta-title">
Expand Down
4 changes: 2 additions & 2 deletions shell/components/formatter/AppSummaryGraph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ export default {
v-if="show"
class="text-center hand"
placement="top"
:open-group="row.id"
:trigger="show ? 'click' : 'manual'"
:show-group="row.id"
:triggers="show ? ['click'] : []"
offset="1"
>
<ProgressBarMulti
Expand Down
4 changes: 2 additions & 2 deletions shell/components/formatter/FleetSummaryGraph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export default {
v-if="show"
class="text-center hand"
placement="top"
:open-group="row.id"
:trigger="show ? 'click' : 'manual'"
:show-group="row.id"
:triggers="show ? ['click'] : []"
offset="1"
>
<ProgressBarMulti
Expand Down
4 changes: 2 additions & 2 deletions shell/components/formatter/MachineSummaryGraph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export default {
<v-dropdown
class="text-center hand machine-summary-graph"
placement="top"
:open-group="row.id"
trigger="click"
:show-group="row.id"
:triggers="['click']"
offset="1"
>
<template #popper>
Expand Down
4 changes: 2 additions & 2 deletions shell/components/formatter/Scale.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export default {
<v-dropdown
:class="{'hand': showHover}"
placement="top"
:open-group="row.id"
:trigger="showHover ? 'click' : 'manual'"
:show-group="row.id"
:triggers="showHover ? ['click'] : []"
offset="1"
>
<span>
Expand Down
4 changes: 2 additions & 2 deletions shell/components/formatter/Weight.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export default {
<v-dropdown
:class="{'hand': canAdjust}"
placement="top"
:open-group="row.id"
:trigger="canAdjust ? 'click' : 'manual'"
:show-group="row.id"
:triggers="canAdjust ? ['click'] : []"
offset="1"
@apply-show="onShown"
>
Expand Down
2 changes: 1 addition & 1 deletion shell/components/nav/NamespaceFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ export default {
}
</style>
<style lang="scss">
.tooltip {
.v-popper__popper {
.ns-filter-tooltip {
background-color: var(--body-bg);
margin: -6px;
Expand Down
8 changes: 4 additions & 4 deletions shell/components/nav/TopLevelMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ export default {
let contentText = '';
let content;
let classes = '';
let popperClass = '';
// this is the normal tooltip scenario where we are just passing a string
if (typeof item === 'string') {
Expand All @@ -415,7 +415,7 @@ export default {
} else {
contentText = item.label;
// this adds a class to the tooltip container so that we can control the max width
classes = 'menu-description-tooltip';
popperClass = 'menu-description-tooltip';
if (item.description) {
contentText += `<br><br>${ item.description }`;
Expand All @@ -427,15 +427,15 @@ export default {
content = this.shown ? contentText : null;
// this adds a class to adjust tooltip position so it doesn't overlap the cluster pinning action
classes += ' description-tooltip-pos-adjustment';
popperClass += ' description-tooltip-pos-adjustment';
}
}
return {
content,
placement: 'right',
popperOptions: { modifiers: { preventOverflow: { enabled: false }, hide: { enabled: false } } },
classes
popperClass
};
},
}
Expand Down
3 changes: 2 additions & 1 deletion shell/components/nav/WindowManager/ContainerLogs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,9 @@ export default {
<div class="log-action log-action-group ml-5">
<v-dropdown
trigger="click"
:triggers="['click']"
placement="top"
popperClass="containerLogsDropdown"
>
<button class="btn bg-primary btn-cog">
<i class="icon icon-gear" />
Expand Down
4 changes: 2 additions & 2 deletions shell/detail/helm.cattle.io.projecthelmchart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ export default {
ref="popover"
placement="bottom-end"
offset="-10"
trigger="manual"
:triggers="[]"
:delay="{show: 0, hide: 0}"
:popper-options="{modifiers: { flip: { enabled: false } } }"
:flip="false"
:container="false"
>
<div class="meta-title">
Expand Down

0 comments on commit 6e02fbb

Please sign in to comment.