Commit fd0fd602 authored by Valery Sizov's avatar Valery Sizov

Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ee into ce-to-ee

parents 3120d98a 84779047
...@@ -16,6 +16,7 @@ const defaults = { ...@@ -16,6 +16,7 @@ const defaults = {
class BlobForkSuggestion { class BlobForkSuggestion {
constructor(options) { constructor(options) {
this.elementMap = Object.assign({}, defaults, options); this.elementMap = Object.assign({}, defaults, options);
<<<<<<< HEAD
this.onClickWrapper = this.onClick.bind(this); this.onClickWrapper = this.onClick.bind(this);
document.addEventListener('click', this.onClickWrapper); document.addEventListener('click', this.onClickWrapper);
...@@ -40,6 +41,46 @@ class BlobForkSuggestion { ...@@ -40,6 +41,46 @@ class BlobForkSuggestion {
[].forEach.call(this.elementMap.suggestionSections, (suggestionSection) => { [].forEach.call(this.elementMap.suggestionSections, (suggestionSection) => {
suggestionSection.classList.add('hidden'); suggestionSection.classList.add('hidden');
}); });
=======
this.onOpenButtonClick = this.onOpenButtonClick.bind(this);
this.onCancelButtonClick = this.onCancelButtonClick.bind(this);
}
init() {
this.bindEvents();
return this;
}
bindEvents() {
$(this.elementMap.openButtons).on('click', this.onOpenButtonClick);
$(this.elementMap.cancelButtons).on('click', this.onCancelButtonClick);
}
showSuggestionSection(forkPath, action = 'edit') {
$(this.elementMap.suggestionSections).removeClass('hidden');
$(this.elementMap.forkButtons).attr('href', forkPath);
$(this.elementMap.actionTextPieces).text(action);
}
hideSuggestionSection() {
$(this.elementMap.suggestionSections).addClass('hidden');
}
onOpenButtonClick(e) {
const forkPath = $(e.currentTarget).attr('data-fork-path');
const action = $(e.currentTarget).attr('data-action');
this.showSuggestionSection(forkPath, action);
}
onCancelButtonClick() {
this.hideSuggestionSection();
}
destroy() {
$(this.elementMap.openButtons).off('click', this.onOpenButtonClick);
$(this.elementMap.cancelButtons).off('click', this.onCancelButtonClick);
>>>>>>> 847790478f8d85607eacedcdb693cfcd25c415af
} }
onClick(e) { onClick(e) {
......
...@@ -103,7 +103,12 @@ const ShortcutsBlob = require('./shortcuts_blob'); ...@@ -103,7 +103,12 @@ const ShortcutsBlob = require('./shortcuts_blob');
cancelButtons: document.querySelectorAll('.js-cancel-fork-suggestion-button'), cancelButtons: document.querySelectorAll('.js-cancel-fork-suggestion-button'),
suggestionSections: document.querySelectorAll('.js-file-fork-suggestion-section'), suggestionSections: document.querySelectorAll('.js-file-fork-suggestion-section'),
actionTextPieces: document.querySelectorAll('.js-file-fork-suggestion-section-action'), actionTextPieces: document.querySelectorAll('.js-file-fork-suggestion-section-action'),
<<<<<<< HEAD
}); });
=======
})
.init();
>>>>>>> 847790478f8d85607eacedcdb693cfcd25c415af
} }
switch (page) { switch (page) {
......
<script>
/* eslint-disable no-new, no-undef */ /* eslint-disable no-new, no-undef */
/* global Flash */ /* global Flash */
/** /**
...@@ -22,7 +23,7 @@ import statusCodes from '~/lib/utils/http_status'; ...@@ -22,7 +23,7 @@ import statusCodes from '~/lib/utils/http_status';
import '~/flash'; import '~/flash';
import '~/lib/utils/common_utils'; import '~/lib/utils/common_utils';
import deployBoardSvg from 'empty_states/icons/_deploy_board.svg'; import deployBoardSvg from 'empty_states/icons/_deploy_board.svg';
import instanceComponent from './deploy_board_instance_component'; import instanceComponent from './deploy_board_instance_component.vue';
export default { export default {
...@@ -160,12 +161,15 @@ export default { ...@@ -160,12 +161,15 @@ export default {
return '<projectname>'; return '<projectname>';
}, },
}, },
};
template: ` </script>
<template>
<div class="js-deploy-board deploy-board"> <div class="js-deploy-board deploy-board">
<div v-if="isLoading"> <div v-if="isLoading">
<i class="fa fa-spinner fa-spin" aria-hidden="true"></i> <i
class="fa fa-spinner fa-spin"
aria-hidden="true" />
</div> </div>
<div v-if="canRenderDeployBoard"> <div v-if="canRenderDeployBoard">
...@@ -190,8 +194,11 @@ export default { ...@@ -190,8 +194,11 @@ export default {
</div> </div>
</section> </section>
<section class="deploy-board-actions" v-if="deployBoardData.rollback_url || deployBoardData.abort_url"> <section
<a class="btn" class="deploy-board-actions"
v-if="deployBoardData.rollback_url || deployBoardData.abort_url">
<a
class="btn"
data-method="post" data-method="post"
rel="nofollow" rel="nofollow"
v-if="deployBoardData.rollback_url" v-if="deployBoardData.rollback_url"
...@@ -199,7 +206,8 @@ export default { ...@@ -199,7 +206,8 @@ export default {
Rollback Rollback
</a> </a>
<a class="btn btn-red btn-inverted" <a
class="btn btn-red btn-inverted"
data-method="post" data-method="post"
rel="nofollow" rel="nofollow"
v-if="deployBoardData.abort_url" v-if="deployBoardData.abort_url"
...@@ -210,8 +218,9 @@ export default { ...@@ -210,8 +218,9 @@ export default {
</div> </div>
<div v-if="canRenderEmptyState"> <div v-if="canRenderEmptyState">
<section class="deploy-board-empty-state-svg"> <section
${deployBoardSvg} class="deploy-board-empty-state-svg"
v-html="deployBoardSvg">
</section> </section>
<section class="deploy-board-empty-state-text"> <section class="deploy-board-empty-state-text">
...@@ -223,9 +232,10 @@ export default { ...@@ -223,9 +232,10 @@ export default {
</section> </section>
</div> </div>
<div v-if="canRenderErrorState" class="deploy-board-error-message"> <div
v-if="canRenderErrorState"
class="deploy-board-error-message">
We can't fetch the data right now. Please try again later. We can't fetch the data right now. Please try again later.
</div> </div>
</div> </div>
`, </script>
};
<script>
/** /**
* An instance in deploy board is represented by a square in this mockup: * An instance in deploy board is represented by a square in this mockup:
* https://gitlab.com/gitlab-org/gitlab-ce/uploads/2f655655c0eadf655d0ae7467b53002a/environments__deploy-graphic.png * https://gitlab.com/gitlab-org/gitlab-ce/uploads/2f655655c0eadf655d0ae7467b53002a/environments__deploy-graphic.png
...@@ -50,8 +51,9 @@ export default { ...@@ -50,8 +51,9 @@ export default {
return cssClassName; return cssClassName;
}, },
}, },
};
template: ` </script>
<template>
<div <div
class="deploy-board-instance has-tooltip" class="deploy-board-instance has-tooltip"
:class="cssClass" :class="cssClass"
...@@ -59,5 +61,4 @@ export default { ...@@ -59,5 +61,4 @@ export default {
data-toggle="tooltip" data-toggle="tooltip"
data-placement="top"> data-placement="top">
</div> </div>
`, </template>
};
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Render environments table. * Render environments table.
*/ */
import EnvironmentTableRowComponent from './environment_item.vue'; import EnvironmentTableRowComponent from './environment_item.vue';
import DeployBoard from './deploy_board_component'; import DeployBoard from './deploy_board_component.vue';
export default { export default {
components: { components: {
......
...@@ -38,9 +38,8 @@ class Projects::DeployKeysController < Projects::ApplicationController ...@@ -38,9 +38,8 @@ class Projects::DeployKeysController < Projects::ApplicationController
deploy_key_project = @project.deploy_keys_projects.find_by(deploy_key_id: params[:id]) deploy_key_project = @project.deploy_keys_projects.find_by(deploy_key_id: params[:id])
return render_404 unless deploy_key_project return render_404 unless deploy_key_project
deploy_key_project.destroy!
load_key load_key
deploy_key_project.destroy!
log_audit_event(@key.title, action: :destroy) log_audit_event(@key.title, action: :destroy)
redirect_to_repository_settings(@project) redirect_to_repository_settings(@project)
......
...@@ -31,3 +31,9 @@ ...@@ -31,3 +31,9 @@
= link_to namespace_project_pages_path(@project.namespace, @project), title: 'Pages' do = link_to namespace_project_pages_path(@project.namespace, @project), title: 'Pages' do
%span %span
Pages Pages
= nav_link(controller: :audit_events) do
= link_to namespace_project_audit_events_path(@project.namespace, @project), title: "Audit Events" do
%span
Audit Events
...@@ -63,4 +63,44 @@ describe Projects::BuildsController do ...@@ -63,4 +63,44 @@ describe Projects::BuildsController do
expect(json_response['favicon']).to eq "/assets/ci_favicons/#{status.favicon}.ico" expect(json_response['favicon']).to eq "/assets/ci_favicons/#{status.favicon}.ico"
end end
end end
describe 'GET trace.json' do
let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) }
let(:user) { create(:user) }
context 'when user is logged in as developer' do
before do
project.add_developer(user)
sign_in(user)
get_trace
end
it 'traces build log' do
expect(response).to have_http_status(:ok)
expect(json_response['id']).to eq build.id
expect(json_response['status']).to eq build.status
end
end
context 'when user is logged in as non member' do
before do
sign_in(user)
get_trace
end
it 'traces build log' do
expect(response).to have_http_status(:ok)
expect(json_response['id']).to eq build.id
expect(json_response['status']).to eq build.status
end
end
def get_trace
get :trace, namespace_id: project.namespace,
project_id: project,
id: build.id,
format: :json
end
end
end end
require 'spec_helper'
describe Projects::BuildsController do
include ApiHelpers
let(:project) { create(:empty_project, :public) }
describe 'GET trace.json' do
let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) }
let(:user) { create(:user) }
context 'when user is logged in as developer' do
before do
project.add_developer(user)
sign_in(user)
get_trace
end
it 'traces build log' do
expect(response).to have_http_status(:ok)
expect(json_response['id']).to eq build.id
expect(json_response['status']).to eq build.status
end
end
context 'when user is logged in as non member' do
before do
sign_in(user)
get_trace
end
it 'traces build log' do
expect(response).to have_http_status(:ok)
expect(json_response['id']).to eq build.id
expect(json_response['status']).to eq build.status
end
end
def get_trace
get :trace, namespace_id: project.namespace,
project_id: project,
id: build.id,
format: :json
end
end
end
...@@ -18,8 +18,13 @@ feature 'Groups > Audit Events', js: true, feature: true do ...@@ -18,8 +18,13 @@ feature 'Groups > Audit Events', js: true, feature: true do
group_member = group.members.find_by(user_id: pete) group_member = group.members.find_by(user_id: pete)
page.within "#group_member_#{group_member.id}" do page.within "#group_member_#{group_member.id}" do
<<<<<<< HEAD:spec/features/groups/audit_events.rb
click_button('Developer') click_button('Developer')
click_link('Master') click_link('Master')
=======
click_button 'Developer'
click_link 'Master'
>>>>>>> 847790478f8d85607eacedcdb693cfcd25c415af:spec/features/groups/audit_events_spec.rb
end end
# This is to avoid a Capybara::Poltergeist::MouseEventFailed error # This is to avoid a Capybara::Poltergeist::MouseEventFailed error
......
...@@ -36,11 +36,9 @@ feature 'Groups > Pipeline Quota', feature: true do ...@@ -36,11 +36,9 @@ feature 'Groups > Pipeline Quota', feature: true do
let!(:project) { create(:empty_project, namespace: group, shared_runners_enabled: false) } let!(:project) { create(:empty_project, namespace: group, shared_runners_enabled: false) }
it 'is not linked within the group settings dropdown' do it 'is not linked within the group settings dropdown' do
visit group_path(group) visit edit_group_path(group)
page.within('.layout-nav') do expect(page).not_to have_link('Pipelines quota')
expect(page).not_to have_selector(:link_or_button, 'Pipeline Quota')
end
end end
it 'shows correct group quota info' do it 'shows correct group quota info' do
...@@ -60,12 +58,10 @@ feature 'Groups > Pipeline Quota', feature: true do ...@@ -60,12 +58,10 @@ feature 'Groups > Pipeline Quota', feature: true do
context 'minutes under quota' do context 'minutes under quota' do
let(:group) { create(:group, :with_not_used_build_minutes_limit) } let(:group) { create(:group, :with_not_used_build_minutes_limit) }
it 'is linked within the group settings dropdown' do it 'is linked within the group settings tab' do
visit group_path(group) visit edit_group_path(group)
page.within('.layout-nav') do expect(page).to have_link('Pipelines quota')
expect(page).to have_selector(:link_or_button, 'Pipeline Quota')
end
end end
it 'shows correct group quota info' do it 'shows correct group quota info' do
...@@ -83,12 +79,10 @@ feature 'Groups > Pipeline Quota', feature: true do ...@@ -83,12 +79,10 @@ feature 'Groups > Pipeline Quota', feature: true do
let(:group) { create(:group, :with_used_build_minutes_limit) } let(:group) { create(:group, :with_used_build_minutes_limit) }
let!(:other_project) { create(:empty_project, namespace: group, shared_runners_enabled: false) } let!(:other_project) { create(:empty_project, namespace: group, shared_runners_enabled: false) }
it 'is linked within the group settings dropdown' do it 'is linked within the group settings tab' do
visit group_path(group) visit edit_group_path(group)
page.within('.layout-nav') do expect(page).to have_link('Pipelines quota')
expect(page).to have_selector(:link_or_button, 'Pipeline Quota')
end
end end
it 'shows correct group quota and projects info' do it 'shows correct group quota and projects info' do
......
...@@ -4,7 +4,7 @@ feature 'Resolve an open discussion in a merge request by creating an issue', fe ...@@ -4,7 +4,7 @@ feature 'Resolve an open discussion in a merge request by creating an issue', fe
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, only_allow_merge_if_all_discussions_are_resolved: true) } let(:project) { create(:project, only_allow_merge_if_all_discussions_are_resolved: true) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
let!(:discussion) { Discussion.for_diff_notes([create(:diff_note_on_merge_request, noteable: merge_request, project: project)]).first } let!(:discussion) { create(:diff_note_on_merge_request, noteable: merge_request, project: project).to_discussion }
describe 'As a user with access to the project' do describe 'As a user with access to the project' do
before do before do
...@@ -74,8 +74,8 @@ feature 'Resolve an open discussion in a merge request by creating an issue', fe ...@@ -74,8 +74,8 @@ feature 'Resolve an open discussion in a merge request by creating an issue', fe
it 'Shows a notice to ask someone else to resolve the discussions' do it 'Shows a notice to ask someone else to resolve the discussions' do
expect(page).to have_content("The discussion at #{merge_request.to_reference}"\ expect(page).to have_content("The discussion at #{merge_request.to_reference}"\
"(discussion #{discussion.first_note.id}) will stay unresolved."\ " (discussion #{discussion.first_note.id}) will stay unresolved."\
"Ask someone with permission to resolve it.") " Ask someone with permission to resolve it.")
end end
end end
end end
...@@ -17,14 +17,17 @@ feature 'Projects > Audit Events', js: true, feature: true do ...@@ -17,14 +17,17 @@ feature 'Projects > Audit Events', js: true, feature: true do
fill_in 'deploy_key_title', with: 'laptop' fill_in 'deploy_key_title', with: 'laptop'
fill_in 'deploy_key_key', with: 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop' fill_in 'deploy_key_key', with: 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop'
click_button 'Create' click_button 'Add key'
visit namespace_project_audit_events_path(project.namespace, project) visit namespace_project_audit_events_path(project.namespace, project)
expect(page).to have_content('Add deploy key') expect(page).to have_content('Add deploy key')
visit namespace_project_deploy_keys_path(project.namespace, project) visit namespace_project_deploy_keys_path(project.namespace, project)
accept_confirm do
click_link 'Remove' click_link 'Remove'
end
visit namespace_project_audit_events_path(project.namespace, project) visit namespace_project_audit_events_path(project.namespace, project)
...@@ -43,8 +46,13 @@ feature 'Projects > Audit Events', js: true, feature: true do ...@@ -43,8 +46,13 @@ feature 'Projects > Audit Events', js: true, feature: true do
project_member = project.project_member(pete) project_member = project.project_member(pete)
page.within "#project_member_#{project_member.id}" do page.within "#project_member_#{project_member.id}" do
<<<<<<< HEAD:spec/features/projects/audit_events.rb
click_button('Developer') click_button('Developer')
click_link('Reporter') click_link('Reporter')
=======
click_button 'Developer'
click_link 'Master'
>>>>>>> 847790478f8d85607eacedcdb693cfcd25c415af:spec/features/projects/audit_events_spec.rb
end end
# This is to avoid a Capybara::Poltergeist::MouseEventFailed error # This is to avoid a Capybara::Poltergeist::MouseEventFailed error
......
...@@ -3,6 +3,7 @@ import BlobForkSuggestion from '~/blob/blob_fork_suggestion'; ...@@ -3,6 +3,7 @@ import BlobForkSuggestion from '~/blob/blob_fork_suggestion';
describe('BlobForkSuggestion', () => { describe('BlobForkSuggestion', () => {
let blobForkSuggestion; let blobForkSuggestion;
<<<<<<< HEAD
const openButtons = [document.createElement('div')]; const openButtons = [document.createElement('div')];
const forkButtons = [document.createElement('a')]; const forkButtons = [document.createElement('a')];
const cancelButtons = [document.createElement('div')]; const cancelButtons = [document.createElement('div')];
...@@ -17,6 +18,23 @@ describe('BlobForkSuggestion', () => { ...@@ -17,6 +18,23 @@ describe('BlobForkSuggestion', () => {
suggestionSections, suggestionSections,
actionTextPieces, actionTextPieces,
}); });
=======
const openButton = document.createElement('div');
const forkButton = document.createElement('a');
const cancelButton = document.createElement('div');
const suggestionSection = document.createElement('div');
const actionTextPiece = document.createElement('div');
beforeEach(() => {
blobForkSuggestion = new BlobForkSuggestion({
openButtons: openButton,
forkButtons: forkButton,
cancelButtons: cancelButton,
suggestionSections: suggestionSection,
actionTextPieces: actionTextPiece,
})
.init();
>>>>>>> 847790478f8d85607eacedcdb693cfcd25c415af
}); });
afterEach(() => { afterEach(() => {
...@@ -25,13 +43,23 @@ describe('BlobForkSuggestion', () => { ...@@ -25,13 +43,23 @@ describe('BlobForkSuggestion', () => {
it('showSuggestionSection', () => { it('showSuggestionSection', () => {
blobForkSuggestion.showSuggestionSection('/foo', 'foo'); blobForkSuggestion.showSuggestionSection('/foo', 'foo');
<<<<<<< HEAD
expect(suggestionSections[0].classList.contains('hidden')).toEqual(false); expect(suggestionSections[0].classList.contains('hidden')).toEqual(false);
expect(forkButtons[0].getAttribute('href')).toEqual('/foo'); expect(forkButtons[0].getAttribute('href')).toEqual('/foo');
expect(actionTextPieces[0].textContent).toEqual('foo'); expect(actionTextPieces[0].textContent).toEqual('foo');
=======
expect(suggestionSection.classList.contains('hidden')).toEqual(false);
expect(forkButton.getAttribute('href')).toEqual('/foo');
expect(actionTextPiece.textContent).toEqual('foo');
>>>>>>> 847790478f8d85607eacedcdb693cfcd25c415af
}); });
it('hideSuggestionSection', () => { it('hideSuggestionSection', () => {
blobForkSuggestion.hideSuggestionSection(); blobForkSuggestion.hideSuggestionSection();
<<<<<<< HEAD
expect(suggestionSections[0].classList.contains('hidden')).toEqual(true); expect(suggestionSections[0].classList.contains('hidden')).toEqual(true);
=======
expect(suggestionSection.classList.contains('hidden')).toEqual(true);
>>>>>>> 847790478f8d85607eacedcdb693cfcd25c415af
}); });
}); });
import Vue from 'vue'; import Vue from 'vue';
import DeployBoard from '~/environments/components/deploy_board_component'; import DeployBoard from '~/environments/components/deploy_board_component.vue';
import Service from '~/environments/services/environments_service'; import Service from '~/environments/services/environments_service';
const { deployBoardMockData, invalidDeployBoardMockData } = require('./mock_data'); const { deployBoardMockData, invalidDeployBoardMockData } = require('./mock_data');
......
import Vue from 'vue'; import Vue from 'vue';
import DeployBoardInstance from '~/environments/components/deploy_board_instance_component'; import DeployBoardInstance from '~/environments/components/deploy_board_instance_component.vue';
describe('Deploy Board Instance', () => { describe('Deploy Board Instance', () => {
let DeployBoardInstanceComponent; let DeployBoardInstanceComponent;
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::OtherMarkup, lib: true do describe Gitlab::OtherMarkup, lib: true do
let(:context) { {} }
context "XSS Checks" do context "XSS Checks" do
links = { links = {
'links' => { 'links' => {
file: 'file.rdoc', file: 'file.rdoc',
input: 'XSS[JaVaScriPt:alert(1)]', input: 'XSS[JaVaScriPt:alert(1)]',
output: '<p><a>XSS</a></p>' output: "\n" + '<p><a>XSS</a></p>' + "\n"
} }
} }
links.each do |name, data| links.each do |name, data|
......
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