Commit 69514454 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '241980-uploads-on-storage-ui' into 'master'

UI for uploads counting as storage

See merge request gitlab-org/gitlab!47113
parents 8cf2f7f5 e6679008
......@@ -15,9 +15,11 @@ module StorageHelper
counter_wikis: storage_counter(statistics.wiki_size),
counter_build_artifacts: storage_counter(statistics.build_artifacts_size),
counter_lfs_objects: storage_counter(statistics.lfs_objects_size),
counter_snippets: storage_counter(statistics.snippets_size)
counter_snippets: storage_counter(statistics.snippets_size),
counter_packages: storage_counter(statistics.packages_size),
counter_uploads: storage_counter(statistics.uploads_size)
}
_("Repository: %{counter_repositories} / Wikis: %{counter_wikis} / Build Artifacts: %{counter_build_artifacts} / LFS: %{counter_lfs_objects} / Snippets: %{counter_snippets}") % counters
_("Repository: %{counter_repositories} / Wikis: %{counter_wikis} / Build Artifacts: %{counter_build_artifacts} / LFS: %{counter_lfs_objects} / Snippets: %{counter_snippets} / Packages: %{counter_packages} / Uploads: %{counter_uploads}") % counters
end
end
......@@ -84,6 +84,7 @@ export default {
packagesSize: s__('UsageQuota|Packages'),
wikiSize: s__('UsageQuota|Wiki'),
snippetsSize: s__('UsageQuota|Snippets'),
uploadsSize: s__('UsageQuota|Uploads'),
},
};
</script>
......
......@@ -31,6 +31,7 @@ export default {
storageSize,
wikiSize,
snippetsSize,
uploadsSize,
} = this.rootStorageStatistics;
const artifactsSize = buildArtifactsSize + pipelineArtifactsSize;
......@@ -76,6 +77,12 @@ export default {
class: 'gl-bg-data-viz-orange-800',
size: snippetsSize,
},
{
name: s__('UsageQuota|Uploads'),
style: this.usageStyle(this.barRatio(uploadsSize)),
class: 'gl-bg-data-viz-aqua-700',
size: uploadsSize,
},
]
.filter(data => data.size !== 0)
.sort((a, b) => b.size - a.size);
......
......@@ -27,6 +27,7 @@ query getStorageCounter(
packagesSize
wikiSize
snippetsSize
uploadsSize
}
projects(
includeSubgroups: true
......@@ -54,6 +55,7 @@ query getStorageCounter(
packagesSize
wikiSize
snippetsSize
uploadsSize
}
}
pageInfo {
......
---
title: Show uploads size in storage usage breakdown
merge_request: 47113
author:
type: added
......@@ -31,6 +31,7 @@ describe('Storage Counter usage graph component', () => {
pipelineArtifactsSize: 500,
snippetsSize: 2000,
storageSize: 17000,
uploadsSize: 1000,
},
limit: 2000,
};
......@@ -52,6 +53,7 @@ describe('Storage Counter usage graph component', () => {
repositorySize,
wikiSize,
snippetsSize,
uploadsSize,
} = data.rootStorageStatistics;
expect(types.at(0).text()).toMatchInterpolatedText(`Wikis ${numberToHumanSize(wikiSize)}`);
......@@ -70,6 +72,7 @@ describe('Storage Counter usage graph component', () => {
expect(types.at(5).text()).toMatchInterpolatedText(
`Artifacts ${numberToHumanSize(buildArtifactsSize + pipelineArtifactsSize)}`,
);
expect(types.at(6).text()).toMatchInterpolatedText(`Uploads ${numberToHumanSize(uploadsSize)}`);
});
describe('when storage type is not used', () => {
......@@ -108,6 +111,7 @@ describe('Storage Counter usage graph component', () => {
'0.11764705882352941',
'0.11764705882352941',
'0.058823529411764705',
'0.058823529411764705',
]);
});
});
......@@ -126,6 +130,7 @@ describe('Storage Counter usage graph component', () => {
'0.11764705882352941',
'0.11764705882352941',
'0.058823529411764705',
'0.058823529411764705',
]);
});
});
......
......@@ -22998,7 +22998,7 @@ msgstr ""
msgid "Repository synchronization concurrency limit"
msgstr ""
msgid "Repository: %{counter_repositories} / Wikis: %{counter_wikis} / Build Artifacts: %{counter_build_artifacts} / LFS: %{counter_lfs_objects} / Snippets: %{counter_snippets}"
msgid "Repository: %{counter_repositories} / Wikis: %{counter_wikis} / Build Artifacts: %{counter_build_artifacts} / LFS: %{counter_lfs_objects} / Snippets: %{counter_snippets} / Packages: %{counter_packages} / Uploads: %{counter_uploads}"
msgstr ""
msgid "RepositorySettingsAccessLevel|Select"
......@@ -29375,6 +29375,9 @@ msgstr ""
msgid "UsageQuota|Unlimited"
msgstr ""
msgid "UsageQuota|Uploads"
msgstr ""
msgid "UsageQuota|Usage"
msgstr ""
......
......@@ -15,7 +15,7 @@ RSpec.describe "Admin > Admin sees project statistics" do
let(:project) { create(:project, :repository) }
it "shows project statistics" do
expect(page).to have_content("Storage: 0 Bytes (Repository: 0 Bytes / Wikis: 0 Bytes / Build Artifacts: 0 Bytes / LFS: 0 Bytes / Snippets: 0 Bytes)")
expect(page).to have_content("Storage: 0 Bytes (Repository: 0 Bytes / Wikis: 0 Bytes / Build Artifacts: 0 Bytes / LFS: 0 Bytes / Snippets: 0 Bytes / Packages: 0 Bytes / Uploads: 0 Bytes)")
end
end
......
......@@ -32,10 +32,12 @@ RSpec.describe StorageHelper do
wiki_size: 10.bytes,
lfs_objects_size: 20.gigabytes,
build_artifacts_size: 30.megabytes,
snippets_size: 40.megabytes))
snippets_size: 40.megabytes,
packages_size: 12.megabytes,
uploads_size: 15.megabytes))
end
let(:message) { 'Repository: 10 KB / Wikis: 10 Bytes / Build Artifacts: 30 MB / LFS: 20 GB / Snippets: 40 MB' }
let(:message) { 'Repository: 10 KB / Wikis: 10 Bytes / Build Artifacts: 30 MB / LFS: 20 GB / Snippets: 40 MB / Packages: 12 MB / Uploads: 15 MB' }
it 'works on ProjectStatistics' do
expect(helper.storage_counters_details(project.statistics)).to eq(message)
......
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