Commit 1a52a014 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Migrate analytics dateformat methods to ce

Moves the shared analytics dateFormat functions
to CE for reuse.
parent 93a5f2a6
import { masks } from 'dateformat';
export const DATE_RANGE_LIMIT = 180;
export const OFFSET_DATE_BY_ONE = 1;
export const PROJECTS_PER_PAGE = 50;
const { isoDate, mediumDate } = masks;
export const dateFormats = {
isoDate,
defaultDate: mediumDate,
defaultDateTime: 'mmm d, yyyy h:MMtt',
};
<script>
import { GlAlert } from '@gitlab/ui';
import { mapActions, mapState, mapGetters } from 'vuex';
import { dateFormats } from '~/analytics/shared/constants';
import { __ } from '~/locale';
import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleton_loader.vue';
import Scatterplot from '../../shared/components/scatterplot.vue';
import { dateFormats } from '../../shared/constants';
import StageDropdownFilter from './stage_dropdown_filter.vue';
export default {
......
import dateFormat from 'dateformat';
import { isNumber } from 'lodash';
import { dateFormats } from '~/analytics/shared/constants';
import { OVERVIEW_STAGE_ID } from '~/cycle_analytics/constants';
import { pathNavigationData as basePathNavigationData } from '~/cycle_analytics/store/getters';
import { filterStagesByHiddenStatus } from '~/cycle_analytics/utils';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import httpStatus from '~/lib/utils/http_status';
import { filterToQueryObject } from '~/vue_shared/components/filtered_search_bar/filtered_search_utils';
import { dateFormats } from '../../shared/constants';
import { DEFAULT_VALUE_STREAM_ID, OVERVIEW_STAGE_CONFIG, PAGINATION_TYPE } from '../constants';
export const hasNoAccessError = (state) => state.errorCode === httpStatus.FORBIDDEN;
......
import dateFormat from 'dateformat';
import { isNumber } from 'lodash';
import { dateFormats } from '~/analytics/shared/constants';
import { OVERVIEW_STAGE_ID } from '~/cycle_analytics/constants';
import { medianTimeToParsedSeconds } from '~/cycle_analytics/utils';
import createFlash, { hideFlash } from '~/flash';
......@@ -7,7 +8,6 @@ import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { newDate, dayAfter, secondsToDays, getDatesInRange } from '~/lib/utils/datetime_utility';
import httpStatus from '~/lib/utils/http_status';
import { convertToSnakeCase, slugify } from '~/lib/utils/text_utility';
import { dateFormats } from '../shared/constants';
import { toYmd } from '../shared/utils';
const EVENT_TYPE_LABEL = 'label';
......
<script>
import dateFormat from 'dateformat';
import DateRange from '~/analytics/shared/components/daterange.vue';
import { dateFormats } from '~/analytics/shared/constants';
import UrlSync from '~/vue_shared/components/url_sync.vue';
import { dateFormats } from '../../shared/constants';
import { DEFAULT_NUMBER_OF_DAYS } from '../constants';
import FilterBar from './filter_bar.vue';
import ThroughputChart from './throughput_chart.vue';
......
......@@ -13,10 +13,10 @@ import {
} from '@gitlab/ui';
import dateFormat from 'dateformat';
import { mapState } from 'vuex';
import { dateFormats } from '~/analytics/shared/constants';
import { approximateDuration, differenceInSeconds } from '~/lib/utils/datetime_utility';
import { s__, n__ } from '~/locale';
import { filterToQueryObject } from '~/vue_shared/components/filtered_search_bar/filtered_search_utils';
import { dateFormats } from '../../shared/constants';
import {
THROUGHPUT_TABLE_STRINGS,
MERGE_REQUEST_ID_PREFIX,
......
import dateFormat from 'dateformat';
import { dateFormats } from '~/analytics/shared/constants';
import {
getMonthNames,
getDateInPast,
getDayDifference,
secondsToDays,
} from '~/lib/utils/datetime_utility';
import { dateFormats } from '../shared/constants';
import { THROUGHPUT_CHART_STRINGS, DEFAULT_NUMBER_OF_DAYS, UNITS } from './constants';
/**
......
......@@ -12,10 +12,10 @@ import {
import { GlColumnChart } from '@gitlab/ui/dist/charts';
import dateFormat from 'dateformat';
import { mapState, mapActions, mapGetters } from 'vuex';
import { dateFormats } from '~/analytics/shared/constants';
import { beginOfDayTime, endOfDayTime } from '~/lib/utils/datetime_utility';
import featureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import Scatterplot from '../../shared/components/scatterplot.vue';
import { dateFormats } from '../../shared/constants';
import urlSyncMixin from '../../shared/mixins/url_sync_mixin';
import { chartKeys } from '../constants';
import MetricChart from './metric_chart.vue';
......
import dateFormat from 'dateformat';
import { dateFormats } from '~/analytics/shared/constants';
import { getDateInPast, beginOfDayTime, endOfDayTime } from '~/lib/utils/datetime_utility';
import { dateFormats } from '../../../../shared/constants';
import { chartKeys, scatterPlotAddonQueryDays } from '../../../constants';
/**
......
import dateFormat from 'dateformat';
import { flatten } from 'lodash';
import { dateFormats } from '~/analytics/shared/constants';
import { getDayDifference, getDateInPast } from '~/lib/utils/datetime_utility';
import { median } from '~/lib/utils/number_utils';
import { dateFormats } from '../shared/constants';
/**
* Gets the labels endpoint for a given group or project
......
<script>
import { GlDiscreteScatterChart } from '@gitlab/ui/dist/charts';
import dateFormat from 'dateformat';
import { scatterChartLineProps, dateFormats } from '../constants';
import { dateFormats } from '~/analytics/shared/constants';
import { scatterChartLineProps } from '../constants';
export default {
components: {
......
import { masks } from 'dateformat';
import { DEFAULT_DEBOUNCE_AND_THROTTLE_MS } from '~/lib/utils/constants';
const { isoDate, mediumDate } = masks;
export const dateFormats = {
isoDate,
defaultDate: mediumDate,
defaultDateTime: 'mmm d, yyyy h:MMtt',
};
export const scatterChartLineProps = {
default: {
type: 'line',
......
import dateFormat from 'dateformat';
import { dateFormats } from '~/analytics/shared/constants';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { capitalizeFirstCharacter } from '~/lib/utils/text_utility';
import { dateFormats } from './constants';
export const toYmd = (date) => dateFormat(date, dateFormats.isoDate);
......
......@@ -19,7 +19,7 @@ export const COLORS = {
// Reuse existing definitions rather than defining them again here,
// otherwise they could get out of sync.
// See https://gitlab.com/gitlab-org/gitlab-ui/issues/554.
export { dateFormats as DATE_FORMATS } from 'ee/analytics/shared/constants';
export { dateFormats as DATE_FORMATS } from '~/analytics/shared/constants';
export const POLICY_KINDS = {
ciliumNetwork: 'CiliumNetworkPolicy',
......
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