Commit 0065f5a8 authored by Brandon Labuschagne's avatar Brandon Labuschagne

Ensure correct group for DA chart

This commit fixes a bug, ensuring that the
correct namespace is being used to display the chart
data.

Changelog: fixed
EE: true
parent 49ed0545
...@@ -81,7 +81,11 @@ export default { ...@@ -81,7 +81,11 @@ export default {
}; };
}, },
sortedNodes() { sortedNodes() {
return [...this.devopsAdoptionEnabledNamespaces?.nodes[0].snapshots?.nodes].reverse(); const correctNode = this.devopsAdoptionEnabledNamespaces?.nodes.find(
(node) => node.namespace?.id === this.groupGid,
);
return [...correctNode?.snapshots?.nodes].reverse();
}, },
groupBy() { groupBy() {
return this.sortedNodes.map((snapshot) => dateFormat(snapshot.endTime, dateFormats.month)); return this.sortedNodes.map((snapshot) => dateFormat(snapshot.endTime, dateFormats.month));
......
...@@ -6,6 +6,9 @@ query devopsAdoptionEnabledNamespaces( ...@@ -6,6 +6,9 @@ query devopsAdoptionEnabledNamespaces(
devopsAdoptionEnabledNamespaces(displayNamespaceId: $displayNamespaceId) { devopsAdoptionEnabledNamespaces(displayNamespaceId: $displayNamespaceId) {
nodes { nodes {
id id
namespace {
id
}
snapshots(endTimeBefore: $endDate, endTimeAfter: $startDate) { snapshots(endTimeBefore: $endDate, endTimeAfter: $startDate) {
nodes { nodes {
endTime endTime
......
...@@ -25,7 +25,8 @@ describe('DevopsAdoptionOverviewChart', () => { ...@@ -25,7 +25,8 @@ describe('DevopsAdoptionOverviewChart', () => {
wrapper = shallowMount(DevopsAdoptionOverviewChart, { wrapper = shallowMount(DevopsAdoptionOverviewChart, {
localVue, localVue,
provide: { provide: {
groupGid: 'gid:123', groupGid:
namespaceWithSnapotsData.data.devopsAdoptionEnabledNamespaces.nodes[0].namespace.id,
}, },
apolloProvider: createMockApollo(handlers), apolloProvider: createMockApollo(handlers),
data() { data() {
......
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