Skip to content

Commit

Permalink
Adding optional refresh interval
Browse files Browse the repository at this point in the history
  • Loading branch information
steverobbins committed Dec 8, 2015
1 parent d1049d5 commit 1da88f9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<config>
<modules>
<Steverobbins_Redismanager>
<version>1.3.2</version>
<version>1.4.0</version>
</Steverobbins_Redismanager>
</modules>
<global>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ var redisForm;
// ]]>
</script>
<div class="redismanager refresher">
<button id="redismanager-refresh-now" type="button" class="scalable right"><span><span><?php echo $this->__('Refresh') ?></span></span></button>
<button id="redismanager-refresh-now" type="button" class="scalable"><span><span><?php echo $this->__('Refresh') ?></span></span></button>
<p class="auto"><?php echo $this->__('Refresh every %s seconds', '<input type="text" id="redismanager-refresh-interval" value="0" />') ?> <input type="submit" id="redismanager-refresh-set" value="<?php echo $this->__('Set') ?>" /></p>
</div>
<div class="redismanager manager">
<div id="redismanager-grid">
Expand Down Expand Up @@ -67,10 +68,26 @@ var redisForm;
</div>
<script>
// <![CDATA[
var redismanagerRefresh;
$('redismanager-refresh-set').on('click', function() {
var interval = parseInt($('redismanager-refresh-interval').value);
if (!interval) {
clearInterval(redismanagerRefresh);
} else {
redisRefreshGrid();
redismanagerRefresh = setInterval(function() {
redisRefreshGrid();
}, interval * 1000);
}
return false;
});
$('redismanager-refresh-now').on('click', function() {
new Ajax.Updater('redismanager-grid', '<?php echo $this->getUrl("*/*/grid") ?>', {evalScripts: true});
redisRefreshGrid();
return false;
});
function redisRefreshGrid() {
new Ajax.Updater('redismanager-grid', '<?php echo $this->getUrl("*/*/grid") ?>', {evalScripts: true});
}
function redisCheckAll() {
redisForm.getElements('checkbox').each(function(box) {
box.checked = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,18 @@
}

.redismanager.refresher {
padding-bottom: 20px;
text-align: right;
}

.redismanager.manager {
clear: both;
}

.redismanager.refresher .auto {
margin-top: 10px
}

#redismanager-refresh-interval {
width: 20px;
text-align: center;
}

0 comments on commit 1da88f9

Please sign in to comment.