提交 40024efc 编写于 作者: G GitLab Bot

Add latest changes from gitlab-org/gitlab@master

上级 a1aeaba2
......@@ -199,21 +199,6 @@ RSpec/ExpectChange:
RSpec/ExpectInHook:
Enabled: false
# Offense count: 68
# Cop supports --auto-correct.
RSpec/LetBeforeExamples:
Exclude:
- 'spec/lib/banzai/filter/issue_reference_filter_spec.rb'
- 'spec/lib/banzai/filter/user_reference_filter_spec.rb'
- 'spec/lib/gitlab/email/handler/create_issue_handler_spec.rb'
- 'spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb'
- 'spec/lib/gitlab/email/handler/create_note_handler_spec.rb'
- 'spec/models/commit_range_spec.rb'
- 'spec/models/milestone_spec.rb'
- 'spec/models/project_services/packagist_service_spec.rb'
- 'spec/rubocop/cop/migration/update_column_in_batches_spec.rb'
- 'spec/serializers/pipeline_details_entity_spec.rb'
# Offense count: 2188
# Cop supports --auto-correct.
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
......@@ -679,13 +664,6 @@ Style/RescueModifier:
Style/RescueStandardError:
Enabled: false
# Offense count: 50
# Cop supports --auto-correct.
# Configuration parameters: AllowIfMethodIsEmpty.
Style/SingleLineMethods:
Exclude:
- 'lib/gitlab/ci/ansi2html.rb'
# Offense count: 102
# Cop supports --auto-correct.
# Configuration parameters: .
......
a783958be5ae0797dac9041bdfb884440e0e6306
02ae27efafdf367d991eac43df02b892be378a1b
<script>
/* eslint-disable vue/no-v-html */
import { mapActions, mapGetters, mapState } from 'vuex';
import { GlTooltipDirective } from '@gitlab/ui';
import DiffTableCell from './diff_table_cell.vue';
import { GlTooltipDirective, GlIcon } from '@gitlab/ui';
import {
MATCH_LINE_TYPE,
NEW_LINE_TYPE,
......@@ -11,11 +10,19 @@ import {
CONTEXT_LINE_CLASS_NAME,
LINE_POSITION_LEFT,
LINE_POSITION_RIGHT,
LINE_HOVER_CLASS_NAME,
OLD_NO_NEW_LINE_TYPE,
NEW_NO_NEW_LINE_TYPE,
EMPTY_CELL_TYPE,
} from '../constants';
import { __ } from '~/locale';
import { getParameterByName, parseBoolean } from '~/lib/utils/common_utils';
import DiffGutterAvatars from './diff_gutter_avatars.vue';
export default {
components: {
DiffTableCell,
DiffGutterAvatars,
GlIcon,
},
directives: {
GlTooltip: GlTooltipDirective,
......@@ -50,6 +57,7 @@ export default {
};
},
computed: {
...mapGetters(['isLoggedIn']),
...mapGetters('diffs', ['fileLineCoverage']),
...mapState({
isHighlighted(state) {
......@@ -79,6 +87,70 @@ export default {
coverageState() {
return this.fileLineCoverage(this.filePath, this.line.new_line);
},
isMetaLine() {
const { type } = this.line;
return (
type === OLD_NO_NEW_LINE_TYPE || type === NEW_NO_NEW_LINE_TYPE || type === EMPTY_CELL_TYPE
);
},
classNameMapCell() {
const { type } = this.line;
return [
type,
{
hll: this.isHighlighted,
[LINE_HOVER_CLASS_NAME]:
this.isLoggedIn && this.isHover && !this.isContextLine && !this.isMetaLine,
},
];
},
addCommentTooltip() {
const brokenSymlinks = this.line.commentsDisabled;
let tooltip = __('Add a comment to this line');
if (brokenSymlinks) {
if (brokenSymlinks.wasSymbolic || brokenSymlinks.isSymbolic) {
tooltip = __(
'Commenting on symbolic links that replace or are replaced by files is currently not supported.',
);
} else if (brokenSymlinks.wasReal || brokenSymlinks.isReal) {
tooltip = __(
'Commenting on files that replace or are replaced by symbolic links is currently not supported.',
);
}
}
return tooltip;
},
shouldRenderCommentButton() {
if (this.isLoggedIn) {
const isDiffHead = parseBoolean(getParameterByName('diff_head'));
return !isDiffHead || gon.features?.mergeRefHeadComments;
}
return false;
},
shouldShowCommentButton() {
return this.isHover && !this.isContextLine && !this.isMetaLine && !this.hasDiscussions;
},
hasDiscussions() {
return this.line.discussions && this.line.discussions.length > 0;
},
lineHref() {
return `#${this.line.line_code || ''}`;
},
lineCode() {
return (
this.line.line_code ||
(this.line.left && this.line.left.line_code) ||
(this.line.right && this.line.right.line_code)
);
},
shouldShowAvatarsOnGutter() {
return this.hasDiscussions;
},
},
created() {
this.newLineType = NEW_LINE_TYPE;
......@@ -90,12 +162,20 @@ export default {
this.scrollToLineIfNeededInline(this.line);
},
methods: {
...mapActions('diffs', ['scrollToLineIfNeededInline']),
...mapActions('diffs', [
'scrollToLineIfNeededInline',
'showCommentForm',
'setHighlightedRow',
'toggleLineDiscussions',
]),
handleMouseMove(e) {
// To show the comment icon on the gutter we need to know if we hover the line.
// Current table structure doesn't allow us to do this with CSS in both of the diff view types
this.isHover = e.type === 'mouseover';
},
handleCommentButton() {
this.showCommentForm({ lineCode: this.line.line_code, fileHash: this.fileHash });
},
},
};
</script>
......@@ -109,25 +189,52 @@ export default {
@mouseover="handleMouseMove"
@mouseout="handleMouseMove"
>
<diff-table-cell
:file-hash="fileHash"
:line="line"
:line-type="oldLineType"
:is-bottom="isBottom"
:is-hover="isHover"
:show-comment-button="true"
:is-highlighted="isHighlighted"
class="diff-line-num old_line"
/>
<diff-table-cell
:file-hash="fileHash"
:line="line"
:line-type="newLineType"
:is-bottom="isBottom"
:is-hover="isHover"
:is-highlighted="isHighlighted"
class="diff-line-num new_line qa-new-diff-line"
/>
<td ref="oldTd" class="diff-line-num old_line" :class="classNameMapCell">
<span
v-if="shouldRenderCommentButton"
ref="addNoteTooltip"
v-gl-tooltip
class="add-diff-note tooltip-wrapper"
:title="addCommentTooltip"
>
<button
v-show="shouldShowCommentButton"
ref="addDiffNoteButton"
type="button"
class="add-diff-note note-button js-add-diff-note-button qa-diff-comment"
:disabled="line.commentsDisabled"
@click="handleCommentButton"
>
<gl-icon :size="12" name="comment" />
</button>
</span>
<a
v-if="line.old_line"
ref="lineNumberRefOld"
:data-linenumber="line.old_line"
:href="lineHref"
@click="setHighlightedRow(lineCode)"
>
</a>
<diff-gutter-avatars
v-if="shouldShowAvatarsOnGutter"
:discussions="line.discussions"
:discussions-expanded="line.discussionsExpanded"
@toggleLineDiscussions="
toggleLineDiscussions({ lineCode, fileHash, expanded: !line.discussionsExpanded })
"
/>
</td>
<td ref="newTd" class="diff-line-num new_line qa-new-diff-line" :class="classNameMapCell">
<a
v-if="line.new_line"
ref="lineNumberRefNew"
:data-linenumber="line.new_line"
:href="lineHref"
@click="setHighlightedRow(lineCode)"
>
</a>
</td>
<td
v-gl-tooltip.hover
:title="coverageState.text"
......
<script>
/* eslint-disable vue/no-v-html */
import { mapActions } from 'vuex';
import { GlIcon, GlTooltipDirective } from '@gitlab/ui';
import { GlIcon, GlLoadingIcon, GlTooltipDirective } from '@gitlab/ui';
import timeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
export default {
......@@ -10,6 +10,7 @@ export default {
GitlabTeamMemberBadge: () =>
import('ee_component/vue_shared/components/user_avatar/badges/gitlab_team_member_badge.vue'),
GlIcon,
GlLoadingIcon,
},
directives: {
GlTooltip: GlTooltipDirective,
......@@ -195,13 +196,12 @@ export default {
class="gl-ml-1 gl-text-gray-700 align-middle"
/>
<slot name="extra-controls"></slot>
<i
<gl-loading-icon
v-if="showSpinner"
ref="spinner"
class="fa fa-spinner fa-spin editing-spinner"
:aria-label="__('Comment is being updated')"
aria-hidden="true"
></i>
class="editing-spinner"
:label="__('Comment is being updated')"
/>
</span>
</div>
</template>
<script>
/* eslint-disable vue/no-v-html */
import $ from 'jquery';
import { mapGetters, mapActions } from 'vuex';
import { escape } from 'lodash';
import { GlSprintf } from '@gitlab/ui';
import { GlSprintf, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { truncateSha } from '~/lib/utils/text_utility';
import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue';
......@@ -35,6 +34,9 @@ export default {
NoteBody,
TimelineEntryItem,
},
directives: {
SafeHtml,
},
mixins: [noteable, resolvable, glFeatureFlagsMixin()],
props: {
note: {
......@@ -379,7 +381,7 @@ export default {
:is-confidential="note.confidential"
>
<slot slot="note-header-info" name="note-header-info"></slot>
<span v-if="commit" v-html="actionText"></span>
<span v-if="commit" v-safe-html="actionText"></span>
<span v-else-if="note.created_at" class="d-none d-sm-inline">&middot;</span>
</note-header>
<note-actions
......
......@@ -268,22 +268,24 @@ export default {
</template>
</gl-sprintf>
<div slot="modal-footer" class="w-100">
<div class="float-right">
<gl-button @click="cancelDelete()">{{ __('Cancel') }}</gl-button>
<gl-button
ref="modal-delete-button"
data-method="delete"
:to="destroyPath"
variant="danger"
category="primary"
data-qa-selector="delete_modal_button"
@click="track($options.trackingActions.DELETE_PACKAGE)"
>
{{ __('Delete') }}
</gl-button>
<template #modal-footer>
<div class="gl-w-full">
<div class="float-right">
<gl-button @click="cancelDelete">{{ __('Cancel') }}</gl-button>
<gl-button
ref="modal-delete-button"
data-method="delete"
:to="destroyPath"
variant="danger"
category="primary"
data-qa-selector="delete_modal_button"
@click="track($options.trackingActions.DELETE_PACKAGE)"
>
{{ __('Delete') }}
</gl-button>
</div>
</div>
</div>
</template>
</gl-modal>
</div>
</template>
......@@ -48,7 +48,7 @@ export default {
<input
:value="instruction"
type="text"
class="form-control monospace js-instruction-input"
class="form-control gl-font-monospace js-instruction-input"
readonly
@copy="trackCopy"
/>
......
......@@ -26,7 +26,7 @@ export default {
<div
v-if="showVersion"
class="table-section section-50 gl-display-flex justify-content-md-end"
class="table-section section-50 gl-display-flex gl-justify-content-md-end"
data-testid="version-pattern"
>
<span class="gl-text-body">{{ dependency.version_pattern }}</span>
......
......@@ -82,7 +82,7 @@ export default {
</script>
<template>
<div class="d-flex flex-column">
<div class="gl-display-flex gl-flex-direction-column">
<slot v-if="isListEmpty && !isLoading" name="empty-state"></slot>
<div v-else-if="isLoading">
......@@ -106,7 +106,7 @@ export default {
:per-page="perPage"
:total-items="totalItems"
align="center"
class="w-100 mt-2"
class="gl-w-full gl-mt-3"
/>
<gl-modal
......
......@@ -77,7 +77,9 @@ export default {
<template>
<gl-tabs @input="tabChanged">
<template #tabs-end>
<div class="d-flex align-self-center ml-md-auto py-1 py-md-0">
<div
class="gl-display-flex gl-align-self-center gl-py-2 gl-flex-grow-1 gl-justify-content-end"
>
<package-filter class="mr-1" @filter="requestPackagesList" />
<package-sort @sort:changed="requestPackagesList" />
</div>
......
......@@ -91,7 +91,7 @@ export default {
variant="muted"
:title="moreTagsTooltip"
size="sm"
class="gl-display-none d-md-flex gl-ml-2"
class="gl-display-none gl-display-md-flex gl-ml-2"
><gl-sprintf :message="__('+%{tags} more')">
<template #tags>
{{ moreTagsDisplay }}
......@@ -103,7 +103,7 @@ export default {
v-if="moreTagsDisplay && hideLabel"
data-testid="moreBadge"
variant="muted"
class="d-md-none gl-ml-2"
class="gl-display-md-none gl-ml-2"
>{{ tagsDisplay }}</gl-badge
>
</div>
......
......@@ -48,7 +48,7 @@ export default {
<template>
<div>
<div class="d-xs-flex flex-column d-md-none">
<div class="gl-display-sm-flex gl-flex-direction-column gl-display-md-none">
<gl-skeleton-loader
v-for="index in $options.rowsToRender.mobile"
:key="index"
......@@ -65,7 +65,7 @@ export default {
</gl-skeleton-loader>
</div>
<div class="d-none d-md-flex flex-column">
<div class="gl-display-none gl-display-md-flex gl-flex-direction-column">
<gl-skeleton-loader
v-for="index in $options.rowsToRender.desktop"
:key="index"
......
......@@ -36,24 +36,28 @@ export default {
</script>
<template>
<div class="d-flex align-items-center order-1 order-md-0 mb-md-1">
<div class="gl-display-flex gl-align-items-center gl-mb-2">
<template v-if="hasPipeline">
<gl-icon name="git-merge" class="mr-1" />
<span ref="pipeline-ref" class="mr-1">{{ packageEntity.pipeline.ref }}</span>
<gl-icon name="git-merge" class="gl-mr-2" />
<span data-testid="pipeline-ref" class="gl-mr-2">{{ packageEntity.pipeline.ref }}</span>
<gl-icon name="commit" class="mr-1" />
<gl-link ref="pipeline-sha" :href="linkToCommit" class="mr-1">{{ packageShaShort }}</gl-link>
<gl-icon name="commit" class="gl-mr-2" />
<gl-link data-testid="pipeline-sha" :href="linkToCommit" class="gl-mr-2">{{
packageShaShort
}}</gl-link>
<clipboard-button
:text="packageEntity.pipeline.sha"
:title="__('Copy commit SHA')"
css-class="border-0 py-0 px-1"
css-class="gl-border-0 gl-py-0 gl-px-2"
/>
</template>
<template v-else>
<gl-icon name="upload" class="mr-1" />
<span ref="manual-ref">{{ s__('PackageRegistry|Manually Published') }}</span>
<gl-icon name="upload" class="gl-mr-2" />
<span data-testid="manually-published">
{{ s__('PackageRegistry|Manually Published') }}
</span>
</template>
</div>
</template>
......@@ -7,10 +7,11 @@ import state from './state';
Vue.use(Vuex);
export default initialState =>
new Vuex.Store({
actions,
getters,
mutations,
state: state(initialState),
});
export const getStoreConfig = initialState => ({
actions,
getters,
mutations,
state: state(initialState),
});
export default initialState => new Vuex.Store(getStoreConfig(initialState));
......@@ -7,10 +7,11 @@ import state from './state';
Vue.use(Vuex);
export default initialState =>
new Vuex.Store({
actions,
getters,
mutations,
state: state(initialState),
});
export const getStoreConfig = initialState => ({
actions,
getters,
mutations,
state: state(initialState),
});
export default initialState => new Vuex.Store(getStoreConfig(initialState));
......@@ -7,10 +7,11 @@ import state from './state';
Vue.use(Vuex);
export default () =>
new Vuex.Store({
actions,
mutations,
getters,
state: state(),
});
export const getStoreConfig = () => ({
actions,
mutations,
getters,
state: state(),
});
export default () => new Vuex.Store(getStoreConfig());
......@@ -40,7 +40,6 @@
@import './pages/note_form';
@import './pages/notes';
@import './pages/notifications';
@import './pages/packages';
@import './pages/pages';
@import './pages/pipeline_schedules';
@import './pages/pipelines';
......
.commit-row-description {
border: 0;
border-left: 3px solid $white-dark;
}
.package-list-table[aria-busy='true'] {
td {
padding-bottom: 0;
padding-top: 0;
}
}
......@@ -160,3 +160,20 @@
min-height: $gl-spacing-scale-6;
}
.gl-justify-content-md-end {
@media (min-width: $breakpoint-md) {
width: auto !important;
}
}
.gl-display-md-flex {
@media (min-width: $breakpoint-md) {
display: flex;
}
}
.gl-display-md-none {
@media (min-width: $breakpoint-md) {
display: none;
}
}
......@@ -10,6 +10,8 @@ class Projects::BlobController < Projects::ApplicationController
include RedirectsForMissingPathOnTree
include SourcegraphDecorator
include DiffHelper
include RedisTracking
extend ::Gitlab::Utils::Override
prepend_before_action :authenticate_user!, only: [:edit]
......@@ -35,6 +37,8 @@ class Projects::BlobController < Projects::ApplicationController
push_frontend_feature_flag(:suggest_pipeline) if experiment_enabled?(:suggest_pipeline)