diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-12 09:07:48 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-12 09:07:48 +0000 |
commit | fc53ce8e6ca67bf217470179a1ea6cf139bcffad (patch) | |
tree | 3721386728719a7779d1cd627281e9a28cc40c4a /app | |
parent | 8e22ef10e4f9c6d1ef2411aa26ddd0658e2f1461 (diff) | |
download | gitlab-ce-fc53ce8e6ca67bf217470179a1ea6cf139bcffad.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
25 files changed, 60 insertions, 33 deletions
diff --git a/app/assets/javascripts/boards/components/issue_due_date.vue b/app/assets/javascripts/boards/components/issue_due_date.vue index 3bc7f13a9e6..a32ebdab5e1 100644 --- a/app/assets/javascripts/boards/components/issue_due_date.vue +++ b/app/assets/javascripts/boards/components/issue_due_date.vue @@ -35,10 +35,10 @@ export default { title() { const timeago = getTimeago(); const { timeDifference, standardDateFormat } = this; - const formatedDate = standardDateFormat; + const formattedDate = standardDateFormat; if (timeDifference >= -1 && timeDifference < 7) { - return `${timeago.format(this.issueDueDate)} (${formatedDate})`; + return `${timeago.format(this.issueDueDate)} (${formattedDate})`; } return timeago.format(this.issueDueDate); diff --git a/app/assets/javascripts/deploy_keys/components/key.vue b/app/assets/javascripts/deploy_keys/components/key.vue index 6ffb8c4e1c0..4d36a492c1c 100644 --- a/app/assets/javascripts/deploy_keys/components/key.vue +++ b/app/assets/javascripts/deploy_keys/components/key.vue @@ -159,7 +159,7 @@ export default { <div role="rowheader" class="table-mobile-header">{{ __('Created') }}</div> <div class="table-mobile-content text-secondary key-created-at"> <span v-tooltip :title="tooltipTitle(deployKey.created_at)"> - <icon name="calendar" /> <span>{{ timeFormated(deployKey.created_at) }}</span> + <icon name="calendar" /> <span>{{ timeFormatted(deployKey.created_at) }}</span> </span> </div> </div> diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue index 6cfc95c0117..8fc8a8d0495 100644 --- a/app/assets/javascripts/diffs/components/app.vue +++ b/app/assets/javascripts/diffs/components/app.vue @@ -177,6 +177,7 @@ export default { projectPath: this.projectPath, dismissEndpoint: this.dismissEndpoint, showSuggestPopover: this.showSuggestPopover, + useSingleDiffStyle: this.glFeatures.singleMrDiffView, }); if (this.shouldShow) { diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index 1fab922d220..44672659f56 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -46,6 +46,7 @@ export const setBaseConfig = ({ commit }, options) => { projectPath, dismissEndpoint, showSuggestPopover, + useSingleDiffStyle, } = options; commit(types.SET_BASE_CONFIG, { endpoint, @@ -54,11 +55,15 @@ export const setBaseConfig = ({ commit }, options) => { projectPath, dismissEndpoint, showSuggestPopover, + useSingleDiffStyle, }); }; export const fetchDiffFiles = ({ state, commit }) => { const worker = new TreeWorker(); + const urlParams = { + w: state.showWhitespace ? '0' : '1', + }; commit(types.SET_LOADING, true); @@ -69,9 +74,10 @@ export const fetchDiffFiles = ({ state, commit }) => { }); return axios - .get(mergeUrlParams({ w: state.showWhitespace ? '0' : '1' }, state.endpoint)) + .get(mergeUrlParams(urlParams, state.endpoint)) .then(res => { commit(types.SET_LOADING, false); + commit(types.SET_MERGE_REQUEST_DIFFS, res.data.merge_request_diffs || []); commit(types.SET_DIFF_DATA, res.data); diff --git a/app/assets/javascripts/diffs/store/modules/diff_state.js b/app/assets/javascripts/diffs/store/modules/diff_state.js index 8c52e3178e5..7366c50752c 100644 --- a/app/assets/javascripts/diffs/store/modules/diff_state.js +++ b/app/assets/javascripts/diffs/store/modules/diff_state.js @@ -31,4 +31,5 @@ export default () => ({ fileFinderVisible: false, dismissEndpoint: '', showSuggestPopover: true, + useSingleDiffStyle: false, }); diff --git a/app/assets/javascripts/diffs/store/mutations.js b/app/assets/javascripts/diffs/store/mutations.js index fccfd950d75..859f43b3b6d 100644 --- a/app/assets/javascripts/diffs/store/mutations.js +++ b/app/assets/javascripts/diffs/store/mutations.js @@ -19,6 +19,7 @@ export default { projectPath, dismissEndpoint, showSuggestPopover, + useSingleDiffStyle, } = options; Object.assign(state, { endpoint, @@ -27,6 +28,7 @@ export default { projectPath, dismissEndpoint, showSuggestPopover, + useSingleDiffStyle, }); }, diff --git a/app/assets/javascripts/error_tracking/components/error_details.vue b/app/assets/javascripts/error_tracking/components/error_details.vue index 64e698a0bc9..9cf141589db 100644 --- a/app/assets/javascripts/error_tracking/components/error_details.vue +++ b/app/assets/javascripts/error_tracking/components/error_details.vue @@ -56,7 +56,7 @@ export default { __('Reported %{timeAgo} by %{reportedBy}'), { reportedBy: `<strong>${this.error.culprit}</strong>`, - timeAgo: this.timeFormated(this.stacktraceData.date_received), + timeAgo: this.timeFormatted(this.stacktraceData.date_received), }, false, ); @@ -107,7 +107,7 @@ export default { this.$refs.sentryIssueForm.submit(); }, formatDate(date) { - return `${this.timeFormated(date)} (${dateFormat(date, 'UTC:yyyy-mm-dd h:MM:ssTT Z')})`; + return `${this.timeFormatted(date)} (${dateFormat(date, 'UTC:yyyy-mm-dd h:MM:ssTT Z')})`; }, }, }; diff --git a/app/assets/javascripts/ide/components/ide_status_bar.vue b/app/assets/javascripts/ide/components/ide_status_bar.vue index 326589fa50f..6eaf08e8033 100644 --- a/app/assets/javascripts/ide/components/ide_status_bar.vue +++ b/app/assets/javascripts/ide/components/ide_status_bar.vue @@ -22,7 +22,7 @@ export default { mixins: [timeAgoMixin], data() { return { - lastCommitFormatedAge: null, + lastCommitFormattedAge: null, }; }, computed: { @@ -62,7 +62,7 @@ export default { }, commitAgeUpdate() { if (this.lastCommit) { - this.lastCommitFormatedAge = this.timeFormated(this.lastCommit.committed_date); + this.lastCommitFormattedAge = this.timeFormatted(this.lastCommit.committed_date); } }, getCommitPath(shortSha) { @@ -118,7 +118,7 @@ export default { :title="tooltipTitle(lastCommit.committed_date)" data-placement="top" data-container="body" - >{{ lastCommitFormatedAge }}</time + >{{ lastCommitFormattedAge }}</time > </div> <ide-status-list class="ml-auto" /> diff --git a/app/assets/javascripts/issuable_suggestions/components/item.vue b/app/assets/javascripts/issuable_suggestions/components/item.vue index 7629e04684c..66a4cc44d51 100644 --- a/app/assets/javascripts/issuable_suggestions/components/item.vue +++ b/app/assets/javascripts/issuable_suggestions/components/item.vue @@ -91,7 +91,7 @@ export default { /> <gl-tooltip :target="() => $refs.state" placement="bottom"> <span class="d-block"> - <span class="bold"> {{ stateTitle }} </span> {{ timeFormated(closedOrCreatedDate) }} + <span class="bold"> {{ stateTitle }} </span> {{ timeFormatted(closedOrCreatedDate) }} </span> <span class="text-tertiary">{{ tooltipTitle(closedOrCreatedDate) }}</span> </gl-tooltip> diff --git a/app/assets/javascripts/jobs/components/sidebar.vue b/app/assets/javascripts/jobs/components/sidebar.vue index 1df57f1aa14..415fa46835b 100644 --- a/app/assets/javascripts/jobs/components/sidebar.vue +++ b/app/assets/javascripts/jobs/components/sidebar.vue @@ -168,13 +168,13 @@ export default { /> <detail-row v-if="job.finished_at" - :value="timeFormated(job.finished_at)" + :value="timeFormatted(job.finished_at)" class="js-job-finished" title="Finished" /> <detail-row v-if="job.erased_at" - :value="timeFormated(job.erased_at)" + :value="timeFormatted(job.erased_at)" class="js-job-erased" title="Erased" /> diff --git a/app/assets/javascripts/jobs/store/utils.js b/app/assets/javascripts/jobs/store/utils.js index 179d0bc4e0f..0b28c52a78f 100644 --- a/app/assets/javascripts/jobs/store/utils.js +++ b/app/assets/javascripts/jobs/store/utils.js @@ -114,7 +114,7 @@ export const logLinesParser = (lines = [], accumulator = []) => acc.push(parseHeaderLine(line, lineNumber)); } else if (isCollapsibleSection(acc, last, line)) { // if the object belongs to a nested section, we append it to the new `lines` array of the - // previously formated header + // previously formatted header last.lines.push(parseLine(line, lineNumber)); } else if (line.section_duration) { // if the line has section_duration, we look for the correct header to add it diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index 177ae4f9838..ddd698fefeb 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -5,7 +5,7 @@ import $ from 'jquery'; import axios from './axios_utils'; import { getLocationHash } from './url_utility'; -import { convertToCamelCase } from './text_utility'; +import { convertToCamelCase, convertToSnakeCase } from './text_utility'; import { isObject } from './type_utility'; import breakpointInstance from '../../breakpoints'; @@ -697,6 +697,22 @@ export const convertObjectPropsToCamelCase = (obj = {}, options = {}) => { }, initial); }; +/** + * Converts all the object keys to snake case + * + * @param {Object} obj Object to transform + * @returns {Object} + */ +// Follow up to add additional options param: +// https://gitlab.com/gitlab-org/gitlab/issues/39173 +export const convertObjectPropsToSnakeCase = (obj = {}) => + obj + ? Object.entries(obj).reduce( + (acc, [key, value]) => ({ ...acc, [convertToSnakeCase(key)]: value }), + {}, + ) + : {}; + export const imagePath = imgUrl => `${gon.asset_host || ''}${gon.relative_url_root || ''}/assets/${imgUrl}`; diff --git a/app/assets/javascripts/lib/utils/datetime_utility.js b/app/assets/javascripts/lib/utils/datetime_utility.js index bc742179279..996692bacb3 100644 --- a/app/assets/javascripts/lib/utils/datetime_utility.js +++ b/app/assets/javascripts/lib/utils/datetime_utility.js @@ -447,7 +447,7 @@ export const parsePikadayDate = dateString => { /** * Used `onSelect` method in pickaday * @param {Date} date UTC format - * @return {String} Date formated in yyyy-mm-dd + * @return {String} Date formatted in yyyy-mm-dd */ export const pikadayToString = date => { const day = pad(date.getDate()); @@ -513,8 +513,8 @@ export const stringifyTime = (timeObject, fullNameFormat = false) => { if (fullNameFormat && isNonZero) { // Remove traling 's' if unit value is singular - const formatedUnitName = unitValue > 1 ? unitName : unitName.replace(/s$/, ''); - return `${memo} ${unitValue} ${formatedUnitName}`; + const formattedUnitName = unitValue > 1 ? unitName : unitName.replace(/s$/, ''); + return `${memo} ${unitValue} ${formattedUnitName}`; } return isNonZero ? `${memo} ${unitValue}${unitName.charAt(0)}` : memo; diff --git a/app/assets/javascripts/mr_popover/components/mr_popover.vue b/app/assets/javascripts/mr_popover/components/mr_popover.vue index b81600660f6..ce08b0964a1 100644 --- a/app/assets/javascripts/mr_popover/components/mr_popover.vue +++ b/app/assets/javascripts/mr_popover/components/mr_popover.vue @@ -45,7 +45,7 @@ export default { return this.mergeRequest.headPipeline && this.mergeRequest.headPipeline.detailedStatus; }, formattedTime() { - return this.timeFormated(this.mergeRequest.createdAt); + return this.timeFormatted(this.mergeRequest.createdAt); }, statusBoxClass() { switch (this.mergeRequest.state) { diff --git a/app/assets/javascripts/pipelines/components/time_ago.vue b/app/assets/javascripts/pipelines/components/time_ago.vue index 2ed0c24825c..2a23a0f6744 100644 --- a/app/assets/javascripts/pipelines/components/time_ago.vue +++ b/app/assets/javascripts/pipelines/components/time_ago.vue @@ -31,7 +31,7 @@ export default { hasFinishedTime() { return this.finishedTime !== ''; }, - durationFormated() { + durationFormatted() { const date = new Date(this.duration * 1000); let hh = date.getUTCHours(); @@ -59,7 +59,7 @@ export default { <div class="table-mobile-header" role="rowheader">{{ s__('Pipeline|Duration') }}</div> <div class="table-mobile-content"> <p v-if="hasDuration" class="duration"> - <span v-html="iconTimerSvg"> </span> {{ durationFormated }} + <span v-html="iconTimerSvg"> </span> {{ durationFormatted }} </p> <p v-if="hasFinishedTime" class="finished-at d-none d-sm-none d-md-block"> @@ -71,7 +71,7 @@ export default { data-placement="top" data-container="body" > - {{ timeFormated(finishedTime) }} + {{ timeFormatted(finishedTime) }} </time> </p> </div> diff --git a/app/assets/javascripts/registry/list/components/table_registry.vue b/app/assets/javascripts/registry/list/components/table_registry.vue index e682a0e0019..4e14db7f578 100644 --- a/app/assets/javascripts/registry/list/components/table_registry.vue +++ b/app/assets/javascripts/registry/list/components/table_registry.vue @@ -247,7 +247,7 @@ export default { <td> <span v-gl-tooltip.bottom :title="tooltipTitle(item.createdAt)">{{ - timeFormated(item.createdAt) + timeFormatted(item.createdAt) }}</span> </td> diff --git a/app/assets/javascripts/releases/list/components/release_block.vue b/app/assets/javascripts/releases/list/components/release_block.vue index 09ef857ae4a..4d8d8682401 100644 --- a/app/assets/javascripts/releases/list/components/release_block.vue +++ b/app/assets/javascripts/releases/list/components/release_block.vue @@ -48,7 +48,7 @@ export default { }, releasedTimeAgo() { return sprintf(__('released %{time}'), { - time: this.timeFormated(this.release.released_at), + time: this.timeFormatted(this.release.released_at), }); }, userImageAltDescription() { diff --git a/app/assets/javascripts/releases/list/components/release_block_footer.vue b/app/assets/javascripts/releases/list/components/release_block_footer.vue index 4189268eea9..8533fc17ffd 100644 --- a/app/assets/javascripts/releases/list/components/release_block_footer.vue +++ b/app/assets/javascripts/releases/list/components/release_block_footer.vue @@ -50,7 +50,7 @@ export default { }, computed: { releasedAtTimeAgo() { - return this.timeFormated(this.releasedAt); + return this.timeFormatted(this.releasedAt); }, userImageAltDescription() { return this.author && this.author.username diff --git a/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_info.vue b/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_info.vue index 47e70e972cf..db4a4ece002 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_info.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/deployment/deployment_info.vue @@ -41,7 +41,7 @@ export default { }, computed: { deployTimeago() { - return this.timeFormated(this.deployment.deployed_at); + return this.timeFormatted(this.deployment.deployed_at); }, deployedText() { return this.$options.deployedTextMap[this.computedDeploymentStatus]; diff --git a/app/assets/javascripts/vue_shared/components/issue/issue_milestone.vue b/app/assets/javascripts/vue_shared/components/issue/issue_milestone.vue index 9b2ee5062b1..cfbc5b0df3c 100644 --- a/app/assets/javascripts/vue_shared/components/issue/issue_milestone.vue +++ b/app/assets/javascripts/vue_shared/components/issue/issue_milestone.vue @@ -54,7 +54,7 @@ export default { return timeFor( this.milestoneDue, sprintf(__('Expired %{expiredOn}'), { - expiredOn: this.timeFormated(this.milestoneDue), + expiredOn: this.timeFormatted(this.milestoneDue), }), ); } @@ -62,7 +62,7 @@ export default { return sprintf( this.isMilestoneStarted ? __('Started %{startsIn}') : __('Starts %{startsIn}'), { - startsIn: this.timeFormated(this.milestoneStart), + startsIn: this.timeFormatted(this.milestoneStart), }, ); } diff --git a/app/assets/javascripts/vue_shared/components/sidebar/collapsed_grouped_date_picker.vue b/app/assets/javascripts/vue_shared/components/sidebar/collapsed_grouped_date_picker.vue index c1f3d86335a..80c61627b8f 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/collapsed_grouped_date_picker.vue +++ b/app/assets/javascripts/vue_shared/components/sidebar/collapsed_grouped_date_picker.vue @@ -64,7 +64,7 @@ export default { tooltipText(dateType = 'min') { const defaultText = dateType === 'min' ? __('Start date') : __('Due date'); const date = this[`${dateType}Date`]; - const timeAgo = dateType === 'min' ? this.timeFormated(date) : timeFor(date); + const timeAgo = dateType === 'min' ? this.timeFormatted(date) : timeFor(date); const dateText = date ? [this.dateText(dateType), `(${timeAgo})`].join(' ') : ''; if (date) { diff --git a/app/assets/javascripts/vue_shared/components/time_ago_tooltip.vue b/app/assets/javascripts/vue_shared/components/time_ago_tooltip.vue index 43935cf31d5..b1a4f3dccaf 100644 --- a/app/assets/javascripts/vue_shared/components/time_ago_tooltip.vue +++ b/app/assets/javascripts/vue_shared/components/time_ago_tooltip.vue @@ -35,7 +35,7 @@ export default { v-gl-tooltip.viewport="{ placement: tooltipPlacement }" :class="cssClass" :title="tooltipTitle(time)" - v-text="timeFormated(time)" + v-text="timeFormatted(time)" > </time> </template> diff --git a/app/assets/javascripts/vue_shared/mixins/related_issuable_mixin.js b/app/assets/javascripts/vue_shared/mixins/related_issuable_mixin.js index 3c727cb7b3f..fbebd7c7945 100644 --- a/app/assets/javascripts/vue_shared/mixins/related_issuable_mixin.js +++ b/app/assets/javascripts/vue_shared/mixins/related_issuable_mixin.js @@ -159,7 +159,7 @@ const mixins = { return this.displayReference.split(this.pathIdSeparator).pop(); }, createdAtInWords() { - return this.createdAt ? this.timeFormated(this.createdAt) : ''; + return this.createdAt ? this.timeFormatted(this.createdAt) : ''; }, createdAtTimestamp() { return this.createdAt ? formatDate(new Date(this.createdAt)) : ''; @@ -168,10 +168,10 @@ const mixins = { return this.mergedAt ? formatDate(new Date(this.mergedAt)) : ''; }, mergedAtInWords() { - return this.mergedAt ? this.timeFormated(this.mergedAt) : ''; + return this.mergedAt ? this.timeFormatted(this.mergedAt) : ''; }, closedAtInWords() { - return this.closedAt ? this.timeFormated(this.closedAt) : ''; + return this.closedAt ? this.timeFormatted(this.closedAt) : ''; }, closedAtTimestamp() { return this.closedAt ? formatDate(new Date(this.closedAt)) : ''; diff --git a/app/assets/javascripts/vue_shared/mixins/timeago.js b/app/assets/javascripts/vue_shared/mixins/timeago.js index 4e3b9d7b767..af14c6d9486 100644 --- a/app/assets/javascripts/vue_shared/mixins/timeago.js +++ b/app/assets/javascripts/vue_shared/mixins/timeago.js @@ -5,7 +5,7 @@ import { formatDate, getTimeago } from '../../lib/utils/datetime_utility'; */ export default { methods: { - timeFormated(time) { + timeFormatted(time) { const timeago = getTimeago(); return timeago.format(time); diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 07f568e2a04..69e3e7c7acb 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -20,6 +20,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo before_action :check_user_can_push_to_source_branch!, only: [:rebase] before_action only: [:show] do push_frontend_feature_flag(:diffs_batch_load, @project) + push_frontend_feature_flag(:single_mr_diff_view, @project) end before_action do |