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
21c5073c
Commit
21c5073c
authored
Sep 13, 2020
by
David O'Regan
Committed by
Peter Leitzen
Sep 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter out incidents in related issues from epics
parent
9a94cae5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
6 deletions
+95
-6
ee/app/assets/javascripts/related_items_tree/store/getters.js
...pp/assets/javascripts/related_items_tree/store/getters.js
+9
-0
ee/app/assets/javascripts/related_items_tree/utils/epic_utils.js
...assets/javascripts/related_items_tree/utils/epic_utils.js
+14
-0
ee/app/controllers/groups/autocomplete_sources_controller.rb
ee/app/controllers/groups/autocomplete_sources_controller.rb
+1
-1
ee/app/services/groups/autocomplete_service.rb
ee/app/services/groups/autocomplete_service.rb
+2
-1
ee/changelogs/unreleased/244939-epics-issues-realted-filter.yml
...ngelogs/unreleased/244939-epics-issues-realted-filter.yml
+5
-0
ee/spec/controllers/groups/autocomplete_sources_controller_spec.rb
...ontrollers/groups/autocomplete_sources_controller_spec.rb
+42
-4
ee/spec/frontend/related_items_tree/store/getters_spec.js
ee/spec/frontend/related_items_tree/store/getters_spec.js
+22
-0
No files found.
ee/app/assets/javascripts/related_items_tree/store/getters.js
View file @
21c5073c
import
{
issuableTypesMap
,
PathIdSeparator
}
from
'
~/related_issues/constants
'
;
import
{
processIssueTypeIssueSources
}
from
'
../utils/epic_utils
'
;
export
const
autoCompleteSources
=
()
=>
gl
.
GfmAutoComplete
&&
gl
.
GfmAutoComplete
.
dataSources
;
...
...
@@ -11,6 +12,14 @@ export const itemAutoCompleteSources = (state, getters) => {
if
(
getters
.
isEpic
)
{
return
state
.
autoCompleteEpics
?
getters
.
autoCompleteSources
:
{};
}
if
(
state
.
issuesEndpoint
.
includes
(
'
epics
'
))
{
return
{
...
getters
.
autoCompleteSources
,
issues
:
processIssueTypeIssueSources
([
'
issue
'
],
getters
.
autoCompleteSources
),
};
}
return
state
.
autoCompleteIssues
?
getters
.
autoCompleteSources
:
{};
};
...
...
ee/app/assets/javascripts/related_items_tree/utils/epic_utils.js
View file @
21c5073c
import
{
PathIdSeparator
}
from
'
~/related_issues/constants
'
;
import
{
mergeUrlParams
}
from
'
~/lib/utils/url_utility
'
;
import
createGqClient
,
{
fetchPolicies
}
from
'
~/lib/graphql
'
;
import
{
ChildType
}
from
'
../constants
'
;
...
...
@@ -101,3 +102,16 @@ export const extractChildIssues = issues =>
*/
export
const
processQueryResponse
=
({
epic
})
=>
applySorts
([...
extractChildEpics
(
epic
.
children
),
...
extractChildIssues
(
epic
.
issues
)]);
/**
* Returns formatted query string with the supplied issue_types
* to be used for autoCompleteSources issues
*
* @param {Array} issueTypes
* @param {Object} autoCompleteSources
* @return {String} autoCompleteSources
*/
export
const
processIssueTypeIssueSources
=
(
issueTypes
,
autoCompleteSources
)
=>
autoCompleteSources
.
issues
?
mergeUrlParams
({
issue_types
:
issueTypes
},
autoCompleteSources
.
issues
)
:
''
;
ee/app/controllers/groups/autocomplete_sources_controller.rb
View file @
21c5073c
...
...
@@ -9,7 +9,7 @@ class Groups::AutocompleteSourcesController < Groups::ApplicationController
def
issues
render
json:
issuable_serializer
.
represent
(
@autocomplete_service
.
issues
(
confidential_only:
params
[
:confidential_only
]),
@autocomplete_service
.
issues
(
confidential_only:
params
[
:confidential_only
]
,
issue_types:
params
[
:issue_types
]
),
parent_group:
@group
)
end
...
...
ee/app/services/groups/autocomplete_service.rb
View file @
21c5073c
...
...
@@ -5,9 +5,10 @@ module Groups
include
LabelsAsHash
# rubocop: disable CodeReuse/ActiveRecord
def
issues
(
confidential_only:
false
)
def
issues
(
confidential_only:
false
,
issue_types:
nil
)
finder_params
=
{
group_id:
group
.
id
,
include_subgroups:
true
,
state:
'opened'
}
finder_params
[
:confidential
]
=
true
if
confidential_only
.
present?
finder_params
[
:issue_types
]
=
issue_types
if
issue_types
.
present?
IssuesFinder
.
new
(
current_user
,
finder_params
)
.
execute
...
...
ee/changelogs/unreleased/244939-epics-issues-realted-filter.yml
0 → 100644
View file @
21c5073c
---
title
:
Filter out incidents from related issues in epics
merge_request
:
41807
author
:
type
:
changed
ee/spec/controllers/groups/autocomplete_sources_controller_spec.rb
View file @
21c5073c
...
...
@@ -3,12 +3,15 @@
require
'spec_helper'
RSpec
.
describe
Groups
::
AutocompleteSourcesController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
:private
)
}
let
!
(
:epic
)
{
create
(
:epic
,
group:
group
)
}
let
_it_be
(
:user
)
{
create
(
:user
)
}
let
_it_be_with_reload
(
:group
)
{
create
(
:group
,
:private
)
}
let
_it_be
(
:epic
)
{
create
(
:epic
,
group:
group
)
}
before
do
before
_all
do
group
.
add_developer
(
user
)
end
before
do
stub_licensed_features
(
epics:
true
)
sign_in
(
user
)
end
...
...
@@ -30,6 +33,41 @@ RSpec.describe Groups::AutocompleteSourcesController do
end
end
describe
'#issues'
do
using
RSpec
::
Parameterized
::
TableSyntax
let_it_be
(
:project
)
{
create
(
:project
,
group:
group
)
}
let_it_be
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let_it_be
(
:incident
)
{
create
(
:incident
,
project:
project
)
}
let_it_be
(
:test_case
)
{
create
(
:quality_test_case
,
project:
project
)
}
let
(
:none
)
{
[]
}
let
(
:all
)
{
[
issue
,
incident
,
test_case
]
}
where
(
:issue_types
,
:expected
)
do
nil
|
:all
''
|
:all
'invalid'
|
:none
'issue'
|
:issue
'incident'
|
:incident
'test_case'
|
:test_case
end
with_them
do
it
'returns the correct response'
,
:aggregate_failures
do
issues
=
Array
(
expected
).
flat_map
{
|
sym
|
public_send
(
sym
)
}
params
=
{
group_id:
group
,
issue_types:
issue_types
}.
compact
get
:issues
,
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
.
size
).
to
eq
(
issues
.
size
)
expect
(
json_response
.
map
{
|
issue
|
issue
[
'iid'
]
})
.
to
match_array
(
issues
.
map
(
&
:iid
))
end
end
end
describe
'#milestones'
do
it
'returns correct response'
do
parent_group
=
create
(
:group
,
:private
)
...
...
ee/spec/frontend/related_items_tree/store/getters_spec.js
View file @
21c5073c
...
...
@@ -90,6 +90,28 @@ describe('RelatedItemsTree', () => {
expect
.
objectContaining
({}),
);
});
it
(
'
returns autoCompleteSources with a formatted issue_type query URL for issues when parent is epic
'
,
()
=>
{
const
mockGetter
=
{
autoCompleteSources
:
{
issues
:
'
foo
'
,
},
};
state
.
issuesEndpoint
=
'
/epics
'
;
state
.
issuableType
=
issuableTypesMap
.
Issue
;
state
.
autoCompleteIssues
=
true
;
expect
(
getters
.
itemAutoCompleteSources
(
state
,
mockGetter
)).
toEqual
({
issues
:
'
foo?issue_types=issue
'
,
});
state
.
issuesEndpoint
=
'
/
'
;
state
.
autoCompleteEpics
=
false
;
expect
(
getters
.
itemAutoCompleteSources
(
state
,
mockGetter
)).
toEqual
({
issues
:
'
foo
'
,
});
});
});
describe
(
'
itemPathIdSeparator
'
,
()
=>
{
...
...
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