add a button to clear out finished share links
The dashboard listed every share ever made, including ones revoked or expired months ago, and nothing ever pruned them. There is now a "Clean up finished links" button next to Refresh that runs a normal cleanup pass and then drops the records that are done with, reporting how many went. Only revoked, expired and failed records are removed. A link that can still be used is left alone, including a spent one-use link whose guest is still watching until it expires, since that record is Redeemed rather than finished. Folded into 1.0.3.0 rather than shipped as 1.0.3.1: the ceiling fix and this are going out as one replacement of that version.
Cette révision appartient à :
@@ -173,6 +173,9 @@
|
||||
<button is="emby-button" type="button" id="RefreshLinks" class="raised">
|
||||
<span>Refresh</span>
|
||||
</button>
|
||||
<button is="emby-button" type="button" id="CleanupLinks" class="raised">
|
||||
<span>Clean up finished links</span>
|
||||
</button>
|
||||
<span id="LinksStatus" class="sl-muted sl-list-status">Loading…</span>
|
||||
</div>
|
||||
<div style="overflow-x:auto; margin-top:0.5rem;">
|
||||
@@ -426,6 +429,30 @@
|
||||
document.querySelector('#RefreshLinks').addEventListener('click', function () {
|
||||
loadLinks();
|
||||
});
|
||||
|
||||
document.querySelector('#CleanupLinks').addEventListener('click', function () {
|
||||
var button = page.querySelector('#CleanupLinks');
|
||||
var status = page.querySelector('#LinksStatus');
|
||||
button.disabled = true;
|
||||
status.textContent = 'Cleaning up…';
|
||||
ApiClient.ajax({
|
||||
type: 'POST',
|
||||
url: ApiClient.getUrl('ShareLinks/Admin/Cleanup'),
|
||||
dataType: 'json'
|
||||
}).then(function (result) {
|
||||
var removed = result && (result.removed !== undefined ? result.removed : result.Removed);
|
||||
removed = parseInt(removed, 10) || 0;
|
||||
return loadLinks().then(function () {
|
||||
page.querySelector('#LinksStatus').textContent = removed === 1
|
||||
? '1 finished link removed.'
|
||||
: removed + ' finished links removed.';
|
||||
});
|
||||
}).catch(function () {
|
||||
status.textContent = 'Cleanup failed.';
|
||||
}).finally(function () {
|
||||
button.disabled = false;
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur