Skip to content
Snippets Groups Projects
Unverified Commit ba6a0972 authored by E'zeki&el Kigbo's avatar E'zeki&el Kigbo :speech_balloon:
Browse files

Address minor review comments

Minor refactor metrics constants and update
some externalized strings
parent 6bfdb481
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -6,7 +6,7 @@ import PathNavigation from '~/cycle_analytics/components/path_navigation.vue';
import StageTable from '~/cycle_analytics/components/stage_table.vue';
import ValueStreamMetrics from '~/cycle_analytics/components/value_stream_metrics.vue';
import { __ } from '~/locale';
import { projectMetricsRequests } from '../constants';
import { SUMMARY_METRICS_REQUEST, METRICS_REQUESTS } from '../constants';
 
const OVERVIEW_DIALOG_COOKIE = 'cycle_analytics_help_dismissed';
 
Loading
Loading
@@ -94,7 +94,7 @@ export default {
return 0;
},
metricsRequests() {
return projectMetricsRequests(this.features.cycleAnalyticsForGroups);
return this.features?.cycleAnalyticsForGroups ? METRICS_REQUESTS : SUMMARY_METRICS_REQUEST;
},
},
methods: {
Loading
Loading
Loading
Loading
@@ -11,12 +11,13 @@ const requestData = ({ request, path, params, name }) => {
return request(path, params)
.then(({ data }) => data)
.catch(() => {
createFlash({
message: sprintf(
s__('There was an error while fetching value stream analytics %{requestTypeName} data.'),
{ requestTypeName: name },
const message = sprintf(
s__(
'ValueStreamAnalytics|There was an error while fetching value stream analytics %{requestTypeName} data.',
),
});
{ requestTypeName: name },
);
createFlash({ message });
});
};
 
Loading
Loading
Loading
Loading
@@ -60,12 +60,11 @@ export const METRICS_POPOVER_CONTENT = {
},
};
 
export const projectMetricsRequests = (cycleAnalyticsForGroups = false) => {
const summaryMetrics = [{ request: getValueStreamSummaryMetrics, name: __('recent activity') }];
if (cycleAnalyticsForGroups) {
return [{ request: getValueStreamTimeSummaryMetrics, name: __('time summary') }].concat(
summaryMetrics,
);
}
return summaryMetrics;
};
export const SUMMARY_METRICS_REQUEST = [
{ request: getValueStreamSummaryMetrics, name: __('recent activity') },
];
export const METRICS_REQUESTS = [
{ request: getValueStreamTimeSummaryMetrics, name: __('time summary') },
...SUMMARY_METRICS_REQUEST,
];
Loading
Loading
@@ -33714,9 +33714,6 @@ msgstr ""
msgid "There was an error while fetching the table data. Please refresh the page to try again."
msgstr ""
 
msgid "There was an error while fetching value stream analytics %{requestTypeName} data."
msgstr ""
msgid "There was an error while fetching value stream analytics data."
msgstr ""
 
Loading
Loading
@@ -36555,6 +36552,9 @@ msgstr ""
msgid "ValueStreamAnalytics|Number of new issues created."
msgstr ""
 
msgid "ValueStreamAnalytics|There was an error while fetching value stream analytics %{requestTypeName} data."
msgstr ""
msgid "ValueStreamAnalytics|Total number of deploys to production."
msgstr ""
 
Loading
Loading
Loading
Loading
@@ -32,7 +32,7 @@ describe('ValueStreamMetrics', () => {
wrapper = null;
});
 
it('will display a loading icon if `true`', async () => {
it('will display a loader with pending requests', async () => {
mockGetValueStreamSummaryMetrics = jest.fn().mockResolvedValue({ data: metricsData });
wrapper = createComponent();
await wrapper.vm.$nextTick();
Loading
Loading
@@ -105,7 +105,7 @@ describe('ValueStreamMetrics', () => {
await waitForPromises();
});
 
it('it should render a error message', () => {
it('it should render an error message', () => {
expect(createFlash).toHaveBeenCalledWith({
message: `There was an error while fetching value stream analytics ${fakeReqName} data.`,
});
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment