Commit 9cf6bae8 authored by Kushal Pandya's avatar Kushal Pandya Committed by Kushal Pandya

Hide sync status when event timestamp is not present

parent c6978285
......@@ -32,6 +32,9 @@
syncType() {
return this.namespaces.length > 0 ? s__('GeoNodes|Selective') : s__('GeoNodes|Full');
},
eventTimestampEmpty() {
return this.lastEvent.timeStamp === 0 || this.cursorLastEvent.timeStamp === 0;
},
syncLagInSeconds() {
return this.lagInSeconds(this.lastEvent.timeStamp, this.cursorLastEvent.timeStamp);
},
......@@ -79,7 +82,8 @@
return `${timeAgoStr} (${pendingEvents} events)`;
},
statusTooltip(lagInSeconds) {
if (lagInSeconds <= TIME_DIFF.FIVE_MINS) {
if (this.eventTimestampEmpty ||
lagInSeconds <= TIME_DIFF.FIVE_MINS) {
return '';
} else if (lagInSeconds > TIME_DIFF.FIVE_MINS &&
lagInSeconds <= TIME_DIFF.HOUR) {
......@@ -107,6 +111,7 @@
css-classes="sync-status-icon prepend-left-5"
/>
<span
v-if="!eventTimestampEmpty"
class="sync-status-event-info prepend-left-5"
>
{{ syncStatusEventInfo }}
......
......@@ -27,6 +27,26 @@ describe('GeoNodeSyncSettingsComponent', () => {
vm.$destroy();
});
});
describe('eventTimestampEmpty', () => {
it('returns `true` if one of the event timestamp is empty', () => {
const vmEmptyTimestamp = createComponent(mockNodeDetails.namespaces, {
id: 0,
timeStamp: 0,
}, {
id: 0,
timeStamp: 0,
});
expect(vmEmptyTimestamp.eventTimestampEmpty).toBeTruthy();
vmEmptyTimestamp.$destroy();
});
it('return `false` if one of the event timestamp is present', () => {
const vm = createComponent();
expect(vm.eventTimestampEmpty).toBeFalsy();
vm.$destroy();
});
});
});
describe('methods', () => {
......
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