Commit ab6ed602 authored by Zack Cuddy's avatar Zack Cuddy Committed by David O'Regan

Geo Node Status - Refactor Popovers

The Geo Node Progress Bars showed
some incorrect infomation based
on what data they were representing.

This change adds some custom props
to allow us to control the popover
labels.
parent b40d1ce7
<script> <script>
import { GlPopover, GlSprintf } from '@gitlab/ui'; import { GlPopover } from '@gitlab/ui';
import { toNumber } from 'lodash'; import { toNumber } from 'lodash';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
import StackedProgressBar from '~/vue_shared/components/stacked_progress_bar.vue'; import StackedProgressBar from '~/vue_shared/components/stacked_progress_bar.vue';
...@@ -7,16 +7,10 @@ import StackedProgressBar from '~/vue_shared/components/stacked_progress_bar.vue ...@@ -7,16 +7,10 @@ import StackedProgressBar from '~/vue_shared/components/stacked_progress_bar.vue
export default { export default {
name: 'GeoNodeSyncProgress', name: 'GeoNodeSyncProgress',
i18n: { i18n: {
unavailableLabel: s__('Geo|Nothing to synchronize'),
popoverTitle: s__('Geo|Number of %{title}'),
total: __('Total'), total: __('Total'),
synced: s__('Geo|Synced'),
queued: s__('Geo|Queued'),
failed: __('Failed'),
}, },
components: { components: {
GlPopover, GlPopover,
GlSprintf,
StackedProgressBar, StackedProgressBar,
}, },
props: { props: {
...@@ -33,6 +27,26 @@ export default { ...@@ -33,6 +27,26 @@ export default {
required: false, required: false,
default: null, default: null,
}, },
successLabel: {
type: String,
required: false,
default: s__('Geo|Synced'),
},
queuedLabel: {
type: String,
required: false,
default: s__('Geo|Queued'),
},
failedLabel: {
type: String,
required: false,
default: __('Failed'),
},
unavailableLabel: {
type: String,
required: false,
default: s__('Geo|Nothing to synchronize'),
},
}, },
computed: { computed: {
queuedCount() { queuedCount() {
...@@ -60,7 +74,7 @@ export default { ...@@ -60,7 +74,7 @@ export default {
:id="popoverTarget" :id="popoverTarget"
tabindex="0" tabindex="0"
hide-tooltips hide-tooltips
:unavailable-label="$options.i18n.unavailableLabel" :unavailable-label="unavailableLabel"
:success-count="successCount" :success-count="successCount"
:failure-count="failureCount" :failure-count="failureCount"
:total-count="totalCount" :total-count="totalCount"
...@@ -70,14 +84,8 @@ export default { ...@@ -70,14 +84,8 @@ export default {
placement="right" placement="right"
triggers="hover focus" triggers="hover focus"
:css-classes="['w-100']" :css-classes="['w-100']"
:title="title"
> >
<template #title>
<gl-sprintf :message="$options.i18n.popoverTitle">
<template #title>
{{ title }}
</template>
</gl-sprintf>
</template>
<section> <section>
<div class="gl-display-flex gl-align-items-center gl-my-3"> <div class="gl-display-flex gl-align-items-center gl-my-3">
<div class="gl-mr-3 gl-bg-transparent gl-w-5 gl-h-2"></div> <div class="gl-mr-3 gl-bg-transparent gl-w-5 gl-h-2"></div>
...@@ -86,17 +94,17 @@ export default { ...@@ -86,17 +94,17 @@ export default {
</div> </div>
<div class="gl-display-flex gl-align-items-center gl-my-3"> <div class="gl-display-flex gl-align-items-center gl-my-3">
<div class="gl-mr-3 gl-bg-green-500 gl-w-5 gl-h-2"></div> <div class="gl-mr-3 gl-bg-green-500 gl-w-5 gl-h-2"></div>
<span class="gl-flex-fill-1 gl-mr-4">{{ $options.i18n.synced }}</span> <span class="gl-flex-fill-1 gl-mr-4">{{ successLabel }}</span>
<span class="gl-font-weight-bold">{{ successCount.toLocaleString() }}</span> <span class="gl-font-weight-bold">{{ successCount.toLocaleString() }}</span>
</div> </div>
<div class="gl-display-flex gl-align-items-center gl-my-3"> <div class="gl-display-flex gl-align-items-center gl-my-3">
<div class="gl-mr-3 gl-bg-gray-200 gl-w-5 gl-h-2"></div> <div class="gl-mr-3 gl-bg-gray-200 gl-w-5 gl-h-2"></div>
<span class="gl-flex-fill-1 gl-mr-4">{{ $options.i18n.queued }}</span> <span class="gl-flex-fill-1 gl-mr-4">{{ queuedLabel }}</span>
<span class="gl-font-weight-bold">{{ queuedCount.toLocaleString() }}</span> <span class="gl-font-weight-bold">{{ queuedCount.toLocaleString() }}</span>
</div> </div>
<div class="gl-display-flex gl-align-items-center gl-my-3"> <div class="gl-display-flex gl-align-items-center gl-my-3">
<div class="gl-mr-3 gl-bg-red-500 gl-w-5 gl-h-2"></div> <div class="gl-mr-3 gl-bg-red-500 gl-w-5 gl-h-2"></div>
<span class="gl-flex-fill-1 gl-mr-4">{{ $options.i18n.failed }}</span> <span class="gl-flex-fill-1 gl-mr-4">{{ failedLabel }}</span>
<span class="gl-font-weight-bold">{{ failureCount.toLocaleString() }}</span> <span class="gl-font-weight-bold">{{ failureCount.toLocaleString() }}</span>
</div> </div>
</section> </section>
......
...@@ -11,6 +11,9 @@ export default { ...@@ -11,6 +11,9 @@ export default {
replicationSlotWAL: s__('Geo|Replication slot WAL'), replicationSlotWAL: s__('Geo|Replication slot WAL'),
replicationSlots: s__('Geo|Replication slots'), replicationSlots: s__('Geo|Replication slots'),
unknown: __('Unknown'), unknown: __('Unknown'),
used: __('Used'),
unused: __('Unused'),
noAvailableSlots: s__('Geo|No available replication slots'),
}, },
components: { components: {
GlCard, GlCard,
...@@ -52,6 +55,9 @@ export default { ...@@ -52,6 +55,9 @@ export default {
class="gl-mt-3" class="gl-mt-3"
:title="replicationSlots.title" :title="replicationSlots.title"
:values="replicationSlots.values" :values="replicationSlots.values"
:success-label="$options.i18n.used"
:queued-label="$options.i18n.unused"
:unavailable-label="$options.i18n.noAvailableSlots"
/> />
</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">
......
...@@ -14,6 +14,8 @@ export default { ...@@ -14,6 +14,8 @@ export default {
), ),
learnMore: __('Learn more'), learnMore: __('Learn more'),
progressBarTitle: s__('Geo|%{title} checksum progress'), progressBarTitle: s__('Geo|%{title} checksum progress'),
checksummed: s__('Geo|Checksummed'),
nothingToChecksum: s__('Geo|Nothing to checksum'),
}, },
components: { components: {
GlCard, GlCard,
...@@ -64,6 +66,8 @@ export default { ...@@ -64,6 +66,8 @@ export default {
class="gl-mt-3" class="gl-mt-3"
:title="sprintf($options.i18n.progressBarTitle, { title: bar.title })" :title="sprintf($options.i18n.progressBarTitle, { title: bar.title })"
:values="bar.values" :values="bar.values"
:success-label="$options.i18n.checksummed"
:unavailable-label="$options.i18n.nothingToChecksum"
/> />
</div> </div>
</gl-card> </gl-card>
......
...@@ -19,6 +19,8 @@ export default { ...@@ -19,6 +19,8 @@ export default {
nA: __('N/A'), nA: __('N/A'),
progressBarSyncTitle: s__('Geo|%{component} synced'), progressBarSyncTitle: s__('Geo|%{component} synced'),
progressBarVerifTitle: s__('Geo|%{component} verified'), progressBarVerifTitle: s__('Geo|%{component} verified'),
verified: s__('Geo|Verified'),
nothingToVerify: s__('Geo|Nothing to verify'),
}, },
components: { components: {
GlIcon, GlIcon,
...@@ -94,6 +96,8 @@ export default { ...@@ -94,6 +96,8 @@ export default {
:title="sprintf($options.i18n.progressBarVerifTitle, { component: item.component })" :title="sprintf($options.i18n.progressBarVerifTitle, { component: item.component })"
:target="`verification-progress-${item.component}`" :target="`verification-progress-${item.component}`"
:values="item.verificationValues" :values="item.verificationValues"
:success-label="$options.i18n.verified"
:unavailable-label="$options.i18n.nothingToVerify"
/> />
<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>
</div> </div>
......
...@@ -38,6 +38,8 @@ export default { ...@@ -38,6 +38,8 @@ export default {
:title="sprintf(translations.progressBarVerifTitle, { component: item.component })" :title="sprintf(translations.progressBarVerifTitle, { component: item.component })"
:target="`mobile-verification-progress-${item.component}`" :target="`mobile-verification-progress-${item.component}`"
:values="item.verificationValues" :values="item.verificationValues"
:success-label="translations.verified"
:unavailable-label="translations.nothingToVerify"
/> />
<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>
</div> </div>
......
...@@ -66,6 +66,24 @@ describe('GeoNodeProgressBar', () => { ...@@ -66,6 +66,24 @@ describe('GeoNodeProgressBar', () => {
}); });
}); });
describe('when status counts labels are over written', () => {
const expectedUiCounts = ['Total 0', 'label1 0', 'label2 0', 'label3 0'];
const values = { success: 0, failed: 0, total: 0 };
beforeEach(() => {
createComponent({
successLabel: 'label1',
queuedLabel: 'label2',
failedLabel: 'label3',
values,
});
});
it('uses the custom labels instead of the default', () => {
expect(findCounts().wrappers.map((w) => w.text())).toStrictEqual(expectedUiCounts);
});
});
describe('popoverTarget', () => { describe('popoverTarget', () => {
describe('when target prop is null', () => { describe('when target prop is null', () => {
beforeEach(() => { beforeEach(() => {
......
...@@ -14726,6 +14726,9 @@ msgstr "" ...@@ -14726,6 +14726,9 @@ msgstr ""
msgid "Geo|Allowed Geo IP should contain valid IP addresses" msgid "Geo|Allowed Geo IP should contain valid IP addresses"
msgstr "" msgstr ""
msgid "Geo|Checksummed"
msgstr ""
msgid "Geo|Connection timeout can't be blank" msgid "Geo|Connection timeout can't be blank"
msgstr "" msgstr ""
...@@ -14828,6 +14831,9 @@ msgstr "" ...@@ -14828,6 +14831,9 @@ msgstr ""
msgid "Geo|Next sync scheduled at" msgid "Geo|Next sync scheduled at"
msgstr "" msgstr ""
msgid "Geo|No available replication slots"
msgstr ""
msgid "Geo|Node name can't be blank" msgid "Geo|Node name can't be blank"
msgstr "" msgstr ""
...@@ -14840,10 +14846,13 @@ msgstr "" ...@@ -14840,10 +14846,13 @@ msgstr ""
msgid "Geo|Not synced yet" msgid "Geo|Not synced yet"
msgstr "" msgstr ""
msgid "Geo|Nothing to checksum"
msgstr ""
msgid "Geo|Nothing to synchronize" msgid "Geo|Nothing to synchronize"
msgstr "" msgstr ""
msgid "Geo|Number of %{title}" msgid "Geo|Nothing to verify"
msgstr "" msgstr ""
msgid "Geo|Offline" msgid "Geo|Offline"
...@@ -15035,6 +15044,9 @@ msgstr "" ...@@ -15035,6 +15044,9 @@ msgstr ""
msgid "Geo|Verification status" msgid "Geo|Verification status"
msgstr "" msgstr ""
msgid "Geo|Verified"
msgstr ""
msgid "Geo|Waiting for scheduler" msgid "Geo|Waiting for scheduler"
msgstr "" msgstr ""
...@@ -34915,6 +34927,9 @@ msgstr "" ...@@ -34915,6 +34927,9 @@ msgstr ""
msgid "Until" msgid "Until"
msgstr "" msgstr ""
msgid "Unused"
msgstr ""
msgid "Unused, previous indices: %{index_names} will be deleted after %{time} automatically." msgid "Unused, previous indices: %{index_names} will be deleted after %{time} automatically."
msgstr "" msgstr ""
...@@ -35398,6 +35413,9 @@ msgstr "" ...@@ -35398,6 +35413,9 @@ msgstr ""
msgid "Use your smart card to authenticate with the LDAP server." msgid "Use your smart card to authenticate with the LDAP server."
msgstr "" msgstr ""
msgid "Used"
msgstr ""
msgid "Used by members to sign in to your group in GitLab" msgid "Used by members to sign in to your group in GitLab"
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