From f47c768fad17d4c876e96524f83f8306f071db66 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 23 Jan 2020 09:09:07 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .../diffs/components/diff_file_header.vue | 18 ++ .../monitoring/components/dashboard.vue | 10 +- .../date_time_picker/date_time_picker.vue | 29 +- .../date_time_picker_input.vue | 10 +- .../date_time_picker/date_time_picker_lib.js | 112 +++++++ .../monitoring/components/embed.vue | 4 +- .../javascripts/monitoring/constants.js | 66 ++--- app/assets/javascripts/monitoring/utils.js | 65 ----- changelogs/unreleased/197412.yml | 5 + doc/ci/yaml/README.md | 3 +- locale/gitlab.pot | 9 + .../components/dashboard_time_window_spec.js | 3 +- .../date_time_picker_lib_spec.js | 264 +++++++++++++++++ .../date_time_picker/date_time_picker_spec.js | 93 +++++- spec/frontend/monitoring/utils_spec.js | 274 ------------------ .../diffs/components/diff_file_spec.js | 23 ++ 16 files changed, 571 insertions(+), 417 deletions(-) create mode 100644 app/assets/javascripts/monitoring/components/date_time_picker/date_time_picker_lib.js create mode 100644 changelogs/unreleased/197412.yml create mode 100644 spec/frontend/monitoring/components/date_time_picker/date_time_picker_lib_spec.js diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue index 5d27c6eb865..ee10a1e92fc 100644 --- a/app/assets/javascripts/diffs/components/diff_file_header.vue +++ b/app/assets/javascripts/diffs/components/diff_file_header.vue @@ -210,6 +210,9 @@ export default { :text="diffFile.file_path" :gfm="gfmCopyText" css-class="btn-default btn-transparent btn-clipboard" + data-track-event="click_copy_file_button" + data-track-label="diff_copy_file_path_button" + data-track-property="diff_copy_file" /> @@ -233,6 +236,9 @@ export default { :class="{ active: diffHasExpandedDiscussions(diffFile) }" class="js-btn-vue-toggle-comments btn" data-qa-selector="toggle_comments_button" + data-track-event="click_toggle_comments_button" + data-track-label="diff_toggle_comments_button" + data-track-property="diff_toggle_comments" type="button" @click="toggleFileDiscussionWrappers(diffFile)" > @@ -245,6 +251,9 @@ export default { :can-current-user-fork="canCurrentUserFork" :edit-path="diffFile.edit_path" :can-modify-blob="diffFile.can_modify_blob" + data-track-event="click_toggle_edit_button" + data-track-label="diff_toggle_edit_button" + data-track-property="diff_toggle_edit" @showForkMessage="showForkMessage" /> @@ -263,6 +272,9 @@ export default { v-gl-tooltip.hover :title="expandDiffToFullFileTitle" class="expand-file" + data-track-event="click_toggle_view_full_button" + data-track-label="diff_toggle_view_full_button" + data-track-property="diff_toggle_view_full" @click="toggleFullDiff(diffFile.file_path)" > @@ -275,6 +287,9 @@ export default { :href="diffFile.view_path" target="blank" class="view-file" + data-track-event="click_toggle_view_sha_button" + data-track-label="diff_toggle_view_sha_button" + data-track-property="diff_toggle_view_sha" :title="viewFileButtonText" > @@ -288,6 +303,9 @@ export default { :title="`View on ${diffFile.formatted_external_url}`" target="_blank" rel="noopener noreferrer" + data-track-event="click_toggle_external_button" + data-track-label="diff_toggle_external_button" + data-track-property="diff_toggle_external" class="btn btn-file-option" > diff --git a/app/assets/javascripts/monitoring/components/dashboard.vue b/app/assets/javascripts/monitoring/components/dashboard.vue index f6f119d4463..211990f3d7c 100644 --- a/app/assets/javascripts/monitoring/components/dashboard.vue +++ b/app/assets/javascripts/monitoring/components/dashboard.vue @@ -27,10 +27,12 @@ import GroupEmptyState from './group_empty_state.vue'; import DashboardsDropdown from './dashboards_dropdown.vue'; import TrackEventDirective from '~/vue_shared/directives/track_event'; -import { getTimeDiff, getAddMetricTrackingOptions } from '../utils'; -import { metricStates } from '../constants'; +import { getAddMetricTrackingOptions } from '../utils'; +import { getTimeRange } from './date_time_picker/date_time_picker_lib'; -const defaultTimeDiff = getTimeDiff(); +import { datePickerTimeWindows, metricStates } from '../constants'; + +const defaultTimeDiff = getTimeRange(); export default { components: { @@ -191,6 +193,7 @@ export default { startDate: getParameterValues('start')[0] || defaultTimeDiff.start, endDate: getParameterValues('end')[0] || defaultTimeDiff.end, hasValidDates: true, + datePickerTimeWindows, isRearrangingPanels: false, }; }, @@ -426,6 +429,7 @@ export default { diff --git a/app/assets/javascripts/monitoring/components/date_time_picker/date_time_picker.vue b/app/assets/javascripts/monitoring/components/date_time_picker/date_time_picker.vue index 0aa710b1b3a..3a18a494cad 100644 --- a/app/assets/javascripts/monitoring/components/date_time_picker/date_time_picker.vue +++ b/app/assets/javascripts/monitoring/components/date_time_picker/date_time_picker.vue @@ -1,19 +1,18 @@