Commit 726ef151 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'cat-geo-progressbar-with-multiple-targets' into 'master'

Scope Geo replication details progress bar popup target by site ID

See merge request gitlab-org/gitlab!83637
parents ee817dcf ddbe90ac
...@@ -113,11 +113,13 @@ export default { ...@@ -113,11 +113,13 @@ export default {
<div v-if="!collapsed"> <div v-if="!collapsed">
<geo-node-replication-details-responsive <geo-node-replication-details-responsive
class="gl-display-none gl-md-display-block" class="gl-display-none gl-md-display-block"
:node-id="node.id"
:replication-items="replicationItems" :replication-items="replicationItems"
data-testid="geo-replication-details-desktop" data-testid="geo-replication-details-desktop"
/> />
<geo-node-replication-details-responsive <geo-node-replication-details-responsive
class="gl-md-display-none!" class="gl-md-display-none!"
:node-id="node.id"
:replication-items="replicationItems" :replication-items="replicationItems"
data-testid="geo-replication-details-mobile" data-testid="geo-replication-details-mobile"
> >
......
...@@ -29,6 +29,11 @@ export default { ...@@ -29,6 +29,11 @@ export default {
GeoNodeProgressBar, GeoNodeProgressBar,
}, },
props: { props: {
nodeId: {
type: Number,
required: false,
default: 0,
},
replicationItems: { replicationItems: {
type: Array, type: Array,
required: false, required: false,
...@@ -85,7 +90,7 @@ export default { ...@@ -85,7 +90,7 @@ export default {
<geo-node-progress-bar <geo-node-progress-bar
v-if="item.syncValues" v-if="item.syncValues"
:title="sprintf($options.i18n.progressBarSyncTitle, { component: item.component })" :title="sprintf($options.i18n.progressBarSyncTitle, { component: item.component })"
:target="`sync-progress-${item.component}`" :target="`sync-progress-${nodeId}-${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>
...@@ -94,7 +99,7 @@ export default { ...@@ -94,7 +99,7 @@ export default {
<geo-node-progress-bar <geo-node-progress-bar
v-if="item.verificationValues" v-if="item.verificationValues"
:title="sprintf($options.i18n.progressBarVerifTitle, { component: item.component })" :title="sprintf($options.i18n.progressBarVerifTitle, { component: item.component })"
:target="`verification-progress-${item.component}`" :target="`verification-progress-${nodeId}-${item.component}`"
:values="item.verificationValues" :values="item.verificationValues"
:success-label="$options.i18n.verified" :success-label="$options.i18n.verified"
:unavailable-label="$options.i18n.nothingToVerify" :unavailable-label="$options.i18n.nothingToVerify"
......
...@@ -10,6 +10,7 @@ describe('GeoNodeReplicationDetailsResponsive', () => { ...@@ -10,6 +10,7 @@ describe('GeoNodeReplicationDetailsResponsive', () => {
const defaultProps = { const defaultProps = {
replicationItems: [], replicationItems: [],
nodeId: 0,
}; };
const createComponent = (props, slots) => { const createComponent = (props, slots) => {
...@@ -92,7 +93,7 @@ describe('GeoNodeReplicationDetailsResponsive', () => { ...@@ -92,7 +93,7 @@ describe('GeoNodeReplicationDetailsResponsive', () => {
${'with all data'} | ${[{ dataTypeTitle: 'Test Title', component: 'Test Component', syncValues: { total: 100, success: 0 }, verificationValues: { total: 50, success: 50 } }]} | ${true} | ${true} ${'with all data'} | ${[{ dataTypeTitle: 'Test Title', component: 'Test Component', syncValues: { total: 100, success: 0 }, verificationValues: { total: 50, success: 50 } }]} | ${true} | ${true}
`('$description', ({ replicationItems, renderSyncProgress, renderVerifProgress }) => { `('$description', ({ replicationItems, renderSyncProgress, renderVerifProgress }) => {
beforeEach(() => { beforeEach(() => {
createComponent({ replicationItems }); createComponent({ replicationItems, nodeId: 42 });
}); });
it('renders sync progress correctly', () => { it('renders sync progress correctly', () => {
...@@ -102,6 +103,14 @@ describe('GeoNodeReplicationDetailsResponsive', () => { ...@@ -102,6 +103,14 @@ describe('GeoNodeReplicationDetailsResponsive', () => {
expect( expect(
extendedWrapper(findFirstReplicationDetailsItemSyncStatus()).findByText('N/A').exists(), extendedWrapper(findFirstReplicationDetailsItemSyncStatus()).findByText('N/A').exists(),
).toBe(!renderSyncProgress); ).toBe(!renderSyncProgress);
if (renderSyncProgress) {
expect(
findFirstReplicationDetailsItemSyncStatus()
.findComponent(GeoNodeProgressBar)
.props('target'),
).toBe('sync-progress-42-Test Component');
}
}); });
it('renders verification progress correctly', () => { it('renders verification progress correctly', () => {
...@@ -113,6 +122,14 @@ describe('GeoNodeReplicationDetailsResponsive', () => { ...@@ -113,6 +122,14 @@ describe('GeoNodeReplicationDetailsResponsive', () => {
.findByText('N/A') .findByText('N/A')
.exists(), .exists(),
).toBe(!renderVerifProgress); ).toBe(!renderVerifProgress);
if (renderVerifProgress) {
expect(
findFirstReplicationDetailsItemVerifStatus()
.findComponent(GeoNodeProgressBar)
.props('target'),
).toBe('verification-progress-42-Test Component');
}
}); });
}); });
}); });
......
...@@ -191,15 +191,17 @@ describe('GeoNodeReplicationDetails', () => { ...@@ -191,15 +191,17 @@ describe('GeoNodeReplicationDetails', () => {
}); });
it('passes the correct props to the mobile replication details', () => { it('passes the correct props to the mobile replication details', () => {
expect(findGeoMobileReplicationDetails().props('replicationItems')).toStrictEqual( expect(findGeoMobileReplicationDetails().props()).toStrictEqual({
expectedProps, replicationItems: expectedProps,
); nodeId: MOCK_NODES[1].id,
});
}); });
it('passes the correct props to the desktop replication details', () => { it('passes the correct props to the desktop replication details', () => {
expect(findGeoDesktopReplicationDetails().props('replicationItems')).toStrictEqual( expect(findGeoDesktopReplicationDetails().props()).toStrictEqual({
expectedProps, replicationItems: expectedProps,
); nodeId: MOCK_NODES[1].id,
});
}); });
it(`does ${hasNAVerificationHelpText ? '' : 'not '}show N/A verification help text`, () => { it(`does ${hasNAVerificationHelpText ? '' : 'not '}show N/A verification help text`, () => {
......
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