Changeset View
Changeset View
Standalone View
Standalone View
swh/web/assets/src/bundles/vault/vault-create-tasks.js
Show All 13 Lines | export function vaultRequest(objectType, objectId) { | ||||
} else { | } else { | ||||
vaultUrl = Urls.api_1_vault_cook_revision_gitfast(objectId); | vaultUrl = Urls.api_1_vault_cook_revision_gitfast(objectId); | ||||
} | } | ||||
// check if object has already been cooked | // check if object has already been cooked | ||||
fetch(vaultUrl) | fetch(vaultUrl) | ||||
.then(response => response.json()) | .then(response => response.json()) | ||||
.then(data => { | .then(data => { | ||||
// object needs to be cooked | // object needs to be cooked | ||||
if (data.exception === 'NotFoundExc') { | if (data.exception === 'NotFoundExc' || data.status === 'failed') { | ||||
// if last cooking has failed, force recooking | |||||
swh.vault.removeVaultCookingTaskStatuses([objectId]); | |||||
vlorentz: The comment doesn't match the code | |||||
anlambertAuthorUnsubmitted Done Inline ActionsAck, will improve anlambert: Ack, will improve | |||||
$(`#vault-cook-${objectType}-modal`).modal('show'); | $(`#vault-cook-${objectType}-modal`).modal('show'); | ||||
// object has been cooked and is in the vault cache | // object has been cooked and should be in the vault cache, | ||||
// it will be asked to cook it again if it is not | |||||
} else if (data.status === 'done') { | } else if (data.status === 'done') { | ||||
$(`#vault-fetch-${objectType}-modal`).modal('show'); | $(`#vault-fetch-${objectType}-modal`).modal('show'); | ||||
} | } | ||||
}); | }); | ||||
} | } | ||||
function addVaultCookingTask(cookingTask) { | function addVaultCookingTask(cookingTask) { | ||||
let vaultCookingTasks = JSON.parse(localStorage.getItem('swh-vault-cooking-tasks')); | let vaultCookingTasks = JSON.parse(localStorage.getItem('swh-vault-cooking-tasks')); | ||||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |
The comment doesn't match the code