Commit efaa8bb1 authored by Rémy Coutable's avatar Rémy Coutable

Allow to pick a sugroup to hold the Insights config

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent fbf4d185
- return unless @group.insights_available?
%section.settings.no-animate{ class: ('expanded' if expanded) }
%section.settings.insights-settings.no-animate{ class: ('expanded' if expanded) }
.settings-header
%h4
= _('Insights')
......@@ -22,5 +22,5 @@
= _('Select a repository')
= link_to icon('question-circle'), help_page_path('user/group/index.md', anchor: 'insights-ultimate'), target: '_blank'
= project_select_tag('group[insight_attributes][project_id]', class: 'project-item-select hidden-filter-value', toggle_class: 'js-project-search js-project-filter js-filter-submit', dropdown_class: 'dropdown-menu-selectable dropdown-menu-project js-filter-submit',
placeholder: _('Search projects'), idAttribute: 'id', data: { order_by: 'last_activity_at', idattribute: 'id', simple_filter: true, allow_clear: true }, value: insight.project_id)
placeholder: _('Search projects'), idAttribute: 'id', data: { order_by: 'last_activity_at', idattribute: 'id', simple_filter: true, allow_clear: true, include_projects_in_subgroups: true }, value: insight.project_id)
= form.submit _('Save changes'), class: "btn btn-success"
---
title: Allow to pick a subgroup to hold the Insights config
merge_request: 24053
author:
type: added
# frozen_string_literal: true
require 'spec_helper'
describe 'Groups > Settings > User configures Insights', :js do
include Select2Helper
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:subgroup) { create(:group, parent: group) }
let(:project) { create(:project, namespace: subgroup) }
before do
group.add_owner(user)
sign_in(user)
end
context 'without correct license' do
before do
stub_licensed_features(insights: false)
visit edit_group_path(group)
end
it 'does not show the Insight config' do
expect(page).not_to have_content 'Insights'
end
end
context 'with correct license' do
before do
stub_licensed_features(insights: true)
visit edit_group_path(group)
end
it 'allows to select a project in a subgroup for the Insights config' do
expect(page).to have_content 'Insights'
page.within '.insights-settings form' do
select2(project.id, from: '#group_insight_attributes_project_id')
click_button 'Save changes'
expect(page).to have_content(project.full_name)
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