Skip to content

Commit

Permalink
Widget: dataset freshness timeout updated to work for elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
dasgarner committed Mar 28, 2024
1 parent 053ba76 commit 0184b3c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
20 changes: 14 additions & 6 deletions modules/dataset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,13 @@
// meta: Metadata
// properties: The properties for the widget
// Do we have a freshnessTimeout?
if (properties.freshnessTimeout > 0
&& moment(meta.cacheDt).add(properties.freshnessTimeout, 'minutes').isBefore(moment())
) {
return {dataItems: []};
}
// Filter the items array we have been given
if (parseInt(properties.randomiseItems) === 1) {
// Sort the items in a random order (considering the entire list)
Expand Down Expand Up @@ -319,13 +326,14 @@ return {dataItems: items};
<onVisible><![CDATA[
// Do we have a freshnessTimeout?
if (properties.freshnessTimeout > 0) {
// Get the now moment time
var now = moment();
// Set up an interval to check whether or not we have exceeded our freshness
var timer = setInterval(function() {
// Set up an interval to check whether we have exceeded our freshness
if (window.freshnessTimer) {
clearInterval(window.freshnessTimer);
}
window.freshnessTimer = setInterval(function() {
if (moment(meta.cacheDt).add(properties.freshnessTimeout, 'minutes').isBefore(moment())) {
$("#content").empty().append(properties.noDataMessage);
clearInterval(timer);
// Reload the widget data.
XiboPlayer.playerWidgets[id].render();
}
}, 10000);
}
Expand Down
10 changes: 7 additions & 3 deletions modules/src/xibo-dataset-render.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2023 Xibo Signage Ltd
* Copyright (C) 2024 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
* Xibo - Digital Signage - https://xibosignage.com
*
* This file is part of Xibo.
*
Expand Down Expand Up @@ -40,7 +40,11 @@ jQuery.fn.extend({

if (options.rowsPerPage > 0) {
// Cycle handles this for us
$(el).cycle({
if ($(el).prop('isCycle')) {
$(el).cycle('destroy');
}

$(el).prop('isCycle', true).cycle({
fx: options.transition,
timeout: duration * 1000,
slides: '> table',
Expand Down

0 comments on commit 0184b3c

Please sign in to comment.