From 3b260cb69f464d8dea681b747dcffdeebee348ff Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 12 Oct 2023 12:11:32 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../super_sidebar/components/nav_item.vue | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'app/assets/javascripts/super_sidebar/components') diff --git a/app/assets/javascripts/super_sidebar/components/nav_item.vue b/app/assets/javascripts/super_sidebar/components/nav_item.vue index 305e2f94c20..5416f86abeb 100644 --- a/app/assets/javascripts/super_sidebar/components/nav_item.vue +++ b/app/assets/javascripts/super_sidebar/components/nav_item.vue @@ -7,6 +7,7 @@ import { TRACKING_UNKNOWN_ID, TRACKING_UNKNOWN_PANEL, } from '~/super_sidebar/constants'; +import eventHub from '../event_hub'; import NavItemLink from './nav_item_link.vue'; import NavItemRouterLink from './nav_item_router_link.vue'; @@ -69,16 +70,14 @@ export default { return { isMouseIn: false, canClickPinButton: false, + pillCount: this.item.pill_count, }; }, computed: { - pillData() { - return this.item.pill_count; - }, hasPill() { return ( - Number.isFinite(this.pillData) || - (typeof this.pillData === 'string' && this.pillData !== '') + Number.isFinite(this.pillCount) || + (typeof this.pillCount === 'string' && this.pillCount !== '') ); }, isPinnable() { @@ -182,11 +181,21 @@ export default { if (this.item.is_active) { this.$el.scrollIntoView(false); } + + eventHub.$on('updatePillValue', this.updatePillValue); + }, + destroyed() { + eventHub.$off('updatePillValue', this.updatePillValue); }, methods: { togglePointerEvents() { this.canClickPinButton = this.isMouseIn; }, + updatePillValue({ value, itemId }) { + if (this.item.id === itemId) { + this.pillCount = value; + } + }, }, }; @@ -249,7 +258,7 @@ export default { 'hide-on-focus-or-hover--target transition-opacity-on-hover--target': isPinnable, }" > - {{ pillData }} + {{ pillCount }} -- cgit v1.2.3