Changeset View
Changeset View
Standalone View
Standalone View
assets/src/bundles/vault/vault-ui.js
Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | async function checkVaultCookingTasks() { | ||||
for (let i = 0; i < vaultCookingTasks.length; ++i) { | for (let i = 0; i < vaultCookingTasks.length; ++i) { | ||||
const cookingTask = vaultCookingTasks[i]; | const cookingTask = vaultCookingTasks[i]; | ||||
if (typeof cookingTask.object_type !== 'undefined') { | if (typeof cookingTask.object_type !== 'undefined') { | ||||
// Legacy cooking task, upgrade it to the new schema | // Legacy cooking task, upgrade it to the new schema | ||||
if (cookingTask.object_type === 'directory') { | if (cookingTask.object_type === 'directory') { | ||||
cookingTask.swhid = `swh:1:dir:${cookingTask.object_id}`; | cookingTask.swhid = `swh:1:dir:${cookingTask.object_id}`; | ||||
cookingTask.bundle_type = 'flat'; | cookingTask.bundle_type = 'flat'; | ||||
cookingTask.fetch_url = Urls.api_1_vault_fetch_flat(cookingTask.swhid); | |||||
} else if (cookingTask.object_type === 'revision') { | } else if (cookingTask.object_type === 'revision') { | ||||
cookingTask.swhid = `swh:1:rev:${cookingTask.object_id}`; | cookingTask.swhid = `swh:1:rev:${cookingTask.object_id}`; | ||||
cookingTask.bundle_type = 'gitfast'; | cookingTask.bundle_type = 'gitfast'; | ||||
cookingTask.fetch_url = Urls.api_1_vault_fetch_gitfast(cookingTask.swhid); | |||||
} else { | } else { | ||||
// Log to the console + Sentry | // Log to the console + Sentry | ||||
console.error(`Unexpected cookingTask.object_type: ${cookingTask.object_type}`); | console.error(`Unexpected cookingTask.object_type: ${cookingTask.object_type}`); | ||||
// Ignore it for now and hope a future version will fix it | // Ignore it for now and hope a future version will fix it | ||||
continue; | continue; | ||||
} | } | ||||
delete cookingTask.object_type; | delete cookingTask.object_type; | ||||
delete cookingTask.object_id; | delete cookingTask.object_id; | ||||
▲ Show 20 Lines • Show All 116 Lines • Show Last 20 Lines |