PMCORE-3319:Number of cases tooltip is not consistent in PMCORE_3.7.0 build

This commit is contained in:
Fabio Guachalla
2021-09-17 16:22:13 -04:00
parent afa1dc5e21
commit dd4731bba9

View File

@@ -2,15 +2,14 @@
<span <span
:id="`label-${data.id}`" :id="`label-${data.id}`"
@mouseover="hoverHandler" @mouseover="hoverHandler"
v-b-tooltip.hover
@mouseleave="unhoverHandler" @mouseleave="unhoverHandler"
v-bind:class="{highlightText: isHighlight}" v-bind:class="{highlightText: isHighlight, loadingTooltip: isLoading}"
> >
{{ data.title }} {{ data.title }}
<b-tooltip <b-tooltip
:target="`label-${data.id}`" :target="`label-${data.id}`"
triggers="hoverHandler" :show.sync="showTooltip"
:ref="`tooltip-${data.id}`" v-if="showTooltip"
> >
{{ labelTooltip }} {{ labelTooltip }}
</b-tooltip> </b-tooltip>
@@ -36,7 +35,10 @@ export default {
CASES_PAUSED: "paused", CASES_PAUSED: "paused",
CASES_SELFSERVICE: "unassigned" CASES_SELFSERVICE: "unassigned"
}, },
isHighlight: false isHighlight: false,
showTooltip: false,
isLoading: false,
loading: ""
}; };
}, },
methods: { methods: {
@@ -44,15 +46,16 @@ export default {
* Delay the hover event * Delay the hover event
*/ */
hoverHandler() { hoverHandler() {
this.isLoading = true;
this.hovering = setTimeout(() => { this.setTooltip() }, 3000); this.hovering = setTimeout(() => { this.setTooltip() }, 3000);
}, },
/** /**
* Reset the delay and hide the tooltip * Reset the delay and hide the tooltip
*/ */
unhoverHandler() { unhoverHandler() {
let key = `tooltip-${this.data.id}`;
this.labelTooltip = ""; this.labelTooltip = "";
this.$refs[key].$emit("close"); this.showTooltip = false;
this.isLoading = false;
clearTimeout(this.hovering); clearTimeout(this.hovering);
}, },
/** /**
@@ -61,9 +64,9 @@ export default {
setTooltip() { setTooltip() {
let that = this; let that = this;
api.menu.getTooltip(that.data.page).then((response) => { api.menu.getTooltip(that.data.page).then((response) => {
let key = `tooltip-${that.data.id}`; that.showTooltip = true;
that.isLoading = false;
that.labelTooltip = response.data.label; that.labelTooltip = response.data.label;
that.$refs[key].$emit("open");
}); });
}, },
/** /**
@@ -79,4 +82,7 @@ export default {
.highlightText { .highlightText {
font-weight: 900; font-weight: 900;
} }
.loadingTooltip {
cursor: wait;
}
</style> </style>