Commit e9eaa7b1 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'fj-224656-show-snippets-size-in-group-statistics' into 'master'

Add snippets_size to namespace usage statistics views

See merge request gitlab-org/gitlab!35608
parents c25c19ea 183ec8c5
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { GlLink, GlSprintf } from '@gitlab/ui'; import { GlLink, GlSprintf } from '@gitlab/ui';
import Project from './project.vue'; import Project from './project.vue';
import UsageGraph from './usage_graph.vue'; import UsageGraph from './usage_graph.vue';
import query from '../queries/storage.graphql'; import query from '../queries/storage.query.graphql';
import { numberToHumanSize } from '~/lib/utils/number_utils'; import { numberToHumanSize } from '~/lib/utils/number_utils';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
......
...@@ -22,6 +22,7 @@ export default { ...@@ -22,6 +22,7 @@ export default {
repositorySize, repositorySize,
storageSize, storageSize,
wikiSize, wikiSize,
snippetsSize,
} = this.rootStorageStatistics; } = this.rootStorageStatistics;
if (storageSize === 0) { if (storageSize === 0) {
...@@ -59,6 +60,12 @@ export default { ...@@ -59,6 +60,12 @@ export default {
class: 'gl-bg-data-viz-magenta-500', class: 'gl-bg-data-viz-magenta-500',
size: wikiSize, size: wikiSize,
}, },
{
name: s__('UsageQuota|Snippets'),
style: this.usageStyle(this.barRatio(snippetsSize)),
class: 'gl-bg-data-viz-orange-800',
size: snippetsSize,
},
] ]
.filter(data => data.size !== 0) .filter(data => data.size !== 0)
.sort((a, b) => b.size - a.size); .sort((a, b) => b.size - a.size);
......
...@@ -9,6 +9,7 @@ query getStorageCounter($fullPath: ID!) { ...@@ -9,6 +9,7 @@ query getStorageCounter($fullPath: ID!) {
buildArtifactsSize buildArtifactsSize
packagesSize packagesSize
wikiSize wikiSize
snippetsSize
} }
projects(includeSubgroups: true) { projects(includeSubgroups: true) {
edges { edges {
......
---
title: Add snippets_size to group usage statistics graph
merge_request: 35608
author:
type: changed
...@@ -28,7 +28,8 @@ describe('Storage Counter usage graph component', () => { ...@@ -28,7 +28,8 @@ describe('Storage Counter usage graph component', () => {
packagesSize: 3000, packagesSize: 3000,
lfsObjectsSize: 2000, lfsObjectsSize: 2000,
buildArtifactsSize: 1000, buildArtifactsSize: 1000,
storageSize: 15000, snippetsSize: 2000,
storageSize: 17000,
}, },
limit: 2000, limit: 2000,
}; };
...@@ -48,6 +49,7 @@ describe('Storage Counter usage graph component', () => { ...@@ -48,6 +49,7 @@ describe('Storage Counter usage graph component', () => {
packagesSize, packagesSize,
repositorySize, repositorySize,
wikiSize, wikiSize,
snippetsSize,
} = data.rootStorageStatistics; } = data.rootStorageStatistics;
expect(types.at(0).text()).toMatchInterpolatedText(`Wikis ${numberToHumanSize(wikiSize)}`); expect(types.at(0).text()).toMatchInterpolatedText(`Wikis ${numberToHumanSize(wikiSize)}`);
...@@ -61,6 +63,9 @@ describe('Storage Counter usage graph component', () => { ...@@ -61,6 +63,9 @@ describe('Storage Counter usage graph component', () => {
`LFS Objects ${numberToHumanSize(lfsObjectsSize)}`, `LFS Objects ${numberToHumanSize(lfsObjectsSize)}`,
); );
expect(types.at(4).text()).toMatchInterpolatedText( expect(types.at(4).text()).toMatchInterpolatedText(
`Snippets ${numberToHumanSize(snippetsSize)}`,
);
expect(types.at(5).text()).toMatchInterpolatedText(
`Build Artifacts ${numberToHumanSize(buildArtifactsSize)}`, `Build Artifacts ${numberToHumanSize(buildArtifactsSize)}`,
); );
}); });
...@@ -95,11 +100,12 @@ describe('Storage Counter usage graph component', () => { ...@@ -95,11 +100,12 @@ describe('Storage Counter usage graph component', () => {
it('sets correct flex values', () => { it('sets correct flex values', () => {
expect(findStorageTypeUsagesSerialized()).toStrictEqual([ expect(findStorageTypeUsagesSerialized()).toStrictEqual([
'0.3333333333333333', '0.29411764705882354',
'0.26666666666666666', '0.23529411764705882',
'0.2', '0.17647058823529413',
'0.13333333333333333', '0.11764705882352941',
'0.06666666666666667', '0.11764705882352941',
'0.058823529411764705',
]); ]);
}); });
}); });
...@@ -112,11 +118,12 @@ describe('Storage Counter usage graph component', () => { ...@@ -112,11 +118,12 @@ describe('Storage Counter usage graph component', () => {
it('it does render correclty', () => { it('it does render correclty', () => {
expect(findStorageTypeUsagesSerialized()).toStrictEqual([ expect(findStorageTypeUsagesSerialized()).toStrictEqual([
'0.3333333333333333', '0.29411764705882354',
'0.26666666666666666', '0.23529411764705882',
'0.2', '0.17647058823529413',
'0.13333333333333333', '0.11764705882352941',
'0.06666666666666667', '0.11764705882352941',
'0.058823529411764705',
]); ]);
}); });
}); });
......
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