Changeset View
Changeset View
Standalone View
Standalone View
swh/web/assets/src/bundles/vault/vault-ui.js
Show First 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | .then(cookingTasks => { | ||||
if (cookingTask.object_type === 'directory') { | if (cookingTask.object_type === 'directory') { | ||||
tableRow = `<tr id="vault-task-${cookingTask.object_id}" title="Once downloaded, the directory can be extracted with the ` + | tableRow = `<tr id="vault-task-${cookingTask.object_id}" title="Once downloaded, the directory can be extracted with the ` + | ||||
`following command:\n\n$ tar xvzf ${cookingTask.object_id}.tar.gz">`; | `following command:\n\n$ tar xvzf ${cookingTask.object_id}.tar.gz">`; | ||||
} else { | } else { | ||||
tableRow = `<tr id="vault-task-${cookingTask.object_id}" title="Once downloaded, the git repository can be imported with the ` + | tableRow = `<tr id="vault-task-${cookingTask.object_id}" title="Once downloaded, the git repository can be imported with the ` + | ||||
`following commands:\n\n$ git init\n$ zcat ${cookingTask.object_id}.gitfast.gz | git fast-import">`; | `following commands:\n\n$ git init\n$ zcat ${cookingTask.object_id}.gitfast.gz | git fast-import">`; | ||||
} | } | ||||
tableRow += '<td><input type="checkbox" class="vault-task-toggle-selection"/></td>'; | tableRow += '<td><input type="checkbox" class="vault-task-toggle-selection"/></td>'; | ||||
tableRow += `<td style="width: 120px"><i class="${swh.webapp.getSwhObjectIcon(cookingTask.object_type)} fa-fw"></i>${cookingTask.object_type}</td>`; | tableRow += `<td style="width: 120px"><i class="${swh.webapp.getSwhObjectIcon(cookingTask.object_type)} mdi-fw" aria-hidden="true"></i>${cookingTask.object_type}</td>`; | ||||
tableRow += `<td class="vault-object-id" data-object-id="${cookingTask.object_id}"><a href="${browseUrl}">${cookingTask.object_id}</a></td>`; | tableRow += `<td class="vault-object-id" data-object-id="${cookingTask.object_id}"><a href="${browseUrl}">${cookingTask.object_id}</a></td>`; | ||||
tableRow += `<td style="width: 350px">${progressBar.outerHTML}</td>`; | tableRow += `<td style="width: 350px">${progressBar.outerHTML}</td>`; | ||||
let downloadLink = downloadLinkWait; | let downloadLink = downloadLinkWait; | ||||
if (cookingTask.status === 'done') { | if (cookingTask.status === 'done') { | ||||
downloadLink = `<button class="btn btn-default btn-sm" onclick="swh.vault.fetchCookedObject('${cookingTask.fetch_url}')` + | downloadLink = `<button class="btn btn-default btn-sm" onclick="swh.vault.fetchCookedObject('${cookingTask.fetch_url}')` + | ||||
'"><i class="fa fa-download fa-fw" aria-hidden="true"></i>Download</button>'; | '"><i class="mdi mdi-download mdi-fw" aria-hidden="true"></i>Download</button>'; | ||||
} else if (cookingTask.status === 'failed') { | } else if (cookingTask.status === 'failed') { | ||||
downloadLink = ''; | downloadLink = ''; | ||||
} | } | ||||
tableRow += `<td class="vault-dl-link" style="width: 320px">${downloadLink}</td>`; | tableRow += `<td class="vault-dl-link" style="width: 320px">${downloadLink}</td>`; | ||||
tableRow += '</tr>'; | tableRow += '</tr>'; | ||||
table.prepend(tableRow); | table.prepend(tableRow); | ||||
} else { | } else { | ||||
let progressBar = rowTask.find('.progress-bar'); | let progressBar = rowTask.find('.progress-bar'); | ||||
updateProgressBar(progressBar, cookingTask); | updateProgressBar(progressBar, cookingTask); | ||||
let downloadLink = rowTask.find('.vault-dl-link'); | let downloadLink = rowTask.find('.vault-dl-link'); | ||||
if (cookingTask.status === 'done') { | if (cookingTask.status === 'done') { | ||||
downloadLink[0].innerHTML = `<button class="btn btn-default btn-sm" onclick="swh.vault.fetchCookedObject('${cookingTask.fetch_url}')` + | downloadLink[0].innerHTML = `<button class="btn btn-default btn-sm" onclick="swh.vault.fetchCookedObject('${cookingTask.fetch_url}')` + | ||||
'"><i class="fa fa-download fa-fw" aria-hidden="true"></i>Download</button>'; | '"><i class="mdi mdi-download mdi-fw" aria-hidden="true"></i>Download</button>'; | ||||
} else if (cookingTask.status === 'failed') { | } else if (cookingTask.status === 'failed') { | ||||
downloadLink[0].innerHTML = ''; | downloadLink[0].innerHTML = ''; | ||||
} else if (cookingTask.status === 'new') { | } else if (cookingTask.status === 'new') { | ||||
downloadLink[0].innerHTML = downloadLinkWait; | downloadLink[0].innerHTML = downloadLinkWait; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
localStorage.setItem('swh-vault-cooking-tasks', JSON.stringify(vaultCookingTasks)); | localStorage.setItem('swh-vault-cooking-tasks', JSON.stringify(vaultCookingTasks)); | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |