Commit 7846d317 authored by Zack Cuddy's avatar Zack Cuddy

Geo 2.0 Regression - Broken Popovers

Two bugs:

1. Wrong title was causing the
popovers to get confused and show
the wrong data.

2. Mobile/Desktop used the same
naming convention causing popovers
to not work on mobile size
screens.
parent 25c73c95
...@@ -28,6 +28,11 @@ export default { ...@@ -28,6 +28,11 @@ export default {
type: Object, type: Object,
required: true, required: true,
}, },
target: {
type: String,
required: false,
default: null,
},
}, },
computed: { computed: {
queuedCount() { queuedCount() {
...@@ -42,6 +47,9 @@ export default { ...@@ -42,6 +47,9 @@ export default {
successCount() { successCount() {
return toNumber(this.values.success) || 0; return toNumber(this.values.success) || 0;
}, },
popoverTarget() {
return this.target ? this.target : `syncProgress-${this.title}`;
},
}, },
}; };
</script> </script>
...@@ -49,7 +57,7 @@ export default { ...@@ -49,7 +57,7 @@ export default {
<template> <template>
<div> <div>
<stacked-progress-bar <stacked-progress-bar
:id="`syncProgress-${title}`" :id="popoverTarget"
tabindex="0" tabindex="0"
hide-tooltips hide-tooltips
:unavailable-label="$options.i18n.unavailableLabel" :unavailable-label="$options.i18n.unavailableLabel"
...@@ -58,7 +66,7 @@ export default { ...@@ -58,7 +66,7 @@ export default {
:total-count="totalCount" :total-count="totalCount"
/> />
<gl-popover <gl-popover
:target="`syncProgress-${title}`" :target="popoverTarget"
placement="right" placement="right"
triggers="hover focus" triggers="hover focus"
:css-classes="['w-100']" :css-classes="['w-100']"
......
...@@ -17,7 +17,8 @@ export default { ...@@ -17,7 +17,8 @@ export default {
), ),
learnMore: __('Learn more'), learnMore: __('Learn more'),
nA: __('N/A'), nA: __('N/A'),
progressBarTitle: s__('Geo|%{component} synced'), progressBarSyncTitle: s__('Geo|%{component} synced'),
progressBarVerifTitle: s__('Geo|%{component} verified'),
}, },
components: { components: {
GlIcon, GlIcon,
...@@ -81,7 +82,8 @@ export default { ...@@ -81,7 +82,8 @@ export default {
<div class="gl-mr-5" data-testid="sync-status"> <div class="gl-mr-5" data-testid="sync-status">
<geo-node-progress-bar <geo-node-progress-bar
v-if="item.syncValues" v-if="item.syncValues"
:title="sprintf($options.i18n.progressBarTitle, { component: item.component })" :title="sprintf($options.i18n.progressBarSyncTitle, { component: item.component })"
:target="`sync-progress-${item.component}`"
:values="item.syncValues" :values="item.syncValues"
/> />
<span v-else class="gl-text-gray-400 gl-font-sm">{{ $options.i18n.nA }}</span> <span v-else class="gl-text-gray-400 gl-font-sm">{{ $options.i18n.nA }}</span>
...@@ -89,7 +91,8 @@ export default { ...@@ -89,7 +91,8 @@ export default {
<div data-testid="verification-status"> <div data-testid="verification-status">
<geo-node-progress-bar <geo-node-progress-bar
v-if="item.verificationValues" v-if="item.verificationValues"
:title="sprintf($options.i18n.progressBarTitle, { component: item.component })" :title="sprintf($options.i18n.progressBarVerifTitle, { component: item.component })"
:target="`verification-progress-${item.component}`"
:values="item.verificationValues" :values="item.verificationValues"
/> />
<span v-else class="gl-text-gray-400 gl-font-sm">{{ $options.i18n.nA }}</span> <span v-else class="gl-text-gray-400 gl-font-sm">{{ $options.i18n.nA }}</span>
......
...@@ -25,7 +25,8 @@ export default { ...@@ -25,7 +25,8 @@ export default {
<span class="gl-font-sm gl-mb-3">{{ translations.syncStatus }}</span> <span class="gl-font-sm gl-mb-3">{{ translations.syncStatus }}</span>
<geo-node-progress-bar <geo-node-progress-bar
v-if="item.syncValues" v-if="item.syncValues"
:title="sprintf(translations.progressBarTitle, { component: item.component })" :title="sprintf(translations.progressBarSyncTitle, { component: item.component })"
:target="`mobile-sync-progress-${item.component}`"
:values="item.syncValues" :values="item.syncValues"
/> />
<span v-else class="gl-text-gray-400 gl-font-sm">{{ translations.nA }}</span> <span v-else class="gl-text-gray-400 gl-font-sm">{{ translations.nA }}</span>
...@@ -34,7 +35,8 @@ export default { ...@@ -34,7 +35,8 @@ export default {
<span class="gl-font-sm gl-mb-3">{{ translations.verifStatus }}</span> <span class="gl-font-sm gl-mb-3">{{ translations.verifStatus }}</span>
<geo-node-progress-bar <geo-node-progress-bar
v-if="item.verificationValues" v-if="item.verificationValues"
:title="sprintf(translations.progressBarTitle, { component: item.component })" :title="sprintf(translations.progressBarVerifTitle, { component: item.component })"
:target="`mobile-verification-progress-${item.component}`"
:values="item.verificationValues" :values="item.verificationValues"
/> />
<span v-else class="gl-text-gray-400 gl-font-sm">{{ translations.nA }}</span> <span v-else class="gl-text-gray-400 gl-font-sm">{{ translations.nA }}</span>
......
...@@ -65,5 +65,33 @@ describe('GeoNodeProgressBar', () => { ...@@ -65,5 +65,33 @@ describe('GeoNodeProgressBar', () => {
}); });
}); });
}); });
describe('popoverTarget', () => {
describe('when target prop is null', () => {
beforeEach(() => {
createComponent();
});
it(`sets the popoverTarget to syncProgress-${MOCK_PRIMARY_VERIFICATION_INFO[0].title}`, () => {
expect(findStackedProgressBar().attributes('id')).toBe(
`syncProgress-${MOCK_PRIMARY_VERIFICATION_INFO[0].title}`,
);
expect(findGlPopover().attributes('target')).toBe(
`syncProgress-${MOCK_PRIMARY_VERIFICATION_INFO[0].title}`,
);
});
});
describe('when target prop is set', () => {
beforeEach(() => {
createComponent({ target: 'test-target' });
});
it('sets the popoverTarget to test-target', () => {
expect(findStackedProgressBar().attributes('id')).toBe('test-target');
expect(findGlPopover().attributes('target')).toBe('test-target');
});
});
});
}); });
}); });
...@@ -14,7 +14,8 @@ describe('GeoNodeReplicationStatusMobile', () => { ...@@ -14,7 +14,8 @@ describe('GeoNodeReplicationStatusMobile', () => {
}, },
translations: { translations: {
nA: 'N/A', nA: 'N/A',
progressBarTitle: '%{component} synced', progressBarSyncTitle: '%{component} synced',
progressBarVerifTitle: '%{component} verified',
}, },
}; };
......
...@@ -14532,6 +14532,9 @@ msgstr "" ...@@ -14532,6 +14532,9 @@ msgstr ""
msgid "Geo|%{component} synced" msgid "Geo|%{component} synced"
msgstr "" msgstr ""
msgid "Geo|%{component} verified"
msgstr ""
msgid "Geo|%{eventId} (%{timeAgo})" msgid "Geo|%{eventId} (%{timeAgo})"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment