Commit 34ef6ce3 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '26138-combine-webhooks-and-services-settings-pages' into 'master'

Moved the webhooks and services gear options to a single one called integrations

See merge request !8380
parents 5a41d92b 8f391fd3
...@@ -6,21 +6,15 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -6,21 +6,15 @@ class Projects::HooksController < Projects::ApplicationController
layout "project_settings" layout "project_settings"
def index
@hooks = @project.hooks
@hook = ProjectHook.new
end
def create def create
@hook = @project.hooks.new(hook_params) @hook = @project.hooks.new(hook_params)
@hook.save @hook.save
if @hook.valid? unless @hook.valid?
redirect_to namespace_project_hooks_path(@project.namespace, @project)
else
@hooks = @project.hooks.select(&:persisted?) @hooks = @project.hooks.select(&:persisted?)
render :index flash[:alert] = @hook.errors.full_messages.join.html_safe
end end
redirect_to namespace_project_settings_integrations_path(@project.namespace, @project)
end end
def test def test
...@@ -44,7 +38,7 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -44,7 +38,7 @@ class Projects::HooksController < Projects::ApplicationController
def destroy def destroy
hook.destroy hook.destroy
redirect_to namespace_project_hooks_path(@project.namespace, @project) redirect_to namespace_project_settings_integrations_path(@project.namespace, @project)
end end
private private
......
...@@ -9,10 +9,6 @@ class Projects::ServicesController < Projects::ApplicationController ...@@ -9,10 +9,6 @@ class Projects::ServicesController < Projects::ApplicationController
layout "project_settings" layout "project_settings"
def index
@services = @project.find_or_initialize_services
end
def edit def edit
end end
......
module Projects
module Settings
class IntegrationsController < Projects::ApplicationController
include ServiceParams
before_action :authorize_admin_project!
layout "project_settings"
def show
@hooks = @project.hooks
@hook = ProjectHook.new
# Services
@services = @project.find_or_initialize_services
end
end
end
end
...@@ -208,6 +208,10 @@ module GitlabRoutingHelper ...@@ -208,6 +208,10 @@ module GitlabRoutingHelper
end end
# Settings # Settings
def project_settings_integrations_path(project, *args)
namespace_project_settings_integrations_path(project.namespace, project, *args)
end
def project_settings_members_path(project, *args) def project_settings_members_path(project, *args)
namespace_project_settings_members_path(project.namespace, project, *args) namespace_project_settings_members_path(project.namespace, project, *args)
end end
......
...@@ -8,14 +8,10 @@ ...@@ -8,14 +8,10 @@
= link_to namespace_project_deploy_keys_path(@project.namespace, @project), title: 'Deploy Keys' do = link_to namespace_project_deploy_keys_path(@project.namespace, @project), title: 'Deploy Keys' do
%span %span
Deploy Keys Deploy Keys
= nav_link(controller: :hooks) do = nav_link(controller: :integrations) do
= link_to namespace_project_hooks_path(@project.namespace, @project), title: 'Webhooks' do = link_to namespace_project_settings_integrations_path(@project.namespace, @project), title: 'Integrations' do
%span %span
Webhooks Integrations
= nav_link(controller: :services) do
= link_to namespace_project_services_path(@project.namespace, @project), title: 'Services' do
%span
Services
= nav_link(controller: :protected_branches) do = nav_link(controller: :protected_branches) do
= link_to namespace_project_protected_branches_path(@project.namespace, @project), title: 'Protected Branches' do = link_to namespace_project_protected_branches_path(@project.namespace, @project), title: 'Protected Branches' do
%span %span
......
- page_title "Services"
.row.prepend-top-default.append-bottom-default .row.prepend-top-default.append-bottom-default
.col-lg-3 .col-lg-3
%h4.prepend-top-0 %h4.prepend-top-0
......
- page_title 'Integrations'
= render 'projects/hooks/index'
= render 'projects/services/index'
- page_title "Webhooks"
- context_title = @project ? 'project' : 'group'
.row.prepend-top-default .row.prepend-top-default
.col-lg-3 .col-lg-3
%h4.prepend-top-0 %h4.prepend-top-0
......
...@@ -307,9 +307,9 @@ constraints(ProjectUrlConstrainer.new) do ...@@ -307,9 +307,9 @@ constraints(ProjectUrlConstrainer.new) do
end end
end end
end end
namespace :settings do namespace :settings do
resource :members, only: [:show] resource :members, only: [:show]
resource :integrations, only: [:show]
end end
# Since both wiki and repository routing contains wildcard characters # Since both wiki and repository routing contains wildcard characters
......
...@@ -39,10 +39,10 @@ Feature: Project Active Tab ...@@ -39,10 +39,10 @@ Feature: Project Active Tab
# Sub Tabs: Settings # Sub Tabs: Settings
Scenario: On Project Settings/Hooks Scenario: On Project Settings/Integrations
Given I visit my project's settings page Given I visit my project's settings page
And I click the "Hooks" tab And I click the "Integrations" tab
Then the active sub nav should be Hooks Then the active sub nav should be Integrations
And no other sub navs should be active And no other sub navs should be active
And the active main tab should be Settings And the active main tab should be Settings
......
...@@ -27,8 +27,8 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps ...@@ -27,8 +27,8 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps
end end
end end
step 'I click the "Hooks" tab' do step 'I click the "Integrations" tab' do
click_link('Webhooks') click_link('Integrations')
end end
step 'I click the "Deploy Keys" tab' do step 'I click the "Deploy Keys" tab' do
...@@ -39,8 +39,8 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps ...@@ -39,8 +39,8 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps
ensure_active_sub_nav('Members') ensure_active_sub_nav('Members')
end end
step 'the active sub nav should be Hooks' do step 'the active sub nav should be Integrations' do
ensure_active_sub_nav('Webhooks') ensure_active_sub_nav('Integrations')
end end
step 'the active sub nav should be Deploy Keys' do step 'the active sub nav should be Deploy Keys' do
......
...@@ -36,12 +36,12 @@ class Spinach::Features::ProjectHooks < Spinach::FeatureSteps ...@@ -36,12 +36,12 @@ class Spinach::Features::ProjectHooks < Spinach::FeatureSteps
end end
step 'I should see newly created hook' do step 'I should see newly created hook' do
expect(current_path).to eq namespace_project_hooks_path(current_project.namespace, current_project) expect(current_path).to eq namespace_project_settings_integrations_path(current_project.namespace, current_project)
expect(page).to have_content(@url) expect(page).to have_content(@url)
end end
step 'I should see newly created hook with SSL verification enabled' do step 'I should see newly created hook with SSL verification enabled' do
expect(current_path).to eq namespace_project_hooks_path(current_project.namespace, current_project) expect(current_path).to eq namespace_project_settings_integrations_path(current_project.namespace, current_project)
expect(page).to have_content(@url) expect(page).to have_content(@url)
expect(page).to have_content("SSL Verification: enabled") expect(page).to have_content("SSL Verification: enabled")
end end
...@@ -57,7 +57,7 @@ class Spinach::Features::ProjectHooks < Spinach::FeatureSteps ...@@ -57,7 +57,7 @@ class Spinach::Features::ProjectHooks < Spinach::FeatureSteps
end end
step 'hook should be triggered' do step 'hook should be triggered' do
expect(current_path).to eq namespace_project_hooks_path(current_project.namespace, current_project) expect(current_path).to eq namespace_project_settings_integrations_path(current_project.namespace, current_project)
expect(page).to have_selector '.flash-notice', expect(page).to have_selector '.flash-notice',
text: 'Hook executed successfully: HTTP 200' text: 'Hook executed successfully: HTTP 200'
end end
......
...@@ -4,7 +4,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps ...@@ -4,7 +4,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
include SharedPaths include SharedPaths
step 'I visit project "Shop" services page' do step 'I visit project "Shop" services page' do
visit namespace_project_services_path(@project.namespace, @project) visit namespace_project_settings_integrations_path(@project.namespace, @project)
end end
step 'I should see list of available services' do step 'I should see list of available services' do
......
...@@ -256,7 +256,7 @@ module SharedPaths ...@@ -256,7 +256,7 @@ module SharedPaths
end end
step 'I visit project hooks page' do step 'I visit project hooks page' do
visit namespace_project_hooks_path(@project.namespace, @project) visit namespace_project_settings_integrations_path(@project.namespace, @project)
end end
step 'I visit project deploy keys page' do step 'I visit project deploy keys page' do
......
require 'spec_helper'
describe Projects::Settings::IntegrationsController do
let(:project) { create(:project, :public) }
let(:user) { create(:user) }
before do
project.team << [user, :master]
sign_in(user)
end
describe 'GET show' do
it 'renders show with 200 status code' do
get :show, namespace_id: project.namespace, project_id: project
expect(response).to have_http_status(200)
expect(response).to render_template(:show)
end
end
end
...@@ -262,8 +262,8 @@ describe "Internal Project Access", feature: true do ...@@ -262,8 +262,8 @@ describe "Internal Project Access", feature: true do
it { is_expected.to be_denied_for(:visitor) } it { is_expected.to be_denied_for(:visitor) }
end end
describe "GET /:project_path/hooks" do describe "GET /:project_path/settings/integrations" do
subject { namespace_project_hooks_path(project.namespace, project) } subject { namespace_project_settings_integrations_path(project.namespace, project) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
it { is_expected.to be_allowed_for(:owner).of(project) } it { is_expected.to be_allowed_for(:owner).of(project) }
......
...@@ -234,8 +234,8 @@ describe "Private Project Access", feature: true do ...@@ -234,8 +234,8 @@ describe "Private Project Access", feature: true do
it { is_expected.to be_denied_for(:visitor) } it { is_expected.to be_denied_for(:visitor) }
end end
describe "GET /:project_path/hooks" do describe "GET /:project_path/namespace/hooks" do
subject { namespace_project_hooks_path(project.namespace, project) } subject { namespace_project_settings_integrations_path(project.namespace, project) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
it { is_expected.to be_allowed_for(:owner).of(project) } it { is_expected.to be_allowed_for(:owner).of(project) }
......
...@@ -400,8 +400,8 @@ describe "Public Project Access", feature: true do ...@@ -400,8 +400,8 @@ describe "Public Project Access", feature: true do
it { is_expected.to be_allowed_for(:visitor) } it { is_expected.to be_allowed_for(:visitor) }
end end
describe "GET /:project_path/hooks" do describe "GET /:project_path/settings/integrations" do
subject { namespace_project_hooks_path(project.namespace, project) } subject { namespace_project_settings_integrations_path(project.namespace, project) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
it { is_expected.to be_allowed_for(:owner).of(project) } it { is_expected.to be_allowed_for(:owner).of(project) }
......
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