Commit 7095dbfd authored by Zack Cuddy's avatar Zack Cuddy Committed by Phil Hughes

Geo 2.0 Regression - 51 years ago

parent ff814b89
...@@ -10,7 +10,7 @@ export default { ...@@ -10,7 +10,7 @@ export default {
otherInfo: __('Other information'), otherInfo: __('Other information'),
dbReplicationLag: s__('Geo|Data replication lag'), dbReplicationLag: s__('Geo|Data replication lag'),
lastEventId: s__('Geo|Last event ID from primary'), lastEventId: s__('Geo|Last event ID from primary'),
lastEvent: s__('Geo|%{eventId} (%{timeAgo})'), lastEventTime: s__('Geo|(%{timeAgo})'),
lastCursorEventId: s__('Geo|Last event ID processed by cursor'), lastCursorEventId: s__('Geo|Last event ID processed by cursor'),
storageConfig: s__('Geo|Storage config'), storageConfig: s__('Geo|Storage config'),
shardsNotMatched: s__('Geo|Does not match the primary storage configuration'), shardsNotMatched: s__('Geo|Does not match the primary storage configuration'),
...@@ -58,6 +58,12 @@ export default { ...@@ -58,6 +58,12 @@ export default {
// Converting timestamp to ms // Converting timestamp to ms
return this.node.cursorLastEventTimestamp * 1000; return this.node.cursorLastEventTimestamp * 1000;
}, },
hasEventInfo() {
return this.node.lastEventId || this.lastEventTimestamp;
},
hasCursorEventInfo() {
return this.node.cursorLastEventId || this.lastCursorEventTimestamp;
},
}, },
}; };
</script> </script>
...@@ -75,31 +81,31 @@ export default { ...@@ -75,31 +81,31 @@ export default {
</div> </div>
<div class="gl-display-flex gl-flex-direction-column gl-mb-5"> <div class="gl-display-flex gl-flex-direction-column gl-mb-5">
<span>{{ $options.i18n.lastEventId }}</span> <span>{{ $options.i18n.lastEventId }}</span>
<span class="gl-font-weight-bold gl-mt-2" data-testid="last-event"> <div class="gl-font-weight-bold gl-mt-2" data-testid="last-event">
<gl-sprintf v-if="node.lastEventId" :message="$options.i18n.lastEvent"> <template v-if="hasEventInfo">
<template #eventId> <span v-if="node.lastEventId">{{ node.lastEventId }}</span>
{{ node.lastEventId }} <gl-sprintf v-if="lastEventTimestamp" :message="$options.i18n.lastEventTime">
</template>
<template #timeAgo> <template #timeAgo>
<time-ago :time="lastEventTimestamp" /> <time-ago :time="lastEventTimestamp" />
</template> </template>
</gl-sprintf> </gl-sprintf>
</template>
<span v-else>{{ $options.i18n.unknown }}</span> <span v-else>{{ $options.i18n.unknown }}</span>
</span> </div>
</div> </div>
<div class="gl-display-flex gl-flex-direction-column gl-mb-5"> <div class="gl-display-flex gl-flex-direction-column gl-mb-5">
<span>{{ $options.i18n.lastCursorEventId }}</span> <span>{{ $options.i18n.lastCursorEventId }}</span>
<span class="gl-font-weight-bold gl-mt-2" data-testid="last-cursor-event"> <div class="gl-font-weight-bold gl-mt-2" data-testid="last-cursor-event">
<gl-sprintf v-if="node.cursorLastEventId" :message="$options.i18n.lastEvent"> <template v-if="hasCursorEventInfo">
<template #eventId> <span v-if="node.cursorLastEventId">{{ node.cursorLastEventId }}</span>
{{ node.cursorLastEventId }} <gl-sprintf v-if="lastCursorEventTimestamp" :message="$options.i18n.lastEventTime">
</template>
<template #timeAgo> <template #timeAgo>
<time-ago :time="lastCursorEventTimestamp" /> <time-ago :time="lastCursorEventTimestamp" />
</template> </template>
</gl-sprintf> </gl-sprintf>
</template>
<span v-else>{{ $options.i18n.unknown }}</span> <span v-else>{{ $options.i18n.unknown }}</span>
</span> </div>
</div> </div>
<div class="gl-display-flex gl-flex-direction-column gl-mb-5"> <div class="gl-display-flex gl-flex-direction-column gl-mb-5">
<span>{{ $options.i18n.storageConfig }}</span> <span>{{ $options.i18n.storageConfig }}</span>
......
...@@ -92,13 +92,14 @@ describe('GeoNodeSecondaryOtherInfo', () => { ...@@ -92,13 +92,14 @@ describe('GeoNodeSecondaryOtherInfo', () => {
describe.each` describe.each`
lastEvent | text lastEvent | text
${{ lastEventId: null, lastEventTimestamp: null }} | ${'Unknown'} ${{ lastEventId: null, lastEventTimestamp: null }} | ${'Unknown'}
${{ lastEventId: 1, lastEventTimestamp: 0 }} | ${'1'}
${{ lastEventId: 1, lastEventTimestamp: MOCK_JUST_NOW }} | ${'1 (just now)'} ${{ lastEventId: 1, lastEventTimestamp: MOCK_JUST_NOW }} | ${'1 (just now)'}
`(`last event`, ({ lastEvent, text }) => { `(`last event`, ({ lastEvent, text }) => {
beforeEach(() => { beforeEach(() => {
createComponent({ node: { ...lastEvent } }); createComponent({ node: { ...lastEvent } });
}); });
it(`renders correctly when lastEventId is ${lastEvent.lastEventId}`, () => { it(`renders correctly when lastEventId is ${lastEvent.lastEventId} and lastEventTimestamp is ${lastEvent.lastEventTimestamp}`, () => {
expect(findLastEvent().text().replace(/\s+/g, ' ')).toBe(text); expect(findLastEvent().text().replace(/\s+/g, ' ')).toBe(text);
}); });
}); });
...@@ -106,13 +107,14 @@ describe('GeoNodeSecondaryOtherInfo', () => { ...@@ -106,13 +107,14 @@ describe('GeoNodeSecondaryOtherInfo', () => {
describe.each` describe.each`
lastCursorEvent | text lastCursorEvent | text
${{ cursorLastEventId: null, cursorLastEventTimestamp: null }} | ${'Unknown'} ${{ cursorLastEventId: null, cursorLastEventTimestamp: null }} | ${'Unknown'}
${{ cursorLastEventId: 1, cursorLastEventTimestamp: 0 }} | ${'1'}
${{ cursorLastEventId: 1, cursorLastEventTimestamp: MOCK_JUST_NOW }} | ${'1 (just now)'} ${{ cursorLastEventId: 1, cursorLastEventTimestamp: MOCK_JUST_NOW }} | ${'1 (just now)'}
`(`last cursor event`, ({ lastCursorEvent, text }) => { `(`last cursor event`, ({ lastCursorEvent, text }) => {
beforeEach(() => { beforeEach(() => {
createComponent({ node: { ...lastCursorEvent } }); createComponent({ node: { ...lastCursorEvent } });
}); });
it(`renders correctly when cursorLastEventId is ${lastCursorEvent.cursorLastEventId}`, () => { it(`renders correctly when cursorLastEventId is ${lastCursorEvent.cursorLastEventId} and cursorLastEventTimestamp is ${lastCursorEvent.cursorLastEventTimestamp}`, () => {
expect(findLastCursorEvent().text().replace(/\s+/g, ' ')).toBe(text); expect(findLastCursorEvent().text().replace(/\s+/g, ' ')).toBe(text);
}); });
}); });
......
...@@ -14669,9 +14669,6 @@ msgstr "" ...@@ -14669,9 +14669,6 @@ msgstr ""
msgid "Geo|%{component} verified" msgid "Geo|%{component} verified"
msgstr "" msgstr ""
msgid "Geo|%{eventId} (%{timeAgo})"
msgstr ""
msgid "Geo|%{itemTitle} checksum progress" msgid "Geo|%{itemTitle} checksum progress"
msgstr "" msgstr ""
...@@ -14699,6 +14696,9 @@ msgstr "" ...@@ -14699,6 +14696,9 @@ msgstr ""
msgid "Geo|%{title} checksum progress" msgid "Geo|%{title} checksum progress"
msgstr "" msgstr ""
msgid "Geo|(%{timeAgo})"
msgstr ""
msgid "Geo|Add site" msgid "Geo|Add site"
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