Commit ee5be26d authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'ce-to-ee-2018-11-22' into 'master'

CE upstream - 2018-11-22 16:22 UTC

Closes gitlab-ce#53019 and gitlab-ce#48816

See merge request gitlab-org/gitlab-ee!8558
parents 579a7f8d b7d98cc2
...@@ -798,10 +798,10 @@ gitlab:assets:compile: ...@@ -798,10 +798,10 @@ gitlab:assets:compile:
- webpack-report/ - webpack-report/
- public/assets/ - public/assets/
only: only:
- branches@gitlab-org/gitlab-ce - //@gitlab-org/gitlab-ce
- branches@gitlab-org/gitlab-ee - //@gitlab-org/gitlab-ee
- tags@gitlab-org/gitlab-ce - //@gitlab/gitabhq
- tags@gitlab-org/gitlab-ee - //@gitlab/gitlab-ee
tags: tags:
- gitlab-org-delivery - gitlab-org-delivery
- high-cpu - high-cpu
......
...@@ -55,8 +55,6 @@ export default { ...@@ -55,8 +55,6 @@ export default {
diffViewType: state => state.diffs.diffViewType, diffViewType: state => state.diffs.diffViewType,
mergeRequestDiffs: state => state.diffs.mergeRequestDiffs, mergeRequestDiffs: state => state.diffs.mergeRequestDiffs,
mergeRequestDiff: state => state.diffs.mergeRequestDiff, mergeRequestDiff: state => state.diffs.mergeRequestDiff,
latestVersionPath: state => state.diffs.latestVersionPath,
startVersion: state => state.diffs.startVersion,
commit: state => state.diffs.commit, commit: state => state.diffs.commit,
targetBranchName: state => state.diffs.targetBranchName, targetBranchName: state => state.diffs.targetBranchName,
renderOverflowWarning: state => state.diffs.renderOverflowWarning, renderOverflowWarning: state => state.diffs.renderOverflowWarning,
...@@ -75,24 +73,6 @@ export default { ...@@ -75,24 +73,6 @@ export default {
path: '', path: '',
}; };
}, },
notAllCommentsDisplayed() {
if (this.commit) {
return __('Only comments from the following commit are shown below');
} else if (this.startVersion) {
return __(
"Not all comments are displayed because you're comparing two versions of the diff.",
);
}
return __(
"Not all comments are displayed because you're viewing an old version of the diff.",
);
},
showLatestVersion() {
if (this.commit) {
return __('Show latest version of the diff');
}
return __('Show latest version');
},
canCurrentUserFork() { canCurrentUserFork() {
return this.currentUser.can_fork === true && this.currentUser.can_create_merge_request; return this.currentUser.can_fork === true && this.currentUser.can_create_merge_request;
}, },
...@@ -184,10 +164,8 @@ export default { ...@@ -184,10 +164,8 @@ export default {
<div v-if="isLoading" class="loading"><gl-loading-icon /></div> <div v-if="isLoading" class="loading"><gl-loading-icon /></div>
<div v-else id="diffs" :class="{ active: shouldShow }" class="diffs tab-pane"> <div v-else id="diffs" :class="{ active: shouldShow }" class="diffs tab-pane">
<compare-versions <compare-versions
v-if="showCompareVersions"
:merge-request-diffs="mergeRequestDiffs" :merge-request-diffs="mergeRequestDiffs"
:merge-request-diff="mergeRequestDiff" :merge-request-diff="mergeRequestDiff"
:start-version="startVersion"
:target-branch="targetBranch" :target-branch="targetBranch"
/> />
...@@ -199,34 +177,23 @@ export default { ...@@ -199,34 +177,23 @@ export default {
:email-patch-path="emailPatchPath" :email-patch-path="emailPatchPath"
/> />
<div
v-if="commit || startVersion || (mergeRequestDiff && !mergeRequestDiff.latest)"
class="mr-version-controls"
>
<div class="content-block comments-disabled-notif clearfix">
<i class="fa fa-info-circle"></i> {{ notAllCommentsDisplayed }}
<div class="pull-right">
<a :href="latestVersionPath" class="btn btn-sm"> {{ showLatestVersion }} </a>
</div>
</div>
</div>
<commit-widget v-if="commit" :commit="commit" />
<div <div
:data-can-create-note="getNoteableData.current_user.can_create_note" :data-can-create-note="getNoteableData.current_user.can_create_note"
class="files d-flex prepend-top-default" class="files d-flex prepend-top-default"
> >
<div v-show="showTreeList" class="diff-tree-list"><tree-list /></div> <div v-show="showTreeList" class="diff-tree-list"><tree-list /></div>
<div v-if="diffFiles.length > 0" class="diff-files-holder"> <div class="diff-files-holder">
<diff-file <commit-widget v-if="commit" :commit="commit" />
v-for="file in diffFiles" <template v-if="diffFiles.length > 0">
:key="file.newPath" <diff-file
:file="file" v-for="file in diffFiles"
:can-current-user-fork="canCurrentUserFork" :key="file.newPath"
/> :file="file"
:can-current-user-fork="canCurrentUserFork"
/>
</template>
<no-changes v-else />
</div> </div>
<no-changes v-else />
</div> </div>
</div> </div>
</div> </div>
......
...@@ -28,7 +28,7 @@ export default { ...@@ -28,7 +28,7 @@ export default {
</script> </script>
<template> <template>
<div class="info-well prepend-top-default"> <div class="info-well w-100">
<div class="well-segment"> <div class="well-segment">
<ul class="blob-commit-info"> <ul class="blob-commit-info">
<commit-item :commit="commit" /> <commit-item :commit="commit" />
......
<script> <script>
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import { GlTooltipDirective } from '@gitlab/ui'; import { GlTooltipDirective, GlLink, GlButton } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { getParameterValues, mergeUrlParams } from '~/lib/utils/url_utility'; import { getParameterValues, mergeUrlParams } from '~/lib/utils/url_utility';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
...@@ -10,6 +10,8 @@ export default { ...@@ -10,6 +10,8 @@ export default {
components: { components: {
CompareVersionsDropdown, CompareVersionsDropdown,
Icon, Icon,
GlLink,
GlButton,
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
...@@ -20,13 +22,9 @@ export default { ...@@ -20,13 +22,9 @@ export default {
required: true, required: true,
}, },
mergeRequestDiff: { mergeRequestDiff: {
type: Object,
required: true,
},
startVersion: {
type: Object, type: Object,
required: false, required: false,
default: null, default: () => ({}),
}, },
targetBranch: { targetBranch: {
type: Object, type: Object,
...@@ -35,7 +33,7 @@ export default { ...@@ -35,7 +33,7 @@ export default {
}, },
}, },
computed: { computed: {
...mapState('diffs', ['commit', 'showTreeList']), ...mapState('diffs', ['commit', 'showTreeList', 'startVersion', 'latestVersionPath']),
...mapGetters('diffs', ['isInlineView', 'isParallelView', 'hasCollapsedFile']), ...mapGetters('diffs', ['isInlineView', 'isParallelView', 'hasCollapsedFile']),
comparableDiffs() { comparableDiffs() {
return this.mergeRequestDiffs.slice(1); return this.mergeRequestDiffs.slice(1);
...@@ -102,7 +100,18 @@ export default { ...@@ -102,7 +100,18 @@ export default {
class="mr-version-compare-dropdown" class="mr-version-compare-dropdown"
/> />
</div> </div>
<div v-else-if="commit">
{{ __('Viewing commit') }}
<gl-link :href="commit.commit_url" class="monospace">{{ commit.short_id }}</gl-link>
</div>
<div class="inline-parallel-buttons d-none d-md-flex ml-auto"> <div class="inline-parallel-buttons d-none d-md-flex ml-auto">
<gl-button
v-if="commit || startVersion"
:href="latestVersionPath"
class="append-right-8 js-latest-version"
>
{{ __('Show latest version') }}
</gl-button>
<a v-show="hasCollapsedFile" class="btn btn-default append-right-8" @click="expandAllFiles"> <a v-show="hasCollapsedFile" class="btn btn-default append-right-8" @click="expandAllFiles">
{{ __('Expand all') }} {{ __('Expand all') }}
</a> </a>
......
<script> <script>
import _ from 'underscore'; import _ from 'underscore';
import { mapActions, mapGetters } from 'vuex'; import { mapActions, mapGetters } from 'vuex';
import { polyfillSticky } from '~/lib/utils/sticky';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import FileIcon from '~/vue_shared/components/file_icon.vue'; import FileIcon from '~/vue_shared/components/file_icon.vue';
...@@ -116,6 +117,9 @@ export default { ...@@ -116,6 +117,9 @@ export default {
return `\`${this.diffFile.file_path}\``; return `\`${this.diffFile.file_path}\``;
}, },
}, },
mounted() {
polyfillSticky(this.$refs.header);
},
methods: { methods: {
...mapActions('diffs', ['toggleFileDiscussions']), ...mapActions('diffs', ['toggleFileDiscussions']),
handleToggleFile(e, checkTarget) { handleToggleFile(e, checkTarget) {
......
...@@ -6,6 +6,28 @@ ...@@ -6,6 +6,28 @@
.file-title-flex-parent { .file-title-flex-parent {
cursor: pointer; cursor: pointer;
@media (min-width: map-get($grid-breakpoints, md)) {
position: -webkit-sticky;
position: sticky;
top: 92px;
z-index: 102;
&::before {
content: '';
position: absolute;
top: -1px;
left: -10px;
width: 10px;
height: calc(100% + 1px);
background: $white-light;
border-right: 1px solid $border-color;
}
}
.with-performance-bar & {
top: 127px;
}
a:hover { a:hover {
text-decoration: none; text-decoration: none;
} }
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
.detail-page-header, .detail-page-header,
.page-content-header, .page-content-header,
.commit-box, .commit-box,
.info-well,
.commit-ci-menu, .commit-ci-menu,
.files-changed-inner, .files-changed-inner,
.limited-header-width, .limited-header-width,
......
...@@ -717,6 +717,7 @@ ...@@ -717,6 +717,7 @@
.mr-version-menus-container { .mr-version-menus-container {
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap;
padding: 16px; padding: 16px;
z-index: 199; z-index: 199;
white-space: nowrap; white-space: nowrap;
......
---
title: Show tree collapse button for merge request commit diffs
merge_request:
author:
type: fixed
---
title: Make diff file headers sticky
merge_request:
author:
type: changed
...@@ -112,8 +112,7 @@ If your SMTP server requires authentication make sure to read the section on pro ...@@ -112,8 +112,7 @@ If your SMTP server requires authentication make sure to read the section on pro
your password in the [secrets documentation](https://gitlab.com/charts/gitlab/blob/master/doc/installation/secrets.md#smtp-password). your password in the [secrets documentation](https://gitlab.com/charts/gitlab/blob/master/doc/installation/secrets.md#smtp-password).
You can disable authentication settings with `--set global.smtp.authentication=""`. You can disable authentication settings with `--set global.smtp.authentication=""`.
If your Kubernetes cluster is on GKE, be aware that SMTP ports [25, 465, and 587 If your Kubernetes cluster is on GKE, be aware that SMTP port [25 is blocked](https://cloud.google.com/compute/docs/tutorials/sending-mail/#using_standard_email_ports).
are blocked](https://cloud.google.com/compute/docs/tutorials/sending-mail/#using_standard_email_ports).
### Deploying the Community Edition ### Deploying the Community Edition
......
...@@ -5570,12 +5570,6 @@ msgstr "" ...@@ -5570,12 +5570,6 @@ msgstr ""
msgid "None" msgid "None"
msgstr "" msgstr ""
msgid "Not all comments are displayed because you're comparing two versions of the diff."
msgstr ""
msgid "Not all comments are displayed because you're viewing an old version of the diff."
msgstr ""
msgid "Not allowed to merge" msgid "Not allowed to merge"
msgstr "" msgstr ""
...@@ -5728,9 +5722,6 @@ msgstr "" ...@@ -5728,9 +5722,6 @@ msgstr ""
msgid "Only admins" msgid "Only admins"
msgstr "" msgstr ""
msgid "Only comments from the following commit are shown below"
msgstr ""
msgid "Only mirror protected branches" msgid "Only mirror protected branches"
msgstr "" msgstr ""
...@@ -7478,9 +7469,6 @@ msgstr "" ...@@ -7478,9 +7469,6 @@ msgstr ""
msgid "Show latest version" msgid "Show latest version"
msgstr "" msgstr ""
msgid "Show latest version of the diff"
msgstr ""
msgid "Show parent pages" msgid "Show parent pages"
msgstr "" msgstr ""
...@@ -9010,6 +8998,9 @@ msgstr "" ...@@ -9010,6 +8998,9 @@ msgstr ""
msgid "View the documentation" msgid "View the documentation"
msgstr "" msgstr ""
msgid "Viewing commit"
msgstr ""
msgid "Visibility and access controls" msgid "Visibility and access controls"
msgstr "" msgstr ""
......
...@@ -105,6 +105,14 @@ module QA ...@@ -105,6 +105,14 @@ module QA
ENV['GITLAB_SANDBOX_NAME'] ENV['GITLAB_SANDBOX_NAME']
end end
def namespace_name
ENV['GITLAB_NAMESPACE_NAME']
end
def auto_devops_project_name
ENV['GITLAB_AUTO_DEVOPS_PROJECT_NAME']
end
def gcloud_account_key def gcloud_account_key
ENV.fetch("GCLOUD_ACCOUNT_KEY") ENV.fetch("GCLOUD_ACCOUNT_KEY")
end end
......
...@@ -8,7 +8,7 @@ module QA ...@@ -8,7 +8,7 @@ module QA
end end
def name def name
"qa-test-#{time.strftime('%Y-%m-%d-%H-%M-%S')}" Runtime::Env.namespace_name || "qa-test-#{time.strftime('%Y-%m-%d-%H-%M-%S')}"
end end
def path def path
......
...@@ -16,7 +16,7 @@ module QA ...@@ -16,7 +16,7 @@ module QA
Page::Main::Login.act { sign_in_using_credentials } Page::Main::Login.act { sign_in_using_credentials }
project = Resource::Project.fabricate! do |p| project = Resource::Project.fabricate! do |p|
p.name = 'project-with-autodevops' p.name = Runtime::Env.auto_devops_project_name || 'project-with-autodevops'
p.description = 'Project with Auto Devops' p.description = 'Project with Auto Devops'
end end
......
...@@ -9,7 +9,6 @@ describe 'GFM autocomplete', :js do ...@@ -9,7 +9,6 @@ describe 'GFM autocomplete', :js do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:label) { create(:label, project: project, title: 'special+') } let(:label) { create(:label, project: project, title: 'special+') }
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
let!(:project_snippet) { create(:project_snippet, project: project, title: 'code snippet') }
before do before do
project.add_maintainer(user) project.add_maintainer(user)
...@@ -334,16 +333,57 @@ describe 'GFM autocomplete', :js do ...@@ -334,16 +333,57 @@ describe 'GFM autocomplete', :js do
end end
end end
it 'shows project snippets' do shared_examples 'autocomplete suggestions' do
page.within '.timeline-content-form' do it 'suggests objects correctly' do
find('#note-body').native.send_keys('$') page.within '.timeline-content-form' do
end find('#note-body').native.send_keys(object.class.reference_prefix)
end
page.within '.atwho-container' do
expect(page).to have_content(object.title)
page.within '.atwho-container' do find('ul li').click
expect(page).to have_content(project_snippet.title) end
expect(find('.new-note #note-body').value).to include(expected_body)
end end
end end
context 'issues' do
let(:object) { issue }
let(:expected_body) { object.to_reference }
it_behaves_like 'autocomplete suggestions'
end
context 'merge requests' do
let(:object) { create(:merge_request, source_project: project) }
let(:expected_body) { object.to_reference }
it_behaves_like 'autocomplete suggestions'
end
context 'project snippets' do
let!(:object) { create(:project_snippet, project: project, title: 'code snippet') }
let(:expected_body) { object.to_reference }
it_behaves_like 'autocomplete suggestions'
end
context 'label' do
let!(:object) { label }
let(:expected_body) { object.title }
it_behaves_like 'autocomplete suggestions'
end
context 'milestone' do
let!(:object) { create(:milestone, project: project) }
let(:expected_body) { object.to_reference }
it_behaves_like 'autocomplete suggestions'
end
private private
def expect_to_wrap(should_wrap, item, note, value) def expect_to_wrap(should_wrap, item, note, value)
......
...@@ -66,7 +66,6 @@ describe 'Merge request > User sees versions', :js do ...@@ -66,7 +66,6 @@ describe 'Merge request > User sees versions', :js do
it 'shows comments that were last relevant at that version' do it 'shows comments that were last relevant at that version' do
expect(page).to have_content '5 changed files' expect(page).to have_content '5 changed files'
expect(page).to have_content 'Not all comments are displayed'
position = Gitlab::Diff::Position.new( position = Gitlab::Diff::Position.new(
old_path: ".gitmodules", old_path: ".gitmodules",
...@@ -112,7 +111,6 @@ describe 'Merge request > User sees versions', :js do ...@@ -112,7 +111,6 @@ describe 'Merge request > User sees versions', :js do
) )
expect(page).to have_content '4 changed files' expect(page).to have_content '4 changed files'
expect(page).to have_content '15 additions 6 deletions' expect(page).to have_content '15 additions 6 deletions'
expect(page).to have_content 'Not all comments are displayed'
position = Gitlab::Diff::Position.new( position = Gitlab::Diff::Position.new(
old_path: ".gitmodules", old_path: ".gitmodules",
......
...@@ -3,7 +3,6 @@ import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper ...@@ -3,7 +3,6 @@ import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper
import { TEST_HOST } from 'spec/test_constants'; import { TEST_HOST } from 'spec/test_constants';
import App from '~/diffs/components/app.vue'; import App from '~/diffs/components/app.vue';
import createDiffsStore from '../create_diffs_store'; import createDiffsStore from '../create_diffs_store';
import getDiffWithCommit from '../mock_data/diff_with_commit';
describe('diffs/components/app', () => { describe('diffs/components/app', () => {
const oldMrTabs = window.mrTabs; const oldMrTabs = window.mrTabs;
...@@ -40,43 +39,4 @@ describe('diffs/components/app', () => { ...@@ -40,43 +39,4 @@ describe('diffs/components/app', () => {
it('does not show commit info', () => { it('does not show commit info', () => {
expect(vm.$el).not.toContainElement('.blob-commit-info'); expect(vm.$el).not.toContainElement('.blob-commit-info');
}); });
it('shows comments message, with commit', done => {
vm.$store.state.diffs.commit = getDiffWithCommit().commit;
vm.$nextTick()
.then(() => {
expect(vm.$el).toContainText('Only comments from the following commit are shown below');
expect(vm.$el).toContainElement('.blob-commit-info');
})
.then(done)
.catch(done.fail);
});
it('shows comments message, with old mergeRequestDiff', done => {
vm.$store.state.diffs.mergeRequestDiff = { latest: false };
vm.$store.state.diffs.targetBranch = 'master';
vm.$nextTick()
.then(() => {
expect(vm.$el).toContainText(
"Not all comments are displayed because you're viewing an old version of the diff.",
);
})
.then(done)
.catch(done.fail);
});
it('shows comments message, with startVersion', done => {
vm.$store.state.diffs.startVersion = 'test';
vm.$nextTick()
.then(() => {
expect(vm.$el).toContainText(
"Not all comments are displayed because you're comparing two versions of the diff.",
);
})
.then(done)
.catch(done.fail);
});
}); });
...@@ -3,6 +3,7 @@ import CompareVersionsComponent from '~/diffs/components/compare_versions.vue'; ...@@ -3,6 +3,7 @@ import CompareVersionsComponent from '~/diffs/components/compare_versions.vue';
import store from '~/mr_notes/stores'; import store from '~/mr_notes/stores';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import diffsMockData from '../mock_data/merge_request_diffs'; import diffsMockData from '../mock_data/merge_request_diffs';
import getDiffWithCommit from '../mock_data/diff_with_commit';
describe('CompareVersions', () => { describe('CompareVersions', () => {
let vm; let vm;
...@@ -122,4 +123,24 @@ describe('CompareVersions', () => { ...@@ -122,4 +123,24 @@ describe('CompareVersions', () => {
expect(vm.isWhitespaceVisible()).toBe(true); expect(vm.isWhitespaceVisible()).toBe(true);
}); });
}); });
describe('commit', () => {
beforeEach(done => {
vm.$store.state.diffs.commit = getDiffWithCommit().commit;
vm.mergeRequestDiffs = [];
vm.$nextTick(done);
});
it('renders latest version button', () => {
expect(vm.$el.querySelector('.js-latest-version').textContent.trim()).toBe(
'Show latest version',
);
});
it('renders short commit ID', () => {
expect(vm.$el.textContent).toContain('Viewing commit');
expect(vm.$el.textContent).toContain(vm.commit.short_id);
});
});
}); });
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