Commit f0f8205e authored by Kushal Pandya's avatar Kushal Pandya

Update props to include item value stale info

parent 1654c6fc
<script> <script>
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import popover from '~/vue_shared/directives/popover'; import popover from '~/vue_shared/directives/popover';
import tooltip from '~/vue_shared/directives/tooltip';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import StackedProgressBar from '~/vue_shared/components/stacked_progress_bar.vue'; import StackedProgressBar from '~/vue_shared/components/stacked_progress_bar.vue';
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
}, },
directives: { directives: {
popover, popover,
tooltip,
}, },
props: { props: {
itemTitle: { itemTitle: {
...@@ -33,6 +35,16 @@ ...@@ -33,6 +35,16 @@
type: [Object, String, Number], type: [Object, String, Number],
required: true, required: true,
}, },
itemValueStale: {
type: Boolean,
required: false,
default: false,
},
itemValueStaleTooltip: {
type: String,
required: false,
default: '',
},
successLabel: { successLabel: {
type: String, type: String,
required: false, required: false,
...@@ -132,8 +144,10 @@ ...@@ -132,8 +144,10 @@
<div <div
v-if="isValueTypeGraph" v-if="isValueTypeGraph"
class="node-detail-value" class="node-detail-value"
:class="{ 'd-flex': itemValueStale }"
> >
<stacked-progress-bar <stacked-progress-bar
:css-class="itemValueStale ? 'flex-fill' : ''"
:success-label="successLabel" :success-label="successLabel"
:failure-label="failureLabel" :failure-label="failureLabel"
:neutral-label="neutralLabel" :neutral-label="neutralLabel"
...@@ -141,6 +155,14 @@ ...@@ -141,6 +155,14 @@
:failure-count="itemValue.failureCount" :failure-count="itemValue.failureCount"
:total-count="itemValue.totalCount" :total-count="itemValue.totalCount"
/> />
<icon
v-tooltip
v-show="itemValueStale"
name="time-out"
css-classes="prepend-left-10 detail-value-stale-icon"
data-container="body"
:title="itemValueStaleTooltip"
/>
</div> </div>
<template v-if="isValueTypeCustom"> <template v-if="isValueTypeCustom">
<geo-node-sync-settings <geo-node-sync-settings
......
...@@ -56,6 +56,22 @@ describe('GeoNodeDetailItemComponent', () => { ...@@ -56,6 +56,22 @@ describe('GeoNodeDetailItemComponent', () => {
vm.$destroy(); vm.$destroy();
}); });
it('renders stale information status icon when `itemValueStale` prop is true', () => {
const itemValueStaleTooltip = 'Data is out of date from 8 hours ago';
const vm = createComponent({
itemValueType: VALUE_TYPE.GRAPH,
itemValue: { successCount: 5, failureCount: 3, totalCount: 10 },
itemValueStale: true,
itemValueStaleTooltip,
});
const iconEl = vm.$el.querySelector('.detail-value-stale-icon');
expect(iconEl).not.toBeNull();
expect(iconEl.dataset.originalTitle).toBe(itemValueStaleTooltip);
expect(iconEl.querySelector('use').getAttribute('xlink:href')).toContain('time-out');
vm.$destroy();
});
it('renders sync settings item value', () => { it('renders sync settings item value', () => {
const vm = createComponent({ const vm = createComponent({
itemValueType: VALUE_TYPE.CUSTOM, itemValueType: VALUE_TYPE.CUSTOM,
......
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