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
9bcc2a4d
Commit
9bcc2a4d
authored
Nov 08, 2021
by
Brandon Labuschagne
Committed by
Natalia Tepluhina
Nov 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move DevOps Adoption groups query call to smart query
parent
2a5d4645
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
33 deletions
+52
-33
ee/app/assets/javascripts/analytics/devops_report/devops_adoption/components/devops_adoption_app.vue
...report/devops_adoption/components/devops_adoption_app.vue
+29
-33
ee/spec/frontend/analytics/devops_report/devops_adoption/components/devops_adoption_app_spec.js
...rt/devops_adoption/components/devops_adoption_app_spec.js
+23
-0
No files found.
ee/app/assets/javascripts/analytics/devops_report/devops_adoption/components/devops_adoption_app.vue
View file @
9bcc2a4d
...
@@ -52,7 +52,6 @@ export default {
...
@@ -52,7 +52,6 @@ export default {
data
()
{
data
()
{
return
{
return
{
hasSubgroups
:
undefined
,
hasSubgroups
:
undefined
,
isLoadingGroups
:
false
,
isLoadingEnableGroup
:
false
,
isLoadingEnableGroup
:
false
,
requestCount
:
0
,
requestCount
:
0
,
openModal
:
false
,
openModal
:
false
,
...
@@ -68,6 +67,7 @@ export default {
...
@@ -68,6 +67,7 @@ export default {
adoptionTabClicked
:
false
,
adoptionTabClicked
:
false
,
devopsScoreTabClicked
:
false
,
devopsScoreTabClicked
:
false
,
selectedTab
:
0
,
selectedTab
:
0
,
groupsSearchTerm
:
''
,
};
};
},
},
apollo
:
{
apollo
:
{
...
@@ -94,6 +94,25 @@ export default {
...
@@ -94,6 +94,25 @@ export default {
this
.
handleError
(
I18N_ENABLED_NAMESPACE_QUERY_ERROR
,
error
);
this
.
handleError
(
I18N_ENABLED_NAMESPACE_QUERY_ERROR
,
error
);
},
},
},
},
groups
:
{
query
:
getGroupsQuery
,
context
:
{
isSingleRequest
:
true
,
},
variables
()
{
return
{
search
:
this
.
groupsSearchTerm
,
};
},
result
({
data
})
{
if
(
this
.
hasSubgroups
===
undefined
)
{
this
.
hasSubgroups
=
data
.
groups
?.
nodes
?.
length
>
0
;
}
},
error
(
error
)
{
this
.
handleError
(
I18N_GROUPS_QUERY_ERROR
,
error
);
},
},
},
},
computed
:
{
computed
:
{
isAdmin
()
{
isAdmin
()
{
...
@@ -116,7 +135,7 @@ export default {
...
@@ -116,7 +135,7 @@ export default {
},
},
isLoading
()
{
isLoading
()
{
return
(
return
(
this
.
isLoadingGroups
||
this
.
$apollo
.
queries
.
groups
.
loading
||
this
.
isLoadingEnableGroup
||
this
.
isLoadingEnableGroup
||
this
.
$apollo
.
queries
.
devopsAdoptionEnabledNamespaces
.
loading
this
.
$apollo
.
queries
.
devopsAdoptionEnabledNamespaces
.
loading
);
);
...
@@ -142,7 +161,6 @@ export default {
...
@@ -142,7 +161,6 @@ export default {
},
},
},
},
created
()
{
created
()
{
this
.
fetchGroups
();
this
.
selectTab
();
this
.
selectTab
();
this
.
startPollingTableData
();
this
.
startPollingTableData
();
},
},
...
@@ -202,30 +220,8 @@ export default {
...
@@ -202,30 +220,8 @@ export default {
this
.
errors
.
push
(
message
);
this
.
errors
.
push
(
message
);
Sentry
.
captureException
(
error
);
Sentry
.
captureException
(
error
);
},
},
fetchGroups
(
searchTerm
=
''
)
{
setGroupsSearchTerm
(
searchTerm
=
''
)
{
this
.
searchTerm
=
searchTerm
;
this
.
groupsSearchTerm
=
searchTerm
;
this
.
isLoadingGroups
=
true
;
this
.
$apollo
.
query
({
query
:
getGroupsQuery
,
context
:
{
isSingleRequest
:
true
,
},
variables
:
{
search
:
searchTerm
,
},
})
.
then
(({
data
})
=>
{
this
.
groups
=
data
.
groups
;
if
(
this
.
hasSubgroups
===
undefined
)
{
this
.
hasSubgroups
=
this
.
groups
?.
nodes
?.
length
>
0
;
}
this
.
isLoadingGroups
=
false
;
})
.
catch
((
error
)
=>
this
.
handleError
(
I18N_GROUPS_QUERY_ERROR
,
error
));
},
},
addEnabledNamespacesToCache
(
enabledNamespaces
)
{
addEnabledNamespacesToCache
(
enabledNamespaces
)
{
const
{
cache
}
=
this
.
$apollo
.
getClient
();
const
{
cache
}
=
this
.
$apollo
.
getClient
();
...
@@ -310,12 +306,12 @@ export default {
...
@@ -310,12 +306,12 @@ export default {
:has-group-data=
"hasGroupData"
:has-group-data=
"hasGroupData"
:cols=
"tab.cols"
:cols=
"tab.cols"
:enabled-namespaces=
"devopsAdoptionEnabledNamespaces"
:enabled-namespaces=
"devopsAdoptionEnabledNamespaces"
:search-term=
"
s
earchTerm"
:search-term=
"
groupsS
earchTerm"
:groups=
"availableGroups"
:groups=
"availableGroups"
:is-loading-groups=
"
isLoadingGroups
"
:is-loading-groups=
"
$apollo.queries.groups.loading
"
:has-subgroups=
"hasSubgroups"
:has-subgroups=
"hasSubgroups"
@
enabledNamespacesRemoved=
"deleteEnabledNamespacesFromCache"
@
enabledNamespacesRemoved=
"deleteEnabledNamespacesFromCache"
@
fetchGroups=
"
fetchGroups
"
@
fetchGroups=
"
setGroupsSearchTerm
"
@
enabledNamespacesAdded=
"addEnabledNamespacesToCache"
@
enabledNamespacesAdded=
"addEnabledNamespacesToCache"
@
trackModalOpenState=
"trackModalOpenState"
@
trackModalOpenState=
"trackModalOpenState"
/>
/>
...
@@ -332,12 +328,12 @@ export default {
...
@@ -332,12 +328,12 @@ export default {
align=
"right"
align=
"right"
>
>
<devops-adoption-add-dropdown
<devops-adoption-add-dropdown
:search-term=
"
s
earchTerm"
:search-term=
"
groupsS
earchTerm"
:groups=
"availableGroups"
:groups=
"availableGroups"
:enabled-namespaces=
"devopsAdoptionEnabledNamespaces"
:enabled-namespaces=
"devopsAdoptionEnabledNamespaces"
:is-loading-groups=
"
isLoadingGroups
"
:is-loading-groups=
"
$apollo.queries.groups.loading
"
:has-subgroups=
"hasSubgroups"
:has-subgroups=
"hasSubgroups"
@
fetchGroups=
"
fetchGroups
"
@
fetchGroups=
"
setGroupsSearchTerm
"
@
enabledNamespacesAdded=
"addEnabledNamespacesToCache"
@
enabledNamespacesAdded=
"addEnabledNamespacesToCache"
@
enabledNamespacesRemoved=
"deleteEnabledNamespacesFromCache"
@
enabledNamespacesRemoved=
"deleteEnabledNamespacesFromCache"
/>
/>
...
...
ee/spec/frontend/analytics/devops_report/devops_adoption/components/devops_adoption_app_spec.js
View file @
9bcc2a4d
...
@@ -176,6 +176,29 @@ describe('DevopsAdoptionApp', () => {
...
@@ -176,6 +176,29 @@ describe('DevopsAdoptionApp', () => {
expect
(
Sentry
.
captureException
.
mock
.
calls
[
0
][
0
].
networkError
).
toBe
(
NETWORK_ERROR
);
expect
(
Sentry
.
captureException
.
mock
.
calls
[
0
][
0
].
networkError
).
toBe
(
NETWORK_ERROR
);
});
});
});
});
describe
(
'
refetches data when groupsSearchTerm is updated
'
,
()
=>
{
beforeEach
(
async
()
=>
{
groupsSpy
=
promiseFactory
(
STATE_WITH_DATA
,
RESOURCE_TYPE_GROUP
);
const
mockApollo
=
createMockApolloProvider
({
groupsSpy
});
wrapper
=
createComponent
({
mockApollo
});
await
waitForPromises
();
});
it
.
each
`
name | component
${
'
DevopsAdoptionSection
'
}
|
${
DevopsAdoptionSection
}
${
'
DevopsAdoptionAddDropdown
'
}
|
${
DevopsAdoptionAddDropdown
}
`
(
'
from $name
'
,
async
({
component
})
=>
{
expect
(
groupsSpy
).
toHaveBeenCalledTimes
(
1
);
wrapper
.
findComponent
(
component
).
vm
.
$emit
(
'
fetchGroups
'
,
'
group
'
);
await
waitForPromises
();
expect
(
groupsSpy
).
toHaveBeenCalledTimes
(
2
);
});
});
});
});
describe
(
'
enabled namespaces data
'
,
()
=>
{
describe
(
'
enabled namespaces data
'
,
()
=>
{
...
...
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