Commit a09b4eaf authored by Douwe Maan's avatar Douwe Maan

Merge branch 'ce-to-ee-2018-02-09' into 'master'

CE upstream - 2018-02-09 00:24 UTC

Closes gitlab-qa#180

See merge request gitlab-org/gitlab-ee!4460
parents 23d65b9f 17c1d0ed
...@@ -2,11 +2,18 @@ export default class CILintEditor { ...@@ -2,11 +2,18 @@ export default class CILintEditor {
constructor() { constructor() {
this.editor = window.ace.edit('ci-editor'); this.editor = window.ace.edit('ci-editor');
this.textarea = document.querySelector('#content'); this.textarea = document.querySelector('#content');
this.clearYml = document.querySelector('.clear-yml');
this.editor.getSession().setMode('ace/mode/yaml'); this.editor.getSession().setMode('ace/mode/yaml');
this.editor.on('input', () => { this.editor.on('input', () => {
const content = this.editor.getSession().getValue(); const content = this.editor.getSession().getValue();
this.textarea.value = content; this.textarea.value = content;
}); });
this.clearYml.addEventListener('click', this.clear.bind(this));
}
clear() {
this.editor.setValue('');
} }
} }
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
.col-sm-12 .col-sm-12
.pull-left.prepend-top-10 .pull-left.prepend-top-10
= submit_tag('Validate', class: 'btn btn-success submit-yml') = submit_tag('Validate', class: 'btn btn-success submit-yml')
.pull-right.prepend-top-10
= button_tag('Clear', type: 'button', class: 'btn btn-default clear-yml')
.row.prepend-top-20 .row.prepend-top-20
.col-sm-12 .col-sm-12
......
---
title: Added clear button to ci lint editor
merge_request:
author: Michael Robinson
...@@ -64,9 +64,7 @@ You can also [search and filter](../../search/index.md#issues-and-merge-requests ...@@ -64,9 +64,7 @@ You can also [search and filter](../../search/index.md#issues-and-merge-requests
### Issues per group ### Issues per group
View all the issues in a group (that is, all the issues across all projects in that View issues in all projects in the group, including all projects of all descendant subgroups of the group. Navigate to **Group > Issues** to view these issues. This view also has the open and closed issues tabs.
group) by navigating to **Group > Issues**. This view also has the open and closed
issue tabs.
![Group Issues list view](img/group_issues_list_view.png) ![Group Issues list view](img/group_issues_list_view.png)
......
...@@ -71,9 +71,9 @@ and you can use the tabs available to quickly filter by open and closed. You can ...@@ -71,9 +71,9 @@ and you can use the tabs available to quickly filter by open and closed. You can
## Merge requests per group ## Merge requests per group
View all the merge requests in a group (that is, all the merge requests across all projects in that View merge requests in all projects in the group, including all projects of all descendant subgroups of the group. Navigate to **Group > Merge Requests** to view these merge requests. This view also has the open and closed merge requests tabs.
group) by navigating to **Group > Merge Requests**. This view also has the open, merged, and closed
merge request tabs, from which you can [search and filter the results](../../search/index.md#issues-and-merge-requests-per-group). You can [search and filter the results](../../search/index.md#issues-and-merge-requests-per-group) from here.
![Group Issues list view](img/group_merge_requests_list_view.png) ![Group Issues list view](img/group_merge_requests_list_view.png)
...@@ -154,6 +154,19 @@ administrator to do so. ...@@ -154,6 +154,19 @@ administrator to do so.
![Create new merge requests by email](img/create_from_email.png) ![Create new merge requests by email](img/create_from_email.png)
## Find the merge request that introduced a change
> **Note**: this feature was [implemented in GitLab 10.5](https://gitlab.com/gitlab-org/gitlab-ce/issues/2383).
When viewing the commit details page, GitLab will link to the merge request (or
merge requests, if it's in more than one) containing that commit.
This only applies to commits that are in the most recent version of a merge
request - if a commit was in a merge request, then rebased out of that merge
request, they will not be linked.
[Read more about merge request versions](versions.md)
## Revert changes ## Revert changes
GitLab implements Git's powerful feature to revert any commit with introducing GitLab implements Git's powerful feature to revert any commit with introducing
...@@ -168,7 +181,7 @@ of merge request diff is created. When you visit a merge request that contains ...@@ -168,7 +181,7 @@ of merge request diff is created. When you visit a merge request that contains
more than one pushes, you can select and compare the versions of those merge more than one pushes, you can select and compare the versions of those merge
request diffs. request diffs.
[Read more about the merge requests versions.](versions.md) [Read more about merge request versions](versions.md)
## Work In Progress merge requests ## Work In Progress merge requests
......
...@@ -1614,17 +1614,14 @@ module Gitlab ...@@ -1614,17 +1614,14 @@ module Gitlab
# Gitaly note: JV: Trying to get rid of the 'filter' option so we can implement this with 'git'. # Gitaly note: JV: Trying to get rid of the 'filter' option so we can implement this with 'git'.
def branches_filter(filter: nil, sort_by: nil) def branches_filter(filter: nil, sort_by: nil)
# n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37464 branches = rugged.branches.each(filter).map do |rugged_ref|
branches = Gitlab::GitalyClient.allow_n_plus_1_calls do begin
rugged.branches.each(filter).map do |rugged_ref| target_commit = Gitlab::Git::Commit.find(self, rugged_ref.target)
begin Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target, target_commit)
target_commit = Gitlab::Git::Commit.find(self, rugged_ref.target) rescue Rugged::ReferenceError
Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target, target_commit) # Omit invalid branch
rescue Rugged::ReferenceError end
# Omit invalid branch end.compact
end
end.compact
end
sort_branches(branches, sort_by) sort_branches(branches, sort_by)
end end
......
...@@ -14,7 +14,7 @@ module QA ...@@ -14,7 +14,7 @@ module QA
end end
scenario 'submit request with a valid user name' do scenario 'submit request with a valid user name' do
get request.url, { params: { username: 'root' } } get request.url, { params: { username: Runtime::User.name } }
expect_status(200) expect_status(200)
expect(json_body).to be_an Array expect(json_body).to be_an Array
...@@ -23,7 +23,7 @@ module QA ...@@ -23,7 +23,7 @@ module QA
end end
scenario 'submit request with an invalid user name' do scenario 'submit request with an invalid user name' do
get request.url, { params: { username: 'invalid' } } get request.url, { params: { username: SecureRandom.hex(10) } }
expect_status(200) expect_status(200)
expect(json_body).to be_an Array expect(json_body).to be_an Array
......
...@@ -89,6 +89,8 @@ describe 'Promotions', :js do ...@@ -89,6 +89,8 @@ describe 'Promotions', :js do
find('.close').click find('.close').click
end end
wait_for_requests
visit edit_project_path(project) visit edit_project_path(project)
expect(page).not_to have_selector('#promote_service_desk') expect(page).not_to have_selector('#promote_service_desk')
...@@ -116,6 +118,8 @@ describe 'Promotions', :js do ...@@ -116,6 +118,8 @@ describe 'Promotions', :js do
find('.close').click find('.close').click
end end
wait_for_requests
visit edit_project_path(project) visit edit_project_path(project)
expect(page).not_to have_selector('#promote_mr_features') expect(page).not_to have_selector('#promote_mr_features')
......
...@@ -3,16 +3,19 @@ require 'spec_helper' ...@@ -3,16 +3,19 @@ require 'spec_helper'
describe 'CI Lint', :js do describe 'CI Lint', :js do
before do before do
sign_in(create(:user)) sign_in(create(:user))
visit ci_lint_path
find('#ci-editor')
execute_script("ace.edit('ci-editor').setValue(#{yaml_content.to_json});")
# Ace editor updates a hidden textarea and it happens asynchronously
wait_for('YAML content') do
find('.ace_content').text.present?
end
end end
describe 'YAML parsing' do describe 'YAML parsing' do
before do before do
visit ci_lint_path
# Ace editor updates a hidden textarea and it happens asynchronously
# `sleep 0.1` is actually needed here because of this
find('#ci-editor')
execute_script("ace.edit('ci-editor').setValue(" + yaml_content.to_json + ");")
sleep 0.1
click_on 'Validate' click_on 'Validate'
end end
...@@ -32,11 +35,10 @@ describe 'CI Lint', :js do ...@@ -32,11 +35,10 @@ describe 'CI Lint', :js do
end end
context 'YAML is incorrect' do context 'YAML is incorrect' do
let(:yaml_content) { '' } let(:yaml_content) { 'value: cannot have :' }
it 'displays information about an error' do it 'displays information about an error' do
expect(page).to have_content('Status: syntax is incorrect') expect(page).to have_content('Status: syntax is incorrect')
expect(page).to have_content('Error: Please provide content of .gitlab-ci.yml')
end end
end end
...@@ -48,4 +50,20 @@ describe 'CI Lint', :js do ...@@ -48,4 +50,20 @@ describe 'CI Lint', :js do
end end
end end
end end
describe 'YAML clearing' do
before do
click_on 'Clear'
end
context 'YAML is present' do
let(:yaml_content) do
File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
end
it 'YAML content is cleared' do
expect(page).to have_field('content', with: '', visible: false, type: 'textarea')
end
end
end
end end
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