[web] extend project admin page for history debugging (#32437)
* [web] extend project admin page for history debugging * [web] address review feedback Co-authored-by: Malik <malik.glossop@overleaf.com> --------- Co-authored-by: Malik <malik.glossop@overleaf.com> GitOrigin-RevId: 01866e8c8529bc8332c49baf4ad281e300f8cdd4
This commit is contained in:
committed by
Copybot
co-authored by
Malik
parent
8dd743c543
commit
a8abc22e6c
@@ -103,6 +103,31 @@ async function getAllDeletedDocs(projectId) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string|ObjectId} projectId
|
||||
* @return {Promise<{_id: string, version: number}[]>}
|
||||
*/
|
||||
async function getAllDocVersions(projectId) {
|
||||
const url = new URL(settings.apis.docstore.url)
|
||||
url.pathname = path.posix.join(
|
||||
'project',
|
||||
projectId.toString(),
|
||||
'doc-versions'
|
||||
)
|
||||
try {
|
||||
return await fetchJson(url, { signal: AbortSignal.timeout(TIMEOUT) })
|
||||
} catch (error) {
|
||||
if (error instanceof RequestFailedError) {
|
||||
throw new OError('docstore api responded with non-success code', {
|
||||
projectId,
|
||||
status: error.response.status,
|
||||
})
|
||||
}
|
||||
throw OError.tag(error, 'could not get doc versions from docstore')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} projectId
|
||||
*/
|
||||
@@ -368,6 +393,7 @@ export default {
|
||||
destroyProject: callbackify(destroyProject),
|
||||
promises: {
|
||||
deleteDoc,
|
||||
getAllDocVersions,
|
||||
getAllDocs,
|
||||
getAllDeletedDocs,
|
||||
getAllRanges,
|
||||
|
||||
@@ -297,6 +297,12 @@ async function ensureNoResyncPending(projectId) {
|
||||
if (resyncPending) throw new OError('broken history with pending resync')
|
||||
}
|
||||
|
||||
async function getDebugInfo(projectId) {
|
||||
return await fetchJson(
|
||||
`${settings.apis.project_history.url}/project/${projectId}/debug-info`
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get history changes since a given version
|
||||
*
|
||||
@@ -471,5 +477,6 @@ export default {
|
||||
getBlobStats,
|
||||
getLatestHistoryWithHistoryId,
|
||||
ensureNoResyncPending,
|
||||
getDebugInfo,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user