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 {
};
},
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() {
return this.sortedNodes.map((snapshot) => dateFormat(snapshot.endTime, dateFormats.month));
......
......@@ -6,6 +6,9 @@ query devopsAdoptionEnabledNamespaces(
devopsAdoptionEnabledNamespaces(displayNamespaceId: $displayNamespaceId) {
nodes {
id
namespace {
id
}
snapshots(endTimeBefore: $endDate, endTimeAfter: $startDate) {
nodes {
endTime
......
......@@ -25,7 +25,8 @@ describe('DevopsAdoptionOverviewChart', () => {
wrapper = shallowMount(DevopsAdoptionOverviewChart, {
localVue,
provide: {
groupGid: 'gid:123',
groupGid:
namespaceWithSnapotsData.data.devopsAdoptionEnabledNamespaces.nodes[0].namespace.id,
},
apolloProvider: createMockApollo(handlers),
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