Commit 39861140 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch '326701-move-shared-analytics-dateformat-functions-to-ce' into 'master'

Migrate analytics dateformat methods to ce

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