diff --git a/resources/assets/js/api/Menu.js b/resources/assets/js/api/Menu.js index 1ffcd2b0a..aa1a1be45 100644 --- a/resources/assets/js/api/Menu.js +++ b/resources/assets/js/api/Menu.js @@ -42,5 +42,21 @@ export let menu = { "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 + } + }); } }; diff --git a/resources/assets/js/components/menu/CustomSidebarMenuItem.vue b/resources/assets/js/components/menu/CustomSidebarMenuItem.vue index 4a937b359..340ee1b45 100644 --- a/resources/assets/js/components/menu/CustomSidebarMenuItem.vue +++ b/resources/assets/js/components/menu/CustomSidebarMenuItem.vue @@ -37,8 +37,12 @@ isMobileItem " > + - + { + 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 * @param {string} href diff --git a/resources/assets/js/components/utils/CustomTooltip.vue b/resources/assets/js/components/utils/CustomTooltip.vue index abb42dd3d..ecb31f6f3 100644 --- a/resources/assets/js/components/utils/CustomTooltip.vue +++ b/resources/assets/js/components/utils/CustomTooltip.vue @@ -2,10 +2,16 @@ {{ data.title }} - + {{ labelTooltip }} @@ -17,21 +23,20 @@ import api from "./../../api/index"; export default { name: "CustomTooltip", props: { - data: Object, + data: Object }, data() { return { labelTooltip: "", + hovering: "", + show: false, menuMap: { CASES_INBOX: "inbox", CASES_DRAFT: "draft", CASES_PAUSED: "paused", - CASES_SELFSERVICE: "unassigned", - todo: "inbox", - draft: "draft", - paused: "paused", - unassigned: "unassigned", + CASES_SELFSERVICE: "unassigned" }, + isHighlight: false }; }, methods: { @@ -39,7 +44,7 @@ export default { * Delay the hover event */ hoverHandler() { - this.setTooltip(); + this.hovering = setTimeout(() => { this.setTooltip() }, 3000); }, /** * Reset the delay and hide the tooltip @@ -48,6 +53,7 @@ export default { let key = `tooltip-${this.data.id}`; this.labelTooltip = ""; this.$refs[key].$emit("close"); + clearTimeout(this.hovering); }, /** * Set the label to show in the tooltip @@ -58,8 +64,20 @@ export default { let key = `tooltip-${that.data.id}`; that.labelTooltip = response.data.label; that.$refs[key].$emit("open"); + that.isHighlight = false; }); }, + /** + * Set bold the label + */ + setHighlight() { + this.isHighlight = true; + } }, }; + diff --git a/resources/assets/js/home/Home.vue b/resources/assets/js/home/Home.vue index 98d9d63d5..a2fcee340 100644 --- a/resources/assets/js/home/Home.vue +++ b/resources/assets/js/home/Home.vue @@ -116,7 +116,7 @@ export default { this.getUserSettings(); this.listenerIframe(); window.setInterval( - this.setCounter, + this.getHighlight, parseInt(window.config.FORMATS.casesListRefreshTime) * 1000 ); // adding eventBus listener @@ -163,7 +163,7 @@ export default { .then((response) => { this.setDefaultCasesMenu(response.data); this.menu = this.mappingMenu(this.setDefaultIcon(response.data)); - this.setCounter(); + this.getHighlight(); }) .catch((e) => { console.error(e); @@ -287,6 +287,7 @@ export default { ); data[i]["sortable"] = data[i].customCasesList.length > 1; data[i]["sortIcon"] = "gear-fill"; + data[i]['highlight'] = false; data[i] = { component: CustomSidebarMenuItem, props: { @@ -488,6 +489,29 @@ export default { onUpdateFilters(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); + }); + } + } } }; diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Home.php b/workflow/engine/src/ProcessMaker/Services/Api/Home.php index 8cd465936..6ec5bdc90 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Home.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Home.php @@ -6,6 +6,7 @@ use Exception; use G; use Luracast\Restler\RestException; use Menu; +use ProcessMaker\BusinessModel\Cases\CasesList; use ProcessMaker\BusinessModel\Cases\Draft; use ProcessMaker\BusinessModel\Cases\Filter; use ProcessMaker\BusinessModel\Cases\Home as BMHome;