Commit 3fa8a6d0 authored by Tim Zallmann's avatar Tim Zallmann

A lot more Promotions

parent caa8c55a
......@@ -290,6 +290,7 @@ import initGroupAnalytics from './init_group_analytics';
action: mrNewSubmitNode.dataset.mrSubmitAction,
});
}
new UserCallout();
case 'projects:merge_requests:creations:diffs':
case 'projects:merge_requests:edit':
new gl.Diff();
......
......@@ -7,6 +7,10 @@
background-color: $white-light;
align-items: flex-start;
.user-callout-copy {
max-width: inherit;
}
.close {
.dismiss-icon {
color: $gray-darkest;
......
......@@ -167,6 +167,9 @@
= render 'merge_request_settings', form: f
= f.submit 'Save changes', class: "btn btn-save"
- if !@project.feature_available?(:fast_forward_merge) && show_promotions? && show_callout?('promote_mr_approval_dismissed')
= render 'shared/promotions/promote_mr_approval'
- if EE::Gitlab::ServiceDesk.enabled?(project: @project)
%section.settings.js-service-desk-setting-wrapper
.settings-header
......
- content_for :page_specific_javascripts do
= page_specific_javascript_bundle_tag('protected_branches')
- if show_promotions? && show_callout?('promote_repository_features_dismissed')
= render 'shared/promotions/promote_repository_features'
- content_for :create_protected_branch do
= render 'projects/protected_branches/create_protected_branch'
......
......@@ -4,6 +4,10 @@
Project services
%p Project services allow you to integrate GitLab with other applications
.col-lg-8
- if show_promotions? && show_callout?('promote_webhooks_dismissed')
= render 'shared/promotions/promote_webhooks'
%table.table
%colgroup
%col
......
<svg xmlns="http://www.w3.org/2000/svg" width="78" height="82" viewBox="0 0 78 82"><g fill="none" fill-rule="evenodd"><path fill="#F9F9F9" d="M2.12 42c-.08.99-.12 1.99-.12 3 0 20.435 16.565 37 37 37s37-16.565 37-37c0-1.01-.04-2.01-.12-3C74.353 61.032 58.425 76 39 76 19.575 76 3.647 61.032 2.12 42z"/><path fill="#EEE" fill-rule="nonzero" d="M39 78C17.46 78 0 60.54 0 39S17.46 0 39 0s39 17.46 39 39-17.46 39-39 39zm0-4c19.33 0 35-15.67 35-35S58.33 4 39 4 4 19.67 4 39s15.67 35 35 35z"/><path fill="#E1DBF2" fill-rule="nonzero" d="M59.542 39.692l-12.93 15.484a2 2 0 0 1-3.36-.466L31.911 29.34l-9.073 10.532a4.007 4.007 0 0 0-2.9-2.762l10.998-12.767a2 2 0 0 1 3.341.49l11.318 25.318 9.511-11.39A3.989 3.989 0 0 0 58 40c.547 0 1.068-.11 1.542-.308z"/><circle cx="32" cy="26" r="4" fill="#6B4FBB"/><circle cx="45" cy="54" r="4" fill="#6B4FBB"/><path fill="#6B4FBB" fill-rule="nonzero" d="M19 47a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-4a2 2 0 1 0 0-4 2 2 0 0 0 0 4zm39-1a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-4a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/></g></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="78" height="82" viewBox="0 0 78 82">
<g fill="none" fill-rule="evenodd" transform="translate(2 2)">
<path fill="#F9F9F9" d="M0.119863464,40 C0.0404654401,40.9895269 0,41.9900378 0,43 C0,63.4345357 16.5654643,80 37,80 C57.4345357,80 74,63.4345357 74,43 C74,41.9900378 73.9595346,40.9895269 73.8801365,40 C72.3530766,59.0315425 56.4245736,74 37,74 C17.5754264,74 1.64692341,59.0315425 0.119863464,40 Z"/>
<path fill="#EEEEEE" fill-rule="nonzero" d="M37,76 C15.4608948,76 -2,58.5391052 -2,37 C-2,15.4608948 15.4608948,-2 37,-2 C58.5391052,-2 76,15.4608948 76,37 C76,58.5391052 58.5391052,76 37,76 Z M37,72 C56.3299662,72 72,56.3299662 72,37 C72,17.6700338 56.3299662,2 37,2 C17.6700338,2 2,17.6700338 2,37 C2,56.3299662 17.6700338,72 37,72 Z"/>
<rect width="16" height="4" x="41" y="35" fill="#E1DBF1" rx="2"/>
<rect width="16" height="4" x="17" y="35" fill="#E1DBF1" rx="2"/>
<path fill="#6B4FBB" fill-rule="nonzero" d="M37,45 C32.581722,45 29,41.418278 29,37 C29,32.581722 32.581722,29 37,29 C41.418278,29 45,32.581722 45,37 C45,41.418278 41.418278,45 37,45 Z M37,41 C39.209139,41 41,39.209139 41,37 C41,34.790861 39.209139,33 37,33 C34.790861,33 33,34.790861 33,37 C33,39.209139 34.790861,41 37,41 Z"/>
</g>
</svg>
.user-callout.promotion-callout{ id: 'promote_burndown_charts', data: { uid: 'promote_burndown_charts_dismissed' } }
.bordered-box.content-block
%button.btn.btn-default.close.js-close-callout{ type: 'button', 'aria-label' => 'Dismiss burndown charts promotion' }
= icon('times', class: 'dismiss-icon', 'aria-hidden' => 'true')
.user-callout-copy
%h4
- if current_application_settings.should_check_namespace_plan?
Upgrade your plan to improve milestone with Burndown Charts.
- else
Improve milestone with Burndown Charts.
%p
Burndown Charts are visual representations of the progress of completing a milestone. At a glance, you see the current state for the completion a given milestone. Without them, you would have to organize the data from the milestone and plot it yourself to have the same sense of progress.
%a{ href: '/help/user/project/milestones/burndown_charts.html', target: '_blank' } Read more
= render 'shared/promotions/promotion_link_project'
.user-callout.promotion-callout{ id: 'promote_mr_approval', data: { uid: 'promote_mr_approval_dismissed' } }
.bordered-box.content-block
%button.btn.btn-default.close.js-close-callout{ type: 'button', 'aria-label' => 'Dismiss merge request promotion' }
= icon('times', class: 'dismiss-icon', 'aria-hidden' => 'true')
.user-callout-copy
%h4
- if current_application_settings.should_check_namespace_plan?
Upgrade your plan to improve Merge Requests and customer support.
- else
Improve Merge Request and customer support with GitLab Enterprise Edition.
%ul
%li
%a{ href: '/help/user/project/merge_requests/merge_request_approvals.html', target: '_blank' } Merge Request Approvals
%p
Merge request approvals allow you to set the number of necessary approvals and predefine a list of approvers that will need to approve every merge request in a project.
%li
%a{ href: '/help/user/project/merge_requests/fast_forward_merge.html', target: '_blank' } Fast-forward Merge
%p
If you prefer a linear Git history and a way to accept merge requests without creating merge commits, you can configure this on a per-project basis.
%li
%a{ href: '/help/user/project/service_desk.html', target: '_blank' } GitLab Service Desk
%p
GitLab Service Desk is a simple way to allow people to create issues in your GitLab instance without needing their own user account.
= render 'shared/promotions/promotion_link_project'
.user-callout.promotion-callout{ id: 'promote_repository_features', data: { uid: 'promote_repository_features_dismissed' } }
.bordered-box.content-block
%button.btn.btn-default.close.js-close-callout{ type: 'button', 'aria-label' => 'Dismiss repository features promotion' }
= icon('times', class: 'dismiss-icon', 'aria-hidden' => 'true')
.svg-container
= custom_icon('icon_push_rules')
.user-callout-copy
%h4
- if current_application_settings.should_check_namespace_plan?
Upgrade your plan improve repositories.
- else
Improve repositories with GitLab Enterprise Edition.
%ul
%li
%a{ href: '/help/push_rules/push_rules.md#push-rules', target: '_blank' } Push Rules
%p
Push Rules are defined per project so you can have different rules applied to different projects depends on your needs.
%li
%a{ href: '/help/workflow/repository_mirroring.html', target: '_blank' } Repository Mirroring
%p
Repository Mirroring is a way to mirror repositories from external sources. It can be used to mirror all branches, tags, and commits that you have in your repository.
%li
%a{ href: '/help/user/project/protected_branches.html', target: '_blank' } Protected Branches
%p
Permissions in GitLab are fundamentally defined around the idea of having read or write permission to the repository and branches. To prevent people from messing with history or pushing code without review, we've created protected branches.
= render 'shared/promotions/promotion_link_project'
.user-callout.promotion-callout{ id: 'promote_squash_commits', data: { uid: 'promote_squash_commits_dismissed' } }
.bordered-box.content-block
%button.btn.btn-default.close.js-close-callout{ type: 'button', 'aria-label' => 'Dismiss merge request promotion' }
= icon('times', class: 'dismiss-icon', 'aria-hidden' => 'true')
.user-callout-copy
%h4
- if current_application_settings.should_check_namespace_plan?
Upgrade your plan to improve Merge Requests with squash commit.
- else
Improve Merge Requests with squash commit and GitLab Enterprise Edition.
%p
Squashing lets you tidy up the commit history of a branch when accepting a merge request. It applies all of the changes in the merge request as a single commit, and then merges that commit using the merge method set for the project.
%a{ href: '/help/user/project/merge_requests/squash_and_merge.html', target: '_blank' } Read more
= render 'shared/promotions/promotion_link_project'
.user-callout.promotion-callout{ id: 'promote_webhooks', data: { uid: 'promote_webhooks_dismissed' } }
.bordered-box.content-block
%button.btn.btn-default.close.js-close-callout{ type: 'button', 'aria-label' => 'Dismiss webhooks promotion' }
= icon('times', class: 'dismiss-icon', 'aria-hidden' => 'true')
.user-callout-copy
%h4
- if current_application_settings.should_check_namespace_plan?
Upgrade your plan to activate Webhooks.
- else
Improve project with Webhooks and GitLab Enterprise Edition.
%p
Project webhooks allow you to trigger a URL if for example new code is pushed or a new issue is created. You can configure webhooks to listen for specific events like pushes, issues or merge requests. GitLab will send a POST request with data to the webhook URL.
%a{ href: '/help/user/project/integrations/webhooks.html', target: '_blank' } Read more
= render 'shared/promotions/promotion_link_project'
= current_application_settings.should_check_namespace_plan?
- if current_application_settings.should_check_namespace_plan?
- if (@project.owner.present? && @project.owner == @current_user) || @project.group&.has_owner?(@current_user)
= link_to 'Upgrade your plan', upgrade_plan_url, class: 'btn btn-primary'
......
- issuable = local_assigns.fetch(:issuable)
- return unless issuable.project.feature_available?(:merge_request_squash)
.form-group
.col-sm-10.col-sm-offset-2
.checkbox
= label_tag 'merge_request[squash]' do
= hidden_field_tag 'merge_request[squash]', '0', id: nil
= check_box_tag 'merge_request[squash]', '1', issuable.squash
Squash commits when merge request is accepted.
= link_to 'About this feature', help_page_path('user/project/merge_requests/squash_and_merge')
- if issuable.project.feature_available?(:merge_request_squash)
.form-group
.col-sm-10.col-sm-offset-2
.checkbox
= label_tag 'merge_request[squash]' do
= hidden_field_tag 'merge_request[squash]', '0', id: nil
= check_box_tag 'merge_request[squash]', '1', issuable.squash
Squash commits when merge request is accepted.
= link_to 'About this feature', help_page_path('user/project/merge_requests/squash_and_merge')
- elsif show_promotions? && show_callout?('promote_squash_commits_dismissed')
.form-group
.col-sm-10.col-sm-offset-2
= render 'shared/promotions/promote_squash_commits'
......@@ -4,7 +4,7 @@ describe 'Promotions', js: true do
let(:project) { create(:project, :repository) }
let(:admin) { create(:admin) }
let(:user) { create(:user) }
let(:developer) { create(:user) }
let(:standarddeveloper) { create(:user) }
describe 'if you have a license' do
before do
......@@ -43,9 +43,11 @@ describe 'Promotions', js: true do
describe 'for project features in general', js: true do
context 'for .com' do
before do
stub_application_setting(check_namespace_plan: true)
allow(Gitlab).to receive(:com?) { true }
project.team << [standarddeveloper, :developer]
project.add_developer(standarddeveloper)
project.team << [user, :master]
stub_application_setting(check_namespace_plan: true)
end
it 'should have the Upgrade your plan button' do
......@@ -55,9 +57,7 @@ describe 'Promotions', js: true do
end
it 'should have the contact owner line' do
sign_in(developer)
project.team << [developer, :developer]
project.add_developer(developer)
sign_in(standarddeveloper)
visit edit_project_path(project)
expect(find('#promote_service_desk')).to have_content 'Contact owner'
end
......@@ -90,4 +90,86 @@ describe 'Promotions', js: true do
expect(page).not_to have_selector('#promote_service_desk')
end
end
describe 'for merge request improve', js: true do
let!(:license) { nil }
before do
sign_in(user)
project.team << [user, :master]
end
it 'should appear in project edit page' do
visit edit_project_path(project)
expect(find('#promote_mr_approval')).to have_content 'Improve Merge Request and customer support'
expect(find('#promote_mr_approval')).to have_content 'Merge request approvals allow you to set the number of necessary approvals and predefine a list of approvers that will need to approve every merge request in a project.'
end
it 'does not show when cookie is set' do
visit edit_project_path(project)
within('#promote_mr_approval') do
find('.close').trigger('click')
end
visit edit_project_path(project)
expect(page).not_to have_selector('#promote_mr_approval')
end
end
describe 'for repository features', js: true do
let!(:license) { nil }
before do
sign_in(user)
project.team << [user, :master]
end
it 'should appear in repository settings page' do
visit repository_settings(project)
expect(find('#promote_repository_features')).to have_content 'Improve repositories with GitLab Enterprise Edition'
expect(find('#promote_repository_features')).to have_content 'Push Rules are defined per project so you can have different rules applied to different projects depends on your needs.'
end
it 'does not show when cookie is set' do
visit repository_settings(project)
within('#promote_repository_features') do
find('.close').trigger('click')
end
visit repository_settings(project)
expect(page).not_to have_selector('#promote_repository_features')
end
end
describe 'for squash commits', js: true do
let!(:license) { nil }
before do
sign_in(user)
project.team << [user, :master]
end
it 'should appear in new MR page' do
visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: 'feature' })
expect(find('#promote_squash_commits')).to have_content 'Improve Merge Requests with squash commit'
expect(find('#promote_squash_commits')).to have_content 'Squashing lets you tidy up the commit history of a branch when accepting a merge request.'
end
it 'does not show when cookie is set' do
visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: 'feature' })
within('#promote_squash_commits') do
find('.close').trigger('click')
end
visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: 'feature' })
expect(page).not_to have_selector('#promote_squash_commits')
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