diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-12 15:11:32 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-12 15:11:32 +0300 |
commit | 3b260cb69f464d8dea681b747dcffdeebee348ff (patch) | |
tree | bcebf3e2fcae7b4c69822b9c9fcffae5f71ce078 /app/assets/javascripts/super_sidebar | |
parent | 7b3a8386ceeeb87b6e7e2e5ac00365f0d063cbb8 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/super_sidebar')
-rw-r--r-- | app/assets/javascripts/super_sidebar/components/nav_item.vue | 21 | ||||
-rw-r--r-- | app/assets/javascripts/super_sidebar/event_hub.js | 3 |
2 files changed, 18 insertions, 6 deletions
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; + } + }, }, }; </script> @@ -249,7 +258,7 @@ export default { 'hide-on-focus-or-hover--target transition-opacity-on-hover--target': isPinnable, }" > - {{ pillData }} + {{ pillCount }} </gl-badge> </span> </component> diff --git a/app/assets/javascripts/super_sidebar/event_hub.js b/app/assets/javascripts/super_sidebar/event_hub.js new file mode 100644 index 00000000000..e31806ad199 --- /dev/null +++ b/app/assets/javascripts/super_sidebar/event_hub.js @@ -0,0 +1,3 @@ +import createEventHub from '~/helpers/event_hub_factory'; + +export default createEventHub(); |