Merge branch 'feature/PMCORE-3049' of https://bitbucket.org/colosa/processmaker into feature/PMCORE-3122

This commit is contained in:
Henry Jordan
2021-08-27 18:22:41 +00:00
5 changed files with 92 additions and 12 deletions

View File

@@ -42,5 +42,21 @@ export let menu = {
"Accept-Language": window.config.SYS_LANG "Accept-Language": window.config.SYS_LANG
} }
}); });
},
/**
* Get the highlight
* @returns
*/
getHighlight() {
return axios.get(
window.config.SYS_SERVER_API +
'/api/1.0/' +
window.config.SYS_WORKSPACE +
'/home/tasks/highlight', {
headers: {
'Authorization': 'Bearer ' + window.config.SYS_CREDENTIALS.accessToken,
"Accept-Language": window.config.SYS_LANG
}
});
} }
}; };

View File

@@ -37,8 +37,12 @@
isMobileItem isMobileItem
" "
> >
<span class="vsm--title"> <span class="vsm--title">
<custom-tooltip :data="item"></custom-tooltip> <custom-tooltip
:data="item"
ref="tooltip"
></custom-tooltip>
<b-icon <b-icon
v-if="item.sortable" v-if="item.sortable"
:icon="item.sortIcon" :icon="item.sortIcon"
@@ -220,6 +224,9 @@ export default {
titleHover: "", titleHover: "",
}; };
}, },
mounted() {
this.setHighlight();
},
computed: { computed: {
isCollapsed() { isCollapsed() {
return this.$parent.isCollapsed; return this.$parent.isCollapsed;
@@ -293,6 +300,20 @@ export default {
this.initState(); this.initState();
}, },
methods: { methods: {
/**
* set the highlight
*/
setHighlight() {
let that = this;
eventBus.$on('highlight', (data) => {
var i;
for (i = 0; i < data.length; i += 1) {
if (that.item.id && that.item.id === data[i].id) {
that.$refs.tooltip.setHighlight()
}
}
});
},
/** /**
* Match the route to ensure the correct location * Match the route to ensure the correct location
* @param {string} href * @param {string} href

View File

@@ -2,10 +2,16 @@
<span <span
:id="`label-${data.id}`" :id="`label-${data.id}`"
@mouseover="hoverHandler" @mouseover="hoverHandler"
:title="labelTooltip" v-b-tooltip.hover
@mouseleave="unhoverHandler"
v-bind:class="{highlightText: isHighlight}"
> >
{{ data.title }} {{ data.title }}
<b-tooltip :target="`label-${data.id}`" :ref="`tooltip-${data.id}`"> <b-tooltip
:target="`label-${data.id}`"
triggers="hoverHandler"
:ref="`tooltip-${data.id}`"
>
{{ labelTooltip }} {{ labelTooltip }}
</b-tooltip> </b-tooltip>
</span> </span>
@@ -17,21 +23,20 @@ import api from "./../../api/index";
export default { export default {
name: "CustomTooltip", name: "CustomTooltip",
props: { props: {
data: Object, data: Object
}, },
data() { data() {
return { return {
labelTooltip: "", labelTooltip: "",
hovering: "",
show: false,
menuMap: { menuMap: {
CASES_INBOX: "inbox", CASES_INBOX: "inbox",
CASES_DRAFT: "draft", CASES_DRAFT: "draft",
CASES_PAUSED: "paused", CASES_PAUSED: "paused",
CASES_SELFSERVICE: "unassigned", CASES_SELFSERVICE: "unassigned"
todo: "inbox",
draft: "draft",
paused: "paused",
unassigned: "unassigned",
}, },
isHighlight: false
}; };
}, },
methods: { methods: {
@@ -39,7 +44,7 @@ export default {
* Delay the hover event * Delay the hover event
*/ */
hoverHandler() { hoverHandler() {
this.setTooltip(); this.hovering = setTimeout(() => { this.setTooltip() }, 3000);
}, },
/** /**
* Reset the delay and hide the tooltip * Reset the delay and hide the tooltip
@@ -48,6 +53,7 @@ export default {
let key = `tooltip-${this.data.id}`; let key = `tooltip-${this.data.id}`;
this.labelTooltip = ""; this.labelTooltip = "";
this.$refs[key].$emit("close"); this.$refs[key].$emit("close");
clearTimeout(this.hovering);
}, },
/** /**
* Set the label to show in the tooltip * Set the label to show in the tooltip
@@ -58,8 +64,20 @@ export default {
let key = `tooltip-${that.data.id}`; let key = `tooltip-${that.data.id}`;
that.labelTooltip = response.data.label; that.labelTooltip = response.data.label;
that.$refs[key].$emit("open"); that.$refs[key].$emit("open");
that.isHighlight = false;
}); });
}, },
/**
* Set bold the label
*/
setHighlight() {
this.isHighlight = true;
}
}, },
}; };
</script> </script>
<style>
.highlightText {
font-weight: 900;
}
</style>

View File

@@ -116,7 +116,7 @@ export default {
this.getUserSettings(); this.getUserSettings();
this.listenerIframe(); this.listenerIframe();
window.setInterval( window.setInterval(
this.setCounter, this.getHighlight,
parseInt(window.config.FORMATS.casesListRefreshTime) * 1000 parseInt(window.config.FORMATS.casesListRefreshTime) * 1000
); );
// adding eventBus listener // adding eventBus listener
@@ -163,7 +163,7 @@ export default {
.then((response) => { .then((response) => {
this.setDefaultCasesMenu(response.data); this.setDefaultCasesMenu(response.data);
this.menu = this.mappingMenu(this.setDefaultIcon(response.data)); this.menu = this.mappingMenu(this.setDefaultIcon(response.data));
this.setCounter(); this.getHighlight();
}) })
.catch((e) => { .catch((e) => {
console.error(e); console.error(e);
@@ -287,6 +287,7 @@ export default {
); );
data[i]["sortable"] = data[i].customCasesList.length > 1; data[i]["sortable"] = data[i].customCasesList.length > 1;
data[i]["sortIcon"] = "gear-fill"; data[i]["sortIcon"] = "gear-fill";
data[i]['highlight'] = false;
data[i] = { data[i] = {
component: CustomSidebarMenuItem, component: CustomSidebarMenuItem,
props: { props: {
@@ -488,6 +489,29 @@ export default {
onUpdateFilters(filters) { onUpdateFilters(filters) {
this.filters = filters; this.filters = filters;
}, },
getHighlight() {
let that = this;
if (that.menu.length > 0) {
api.menu
.getHighlight()
.then((response) => {
var i,
dataHighlight = [];
for (i = 0; i < response.data.length; i += 1) {
if (response.data[i].highlight) {
dataHighlight.push({
id: that.menuMap[response.data[i].item],
highlight: response.data[i].highlight
});
}
}
eventBus.$emit('highlight', dataHighlight);
})
.catch((e) => {
console.error(e);
});
}
}
} }
}; };
</script> </script>

View File

@@ -6,6 +6,7 @@ use Exception;
use G; use G;
use Luracast\Restler\RestException; use Luracast\Restler\RestException;
use Menu; use Menu;
use ProcessMaker\BusinessModel\Cases\CasesList;
use ProcessMaker\BusinessModel\Cases\Draft; use ProcessMaker\BusinessModel\Cases\Draft;
use ProcessMaker\BusinessModel\Cases\Filter; use ProcessMaker\BusinessModel\Cases\Filter;
use ProcessMaker\BusinessModel\Cases\Home as BMHome; use ProcessMaker\BusinessModel\Cases\Home as BMHome;