PMCORE-3065

Corrections

CR

Corrections

remove ref
This commit is contained in:
fabio
2021-07-22 16:12:03 -04:00
parent 0585f8fd8d
commit 16a16e2ec6
3 changed files with 94 additions and 2 deletions

View File

@@ -25,5 +25,22 @@ export let menu = {
"Accept-Language": window.config.SYS_LANG
}
});
},
/**
* Get the counter of a specific task
* @param {string} task
* @returns
*/
getTooltip(task) {
return axios.get(
window.config.SYS_SERVER_API +
'/api/1.0/' +
window.config.SYS_WORKSPACE +
'/home/'+ task +'/counter', {
headers: {
'Authorization': 'Bearer ' + window.config.SYS_CREDENTIALS.accessToken,
"Accept-Language": window.config.SYS_LANG
}
});
}
};

View File

@@ -34,7 +34,7 @@
"
>
<span class="vsm--title">
{{ item.title }}
<custom-tooltip :data="item"></custom-tooltip>
<b-icon
v-if="item.sortable"
:icon="item.sortIcon"
@@ -139,7 +139,7 @@
</div>
</draggable>
<template #modal-footer="{ ok, cancel, hide }">
<template #modal-footer="{ cancel }">
<b-button size="sm" variant="danger" @click="cancel()">
Cancel
</b-button>
@@ -153,6 +153,8 @@
import draggable from "vuedraggable";
import CustomSidebarMenuLink from "./CustomSidebarMenuLink";
import CustomSidebarMenuIcon from "./CustomSidebarMenuIcon";
import CustomTooltip from "./../utils/CustomTooltip.vue";
export default {
name: "CustomSidebarMenuItem",
props: {
@@ -201,6 +203,7 @@ export default {
draggable,
CustomSidebarMenuLink,
CustomSidebarMenuIcon,
CustomTooltip
},
data() {
return {
@@ -210,6 +213,7 @@ export default {
itemHover: false,
exactActive: false,
active: false,
titleHover: '',
};
},
computed: {

View File

@@ -0,0 +1,71 @@
<template>
<span
:id="data.id"
@mouseover="hoverHandler"
v-b-tooltip.hover
:title="labelTooltip"
@mouseleave="unhoverHandler"
>
{{ data.title }}
<b-tooltip
:target="data.id"
triggers="hoverHandler"
:show.sync="show"
>
{{ labelTooltip }}
</b-tooltip>
</span>
</template>
<script>
import api from "./../../api/index";
export default {
name: "CustomTooltip",
props: {
data: Object,
},
data() {
return {
labelTooltip: "",
hovering: "",
show: false,
menuMap: {
CASES_INBOX: "inbox",
CASES_DRAFT: "draft",
CASES_PAUSED: "paused",
CASES_SELFSERVICE: "unassigned"
}
}
},
methods: {
/**
* Delay the hover event
*/
hoverHandler() {
this.hovering = setTimeout(() => { this.setTooltip() }, 3000);
},
/**
* Reset the delay and hide the tooltip
*/
unhoverHandler() {
this.labelTooltip = "";
this.show = false;
clearTimeout(this.hovering);
},
/**
* Set the label to show in the tooltip
*/
setTooltip() {
let that = this;
api.menu
.getTooltip(that.menuMap[that.data.id])
.then((response) => {
that.labelTooltip = response.data.label;
that.show = true;
});
},
}
}
</script>