Changeset View
Changeset View
Standalone View
Standalone View
swh/web/assets/src/bundles/browse/origin-search.js
Show All 31 Lines | if (data.length > 0) { | ||||
$('#swh-no-result').hide(); | $('#swh-no-result').hide(); | ||||
clearOriginSearchResultsTable(); | clearOriginSearchResultsTable(); | ||||
let table = $('#origin-search-results tbody'); | let table = $('#origin-search-results tbody'); | ||||
for (let i = localOffset; i < localOffset + perPage && i < data.length; ++i) { | for (let i = localOffset; i < localOffset + perPage && i < data.length; ++i) { | ||||
let elem = data[i]; | let elem = data[i]; | ||||
let browseUrl = Urls.browse_origin(elem.url); | let browseUrl = Urls.browse_origin(elem.url); | ||||
let tableRow = `<tr id="origin-${elem.id}" class="swh-search-result-entry swh-tr-hover-highlight">`; | let tableRow = `<tr id="origin-${elem.id}" class="swh-search-result-entry swh-tr-hover-highlight">`; | ||||
tableRow += `<td style="width: 120px;">${elem.type}</td>`; | tableRow += `<td style="width: 120px;">${elem.type}</td>`; | ||||
tableRow += `<td style="white-space: nowrap;"><a href="${browseUrl}">${elem.url}</a></td>`; | tableRow += `<td style="white-space: nowrap;"><a href="${encodeURI(browseUrl)}">${encodeURI(elem.url)}</a></td>`; | ||||
tableRow += `<td id="visit-status-origin-${elem.id}"><i title="Checking visit status" class="fa fa-refresh fa-spin"></i></td>`; | tableRow += `<td id="visit-status-origin-${elem.id}"><i title="Checking visit status" class="fa fa-refresh fa-spin"></i></td>`; | ||||
tableRow += '</tr>'; | tableRow += '</tr>'; | ||||
table.append(tableRow); | table.append(tableRow); | ||||
// get async latest visit snapshot and update visit status icon | // get async latest visit snapshot and update visit status icon | ||||
let latestSnapshotUrl = Urls.browse_origin_latest_snapshot(elem.id); | let latestSnapshotUrl = Urls.browse_origin_latest_snapshot(elem.id); | ||||
fetch(latestSnapshotUrl) | fetch(latestSnapshotUrl) | ||||
.then(response => response.json()) | .then(response => response.json()) | ||||
.then(data => { | .then(data => { | ||||
▲ Show 20 Lines • Show All 190 Lines • Show Last 20 Lines |