diff options
Diffstat (limited to 'app/assets/javascripts/cycle_analytics/utils.js')
-rw-r--r-- | app/assets/javascripts/cycle_analytics/utils.js | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/app/assets/javascripts/cycle_analytics/utils.js b/app/assets/javascripts/cycle_analytics/utils.js index 9af63f5f9cc..428bb11b950 100644 --- a/app/assets/javascripts/cycle_analytics/utils.js +++ b/app/assets/javascripts/cycle_analytics/utils.js @@ -1,14 +1,5 @@ -import { hideFlash } from '~/flash'; import { parseSeconds } from '~/lib/utils/datetime_utility'; import { formatTimeAsSummary } from '~/lib/utils/datetime/date_format_utility'; -import { slugify } from '~/lib/utils/text_utility'; - -export const removeFlash = (type = 'alert') => { - const flashEl = document.querySelector(`.flash-${type}`); - if (flashEl) { - hideFlash(flashEl); - } -}; /** * Takes the stages and median data, combined with the selected stage, to build an @@ -80,30 +71,11 @@ export const filterStagesByHiddenStatus = (stages = [], isHidden = true) => * @typedef {Object} TransformedMetricData * @property {String} label - Title of the metric measured * @property {String} value - String representing the decimal point value, e.g '1.5' - * @property {String} key - Slugified string based on the 'title' + * @property {String} identifier - Slugified string based on the 'title' or the provided 'identifier' attribute * @property {String} description - String to display for a description * @property {String} unit - String representing the decimal point value, e.g '1.5' */ -/** - * Prepares metric data to be rendered in the metric_card component - * - * @param {MetricData[]} data - The metric data to be rendered - * @param {Object} popoverContent - Key value pair of data to display in the popover - * @returns {TransformedMetricData[]} An array of metrics ready to render in the metric_card - */ - -export const prepareTimeMetricsData = (data = [], popoverContent = {}) => - data.map(({ title: label, ...rest }) => { - const key = slugify(label); - return { - ...rest, - label, - key, - description: popoverContent[key]?.description || '', - }; - }); - const extractFeatures = (gon) => ({ cycleAnalyticsForGroups: Boolean(gon?.licensed_features?.cycleAnalyticsForGroups), }); |