Commit c14589e7 authored by jejacks0n's avatar jejacks0n

Add configure integrations button to project view

- Resolves the repo_integrations_link experiment to the candidate, where
we leave the integrations button in place.

Changelog: added
parent eec0972d
...@@ -431,22 +431,10 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated ...@@ -431,22 +431,10 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
private private
def integrations_anchor_data def integrations_anchor_data
experiment(:repo_integrations_link, project: project) do |e| return unless can?(current_user, :admin_project, project)
e.exclude! unless can?(current_user, :admin_project, project)
e.use {} # nil control
e.try do
label = statistic_icon('settings') + _('Configure Integrations')
AnchorData.new(false, label, project_settings_integrations_path(project), nil, nil, nil, {
'track-event': 'click',
'track-experiment': e.name
})
end
e.run # call run so the return value will be the AnchorData (or nil)
e.track(:view, value: project.id) # track an event for the view, with project id label = statistic_icon('settings') + _('Configure Integrations')
end AnchorData.new(false, label, project_settings_integrations_path(project), nil, nil, nil)
end end
def cicd_missing? def cicd_missing?
......
---
name: repo_integrations_link
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54652/
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/285154
milestone: '13.10'
type: experiment
group: group::adoption
default_enabled: false
...@@ -349,7 +349,7 @@ describe('Tracking', () => { ...@@ -349,7 +349,7 @@ describe('Tracking', () => {
it('includes experiment data if linked to an experiment', () => { it('includes experiment data if linked to an experiment', () => {
const mockExperimentData = { const mockExperimentData = {
variant: 'candidate', variant: 'candidate',
experiment: 'repo_integrations_link', experiment: 'example',
key: '2bff73f6bb8cc11156c50a8ba66b9b8b', key: '2bff73f6bb8cc11156c50a8ba66b9b8b',
}; };
getExperimentData.mockReturnValue(mockExperimentData); getExperimentData.mockReturnValue(mockExperimentData);
......
...@@ -649,36 +649,18 @@ RSpec.describe ProjectPresenter do ...@@ -649,36 +649,18 @@ RSpec.describe ProjectPresenter do
end end
end end
describe 'experiment(:repo_integrations_link)' do it 'includes a button to configure integrations for maintainers' do
context 'when enabled' do project.add_maintainer(user)
before do
stub_experiments(repo_integrations_link: :candidate)
end
it 'includes a button to configure integrations for maintainers' do
project.add_maintainer(user)
expect(empty_repo_statistics_buttons.map(&:label)).to include(
a_string_including('Configure Integration')
)
end
it 'does not include a button if not a maintainer' do
expect(empty_repo_statistics_buttons.map(&:label)).not_to include(
a_string_including('Configure Integration')
)
end
end
context 'when disabled' do expect(empty_repo_statistics_buttons.map(&:label)).to include(
it 'does not include a button' do a_string_including('Configure Integration')
project.add_maintainer(user) )
end
expect(empty_repo_statistics_buttons.map(&:label)).not_to include( it 'does not include a button if not a maintainer' do
a_string_including('Configure Integration') expect(empty_repo_statistics_buttons.map(&:label)).not_to include(
) a_string_including('Configure Integration')
end )
end
end end
context 'for a developer' do context 'for a developer' do
......
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