Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4bdb1c71
Commit
4bdb1c71
authored
Aug 25, 2020
by
Justin Ho Tuan Duong
Committed by
Dylan Griffith
Aug 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move group integrations in sidebar navigation
To follow order on the project level
parent
62d07844
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
126 additions
and
12 deletions
+126
-12
app/assets/javascripts/integrations/edit/components/integration_form.vue
...scripts/integrations/edit/components/integration_form.vue
+1
-0
app/assets/javascripts/integrations/edit/components/override_dropdown.vue
...cripts/integrations/edit/components/override_dropdown.vue
+13
-2
app/assets/javascripts/integrations/edit/index.js
app/assets/javascripts/integrations/edit/index.js
+2
-0
app/helpers/services_helper.rb
app/helpers/services_helper.rb
+9
-0
app/views/admin/application_settings/integrations.html.haml
app/views/admin/application_settings/integrations.html.haml
+1
-1
app/views/groups/settings/integrations/index.html.haml
app/views/groups/settings/integrations/index.html.haml
+1
-1
app/views/layouts/nav/sidebar/_group.html.haml
app/views/layouts/nav/sidebar/_group.html.haml
+6
-5
app/views/shared/integrations/_form.html.haml
app/views/shared/integrations/_form.html.haml
+1
-1
app/views/shared/integrations/_index.html.haml
app/views/shared/integrations/_index.html.haml
+1
-1
spec/frontend/integrations/edit/components/override_dropdown_spec.js
...nd/integrations/edit/components/override_dropdown_spec.js
+58
-0
spec/helpers/services_helper_spec.rb
spec/helpers/services_helper_spec.rb
+32
-0
spec/support/shared_contexts/navbar_structure_context.rb
spec/support/shared_contexts/navbar_structure_context.rb
+1
-1
No files found.
app/assets/javascripts/integrations/edit/components/integration_form.vue
View file @
4bdb1c71
...
@@ -42,6 +42,7 @@ export default {
...
@@ -42,6 +42,7 @@ export default {
v-if=
"adminState !== null"
v-if=
"adminState !== null"
:inherit-from-id=
"adminState.id"
:inherit-from-id=
"adminState.id"
:override=
"override"
:override=
"override"
:learn-more-path=
"propsSource.learnMorePath"
@
change=
"setOverride"
@
change=
"setOverride"
/>
/>
<active-toggle
<active-toggle
...
...
app/assets/javascripts/integrations/edit/components/override_dropdown.vue
View file @
4bdb1c71
<
script
>
<
script
>
import
{
GlNewDropdown
,
GlNewDropdownItem
}
from
'
@gitlab/ui
'
;
import
{
GlNewDropdown
,
GlNewDropdownItem
,
GlLink
}
from
'
@gitlab/ui
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
}
from
'
~/locale
'
;
const
dropdownOptions
=
[
const
dropdownOptions
=
[
...
@@ -19,12 +19,18 @@ export default {
...
@@ -19,12 +19,18 @@ export default {
components
:
{
components
:
{
GlNewDropdown
,
GlNewDropdown
,
GlNewDropdownItem
,
GlNewDropdownItem
,
GlLink
,
},
},
props
:
{
props
:
{
inheritFromId
:
{
inheritFromId
:
{
type
:
Number
,
type
:
Number
,
required
:
true
,
required
:
true
,
},
},
learnMorePath
:
{
type
:
String
,
required
:
false
,
default
:
null
,
},
override
:
{
override
:
{
type
:
Boolean
,
type
:
Boolean
,
required
:
true
,
required
:
true
,
...
@@ -48,7 +54,12 @@ export default {
...
@@ -48,7 +54,12 @@ export default {
<div
<div
class=
"gl-display-flex gl-justify-content-space-between gl-align-items-baseline gl-py-4 gl-mt-5 gl-mb-6 gl-border-t-1 gl-border-t-solid gl-border-b-1 gl-border-b-solid gl-border-gray-100"
class=
"gl-display-flex gl-justify-content-space-between gl-align-items-baseline gl-py-4 gl-mt-5 gl-mb-6 gl-border-t-1 gl-border-t-solid gl-border-b-1 gl-border-b-solid gl-border-gray-100"
>
>
<span>
{{
s__
(
'
Integrations|Default settings are inherited from the instance level.
'
)
}}
</span>
<span
>
{{
s__
(
'
Integrations|Default settings are inherited from the instance level.
'
)
}}
<gl-link
v-if=
"learnMorePath"
:href=
"learnMorePath"
target=
"_blank"
>
{{
__
(
'
Learn more
'
)
}}
</gl-link>
</span>
<input
name=
"service[inherit_from_id]"
:value=
"override ? '' : inheritFromId"
type=
"hidden"
/>
<input
name=
"service[inherit_from_id]"
:value=
"override ? '' : inheritFromId"
type=
"hidden"
/>
<gl-new-dropdown
:text=
"selected.text"
>
<gl-new-dropdown
:text=
"selected.text"
>
<gl-new-dropdown-item
<gl-new-dropdown-item
...
...
app/assets/javascripts/integrations/edit/index.js
View file @
4bdb1c71
...
@@ -19,6 +19,7 @@ function parseDatasetToProps(data) {
...
@@ -19,6 +19,7 @@ function parseDatasetToProps(data) {
projectKey
,
projectKey
,
upgradePlanPath
,
upgradePlanPath
,
editProjectPath
,
editProjectPath
,
learnMorePath
,
triggerEvents
,
triggerEvents
,
fields
,
fields
,
inheritFromId
,
inheritFromId
,
...
@@ -53,6 +54,7 @@ function parseDatasetToProps(data) {
...
@@ -53,6 +54,7 @@ function parseDatasetToProps(data) {
upgradePlanPath
,
upgradePlanPath
,
editProjectPath
,
editProjectPath
,
},
},
learnMorePath
,
triggerEvents
:
JSON
.
parse
(
triggerEvents
),
triggerEvents
:
JSON
.
parse
(
triggerEvents
),
fields
:
JSON
.
parse
(
fields
),
fields
:
JSON
.
parse
(
fields
),
inheritFromId
:
parseInt
(
inheritFromId
,
10
),
inheritFromId
:
parseInt
(
inheritFromId
,
10
),
...
...
app/helpers/services_helper.rb
View file @
4bdb1c71
...
@@ -92,6 +92,7 @@ module ServicesHelper
...
@@ -92,6 +92,7 @@ module ServicesHelper
commit_events:
integration
.
commit_events
.
to_s
,
commit_events:
integration
.
commit_events
.
to_s
,
enable_comments:
integration
.
comment_on_event_enabled
.
to_s
,
enable_comments:
integration
.
comment_on_event_enabled
.
to_s
,
comment_detail:
integration
.
comment_detail
,
comment_detail:
integration
.
comment_detail
,
learn_more_path:
integrations_help_page_path
,
trigger_events:
trigger_events_for_service
(
integration
),
trigger_events:
trigger_events_for_service
(
integration
),
fields:
fields_for_service
(
integration
),
fields:
fields_for_service
(
integration
),
inherit_from_id:
integration
.
inherit_from_id
inherit_from_id:
integration
.
inherit_from_id
...
@@ -106,10 +107,18 @@ module ServicesHelper
...
@@ -106,10 +107,18 @@ module ServicesHelper
ServiceFieldSerializer
.
new
(
service:
integration
).
represent
(
integration
.
global_fields
).
to_json
ServiceFieldSerializer
.
new
(
service:
integration
).
represent
(
integration
.
global_fields
).
to_json
end
end
def
integrations_help_page_path
help_page_path
(
'user/admin_area/settings/project_integration_management'
)
end
def
project_jira_issues_integration?
def
project_jira_issues_integration?
false
false
end
end
def
group_level_integrations?
@group
.
present?
&&
Feature
.
enabled?
(
:group_level_integrations
,
@group
)
end
extend
self
extend
self
end
end
...
...
app/views/admin/application_settings/integrations.html.haml
View file @
4bdb1c71
...
@@ -16,5 +16,5 @@
...
@@ -16,5 +16,5 @@
%h4
=
s_
(
'AdminSettings|Apply integration settings to all Projects'
)
%h4
=
s_
(
'AdminSettings|Apply integration settings to all Projects'
)
%p
%p
=
s_
(
'AdminSettings|Integrations configured here will automatically apply to all projects on this instance.'
)
=
s_
(
'AdminSettings|Integrations configured here will automatically apply to all projects on this instance.'
)
=
link_to
_
(
'Learn more'
),
'#
'
=
link_to
_
(
'Learn more'
),
integrations_help_page_path
,
target:
'_blank'
,
rel:
'noopener noreferrer
'
=
render
'shared/integrations/index'
,
integrations:
@integrations
=
render
'shared/integrations/index'
,
integrations:
@integrations
app/views/groups/settings/integrations/index.html.haml
View file @
4bdb1c71
...
@@ -5,5 +5,5 @@
...
@@ -5,5 +5,5 @@
%h4
=
s_
(
'GroupSettings|Apply integration settings to all Projects'
)
%h4
=
s_
(
'GroupSettings|Apply integration settings to all Projects'
)
%p
%p
=
s_
(
'GroupSettings|Integrations configured here will automatically apply to all projects in this group.'
)
=
s_
(
'GroupSettings|Integrations configured here will automatically apply to all projects in this group.'
)
=
link_to
_
(
'Learn more'
),
'#
'
=
link_to
_
(
'Learn more'
),
integrations_help_page_path
,
target:
'_blank'
,
rel:
'noopener noreferrer
'
=
render
'shared/integrations/index'
,
integrations:
@integrations
=
render
'shared/integrations/index'
,
integrations:
@integrations
app/views/layouts/nav/sidebar/_group.html.haml
View file @
4bdb1c71
...
@@ -157,6 +157,12 @@
...
@@ -157,6 +157,12 @@
%span
%span
=
_
(
'General'
)
=
_
(
'General'
)
-
if
group_level_integrations?
=
nav_link
(
controller: :integrations
)
do
=
link_to
group_settings_integrations_path
(
@group
),
title:
_
(
'Integrations'
)
do
%span
=
_
(
'Integrations'
)
=
nav_link
(
path:
'groups#projects'
)
do
=
nav_link
(
path:
'groups#projects'
)
do
=
link_to
projects_group_path
(
@group
),
title:
_
(
'Projects'
)
do
=
link_to
projects_group_path
(
@group
),
title:
_
(
'Projects'
)
do
%span
%span
...
@@ -171,11 +177,6 @@
...
@@ -171,11 +177,6 @@
=
link_to
group_settings_ci_cd_path
(
@group
),
title:
_
(
'CI / CD'
)
do
=
link_to
group_settings_ci_cd_path
(
@group
),
title:
_
(
'CI / CD'
)
do
%span
%span
=
_
(
'CI / CD'
)
=
_
(
'CI / CD'
)
-
if
Feature
.
enabled?
(
:group_level_integrations
,
@group
)
=
nav_link
(
controller: :integrations
)
do
=
link_to
group_settings_integrations_path
(
@group
),
title:
_
(
'Integrations'
)
do
%span
=
_
(
'Integrations'
)
=
render_if_exists
"groups/ee/settings_nav"
=
render_if_exists
"groups/ee/settings_nav"
...
...
app/views/shared/integrations/_form.html.haml
View file @
4bdb1c71
...
@@ -12,4 +12,4 @@
...
@@ -12,4 +12,4 @@
-
if
integration
.
editable?
-
if
integration
.
editable?
.footer-block.row-content-block
.footer-block.row-content-block
=
service_save_button
=
service_save_button
=
link_to
_
(
'Cancel'
),
scoped_integration
_path
(
integration
)
,
class:
'btn btn-cancel'
=
link_to
_
(
'Cancel'
),
scoped_integration
s_path
,
class:
'btn btn-cancel'
app/views/shared/integrations/_index.html.haml
View file @
4bdb1c71
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
%col
%col
%col
%col
%col
.d-none.d-sm-table-column
%col
.d-none.d-sm-table-column
%col
{
width:
13
0
}
%col
{
width:
13
5
}
%thead
{
role:
'rowgroup'
}
%thead
{
role:
'rowgroup'
}
%tr
{
role:
'row'
}
%tr
{
role:
'row'
}
%th
{
role:
'columnheader'
,
scope:
'col'
,
'aria-colindex'
:
1
}
%th
{
role:
'columnheader'
,
scope:
'col'
,
'aria-colindex'
:
1
}
...
...
spec/frontend/integrations/edit/components/override_dropdown_spec.js
0 → 100644
View file @
4bdb1c71
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlNewDropdown
,
GlLink
}
from
'
@gitlab/ui
'
;
import
OverrideDropdown
from
'
~/integrations/edit/components/override_dropdown.vue
'
;
describe
(
'
OverrideDropdown
'
,
()
=>
{
let
wrapper
;
const
defaultProps
=
{
inheritFromId
:
1
,
override
:
true
,
};
const
createComponent
=
(
props
=
{})
=>
{
wrapper
=
shallowMount
(
OverrideDropdown
,
{
propsData
:
{
...
defaultProps
,
...
props
},
});
};
afterEach
(()
=>
{
if
(
wrapper
)
{
wrapper
.
destroy
();
wrapper
=
null
;
}
});
const
findGlLink
=
()
=>
wrapper
.
find
(
GlLink
);
const
findGlNewDropdown
=
()
=>
wrapper
.
find
(
GlNewDropdown
);
describe
(
'
template
'
,
()
=>
{
describe
(
'
override prop is true
'
,
()
=>
{
it
(
'
renders GlToggle as disabled
'
,
()
=>
{
createComponent
();
expect
(
findGlNewDropdown
().
props
(
'
text
'
)).
toBe
(
'
Use custom settings
'
);
});
});
describe
(
'
override prop is false
'
,
()
=>
{
it
(
'
renders GlToggle as disabled
'
,
()
=>
{
createComponent
({
override
:
false
});
expect
(
findGlNewDropdown
().
props
(
'
text
'
)).
toBe
(
'
Use default settings
'
);
});
});
describe
(
'
learnMorePath is present
'
,
()
=>
{
it
(
'
renders GlLink with correct link
'
,
()
=>
{
createComponent
({
learnMorePath
:
'
/docs
'
,
});
expect
(
findGlLink
().
text
()).
toBe
(
'
Learn more
'
);
expect
(
findGlLink
().
attributes
(
'
href
'
)).
toBe
(
'
/docs
'
);
});
});
});
});
spec/helpers/services_helper_spec.rb
View file @
4bdb1c71
...
@@ -26,4 +26,36 @@ RSpec.describe ServicesHelper do
...
@@ -26,4 +26,36 @@ RSpec.describe ServicesHelper do
end
end
end
end
end
end
describe
'#group_level_integrations?'
do
subject
{
helper
.
group_level_integrations?
}
context
'when no group is present'
do
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when group is present'
do
let
(
:group
)
{
build_stubbed
(
:group
)
}
before
do
assign
(
:group
,
group
)
end
context
'when `group_level_integrations` is not enabled'
do
it
'returns false'
do
stub_feature_flags
(
group_level_integrations:
false
)
is_expected
.
to
eq
(
false
)
end
end
context
'when `group_level_integrations` is enabled for the group'
do
it
'returns true'
do
stub_feature_flags
(
group_level_integrations:
group
)
is_expected
.
to
eq
(
true
)
end
end
end
end
end
end
spec/support/shared_contexts/navbar_structure_context.rb
View file @
4bdb1c71
...
@@ -119,10 +119,10 @@ RSpec.shared_context 'group navbar structure' do
...
@@ -119,10 +119,10 @@ RSpec.shared_context 'group navbar structure' do
nav_item:
_
(
'Settings'
),
nav_item:
_
(
'Settings'
),
nav_sub_items:
[
nav_sub_items:
[
_
(
'General'
),
_
(
'General'
),
_
(
'Integrations'
),
_
(
'Projects'
),
_
(
'Projects'
),
_
(
'Repository'
),
_
(
'Repository'
),
_
(
'CI / CD'
),
_
(
'CI / CD'
),
_
(
'Integrations'
),
_
(
'Webhooks'
),
_
(
'Webhooks'
),
_
(
'Audit Events'
)
_
(
'Audit Events'
)
]
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment