Keep reporting last time "out of date" lists were updated

This commit is contained in:
Raymond Hill 2021-05-09 11:53:26 -04:00
parent 1f8a67f40e
commit d0e4c60f59
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 17 additions and 6 deletions

View File

@ -25,11 +25,13 @@
/******************************************************************************/ /******************************************************************************/
(( ) => { {
// >>>>> start of local scope
/******************************************************************************/ /******************************************************************************/
const lastUpdateTemplateString = vAPI.i18n('3pLastUpdate'); const lastUpdateTemplateString = vAPI.i18n('3pLastUpdate');
const obsoleteTemplateString = vAPI.i18n('3pExternalListObsolete');
const reValidExternalList = /^[a-z-]+:\/\/(?:\S+\/\S*|\/\S+)/m; const reValidExternalList = /^[a-z-]+:\/\/(?:\S+\/\S*|\/\S+)/m;
let listDetails = {}; let listDetails = {};
@ -141,14 +143,22 @@ const renderFilterLists = function(soft) {
); );
li.classList.toggle('failed', asset.error !== undefined); li.classList.toggle('failed', asset.error !== undefined);
li.classList.toggle('obsolete', asset.obsolete === true); li.classList.toggle('obsolete', asset.obsolete === true);
const lastUpdateString = lastUpdateTemplateString.replace(
'{{ago}}',
renderElapsedTimeToString(asset.writeTime || 0)
);
if ( asset.obsolete === true ) {
let title = obsoleteTemplateString;
if ( asset.cached && asset.writeTime !== 0 ) {
title += '\n' + lastUpdateString;
}
li.querySelector('.status.obsolete').setAttribute('title', title);
}
if ( asset.cached === true ) { if ( asset.cached === true ) {
li.classList.add('cached'); li.classList.add('cached');
li.querySelector('.status.cache').setAttribute( li.querySelector('.status.cache').setAttribute(
'title', 'title',
lastUpdateTemplateString.replace( lastUpdateString
'{{ago}}',
renderElapsedTimeToString(asset.writeTime)
)
); );
} else { } else {
li.classList.remove('cached'); li.classList.remove('cached');
@ -696,5 +706,6 @@ renderFilterLists();
/******************************************************************************/ /******************************************************************************/
})(); // <<<<< end of local scope
}