[web] display project history blob size on admin pages (#28351)
* [history-v1] add endpoint for getting blob stats of projects * [web] display project history blob size on admin pages * [web] break down history storage size by text and binary blob GitOrigin-RevId: bfa4d56cf2c503d03005c13a0f7ac38158156cd2
This commit is contained in:
@@ -307,6 +307,14 @@ async function getHistoryId(projectId) {
|
||||
return historyId
|
||||
}
|
||||
|
||||
async function getProjectBlobStats(historyIds) {
|
||||
return await fetchJson(`${HISTORY_V1_URL}/projects/blob-stats`, {
|
||||
method: 'POST',
|
||||
basicAuth: HISTORY_V1_BASIC_AUTH,
|
||||
json: { projectIds: historyIds.map(id => id.toString()) },
|
||||
})
|
||||
}
|
||||
|
||||
async function injectUserDetails(data) {
|
||||
// data can be either:
|
||||
// {
|
||||
@@ -418,5 +426,6 @@ module.exports = {
|
||||
requestBlobWithProjectId,
|
||||
getLatestHistory,
|
||||
getChanges,
|
||||
getProjectBlobStats,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1612,6 +1612,7 @@
|
||||
"sign_up": "",
|
||||
"simple_search_mode": "",
|
||||
"single_sign_on_sso": "",
|
||||
"size": "",
|
||||
"something_not_right": "",
|
||||
"something_went_wrong": "",
|
||||
"something_went_wrong_canceling_your_subscription": "",
|
||||
|
||||
@@ -151,6 +151,15 @@ export interface Meta {
|
||||
'ol-hasTrackChangesFeature': boolean
|
||||
'ol-hasWriteAccess': boolean
|
||||
'ol-hideLinkingWidgets': boolean // CI only
|
||||
'ol-historyBlobStats': {
|
||||
projectId: string
|
||||
textBlobsBytes: number
|
||||
binaryBlobsBytes: number
|
||||
totalBytes: number
|
||||
nTextBlobs: number
|
||||
nBinaryBlobs: number
|
||||
owned?: boolean
|
||||
}
|
||||
'ol-i18n': { currentLangCode: string }
|
||||
'ol-inactiveTutorials': string[]
|
||||
'ol-institutionEmailNonCanonical': string | undefined
|
||||
|
||||
@@ -2089,6 +2089,7 @@
|
||||
"site_wide_option_available": "Site-wide option available",
|
||||
"six_collaborators_per_project": "6 collaborators per project",
|
||||
"six_per_project": "6 per project",
|
||||
"size": "Size",
|
||||
"skip": "Skip",
|
||||
"skip_to_content": "Skip to content",
|
||||
"solutions": "Solutions",
|
||||
|
||||
@@ -16,6 +16,21 @@ class MockV1HistoryApi extends AbstractMockApi {
|
||||
}
|
||||
|
||||
applyRoutes() {
|
||||
this.app.post('/api/projects/blob-stats', (req, res, next) => {
|
||||
res.json(
|
||||
req.body.projectIds.map(projectId => {
|
||||
return {
|
||||
projectId,
|
||||
textBlobBytes: 7331,
|
||||
binaryBlobBytes: 1337,
|
||||
totalBytes: 7331 + 1337,
|
||||
nTextBlobs: 13,
|
||||
nBinaryBlobs: 42,
|
||||
}
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
this.app.get(
|
||||
'/api/projects/:project_id/version/:version/zip',
|
||||
(req, res, next) => {
|
||||
|
||||
Reference in New Issue
Block a user