Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ public function statusAjaxAction()
$gridBlock = $this->getLayout()->createBlock('index/adminhtml_process_grid');
foreach ($indexer->getProcessesCollection()->clear() as $process) {
/* @var $process Mage_Index_Model_Process */
$updateRequiredOptions = $process->getUpdateRequiredOptions();
$updateRequiredDisplay = $gridBlock->decorateUpdateRequired(
$process->getUpdateRequiredOptions()[intval($process->getUnprocessedEventsCollection()->count() > 0)],
$updateRequiredOptions[intval($process->getUnprocessedEventsCollection()->count() > 0)],
$process, null, false);
$statusesOptions = $process->getStatusesOptions();
$statusDisplay = $gridBlock->decorateStatus(
$process->getStatusesOptions()[$process->getStatus()],
$statusesOptions[$process->getStatus()],
$process, null, false);
$endedAtDisplay = $process->getEndedAt()
? Mage::helper('core')->formatDate($process->getEndedAt(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@
<name>hackathon_indexerstats/index_progress.js</name>
</action>
</reference>
<reference name="content">
<block type="adminhtml/template" name="process.edit.js" template="hackathon/indexerstats/process/js.phtml" after="process"/>
</reference>
</adminhtml_process_list>
</layout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php /** @var Mage_Adminhtml_Block_Template $this */ ?>
<script type="text/javascript">
document.observe("dom:loaded", function() {
$$('.hackathon_indexerstats_progress').each(function (progressbar) {
progressbar.progress = new IndexerStats.Progress(progressbar);
});
indexer_processes_grid_massactionJsObject.apply = indexer_processes_grid_massactionJsObject.apply.wrap(
function(parent) {
if (this.select.value == 'reindex') {
var firstProcessId = this.checkedString.split(',', 1);
var progressbar = $('indexer_processes_grid_table')
.select('input[name=process][value=' + firstProcessId + ']')[0]
.parentNode.parentNode
.select('.hackathon_indexerstats_info')[0];
progressbar.addClassName('hackathon_indexerstats_progress');
progressbar.parentNode.removeClassName('hackathon_indexerstats_finished');
progressbar.progress = new IndexerStats.Progress(progressbar);
}
parent();
if (this.select.value == 'reindex') {
IndexerStats.status.update();
}
});
IndexerStats.status = new IndexerStats.Status('<?php echo $this->getUrl('adminhtml/process/statusAjax') ?>');
});
</script>
31 changes: 4 additions & 27 deletions js/hackathon_indexerstats/index_progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ IndexerStats.Status.prototype = {
*/
UPDATE_BEFORE_ESTIMATE : 5,

initialize : function() {
initialize : function(statusUpdateUrl) {
this.isUpdating = false;
this.timeoutId = null;
this.statusUpdateUrl = statusUpdateUrl;
},
update : function() {
if (this.isUpdating) return;
this.isUpdating = true;
new Ajax.Request('/admin/process/statusAjax', {
new Ajax.Request(this.statusUpdateUrl, {
loaderArea : false,
onSuccess : this.onSuccess.bind(this),
onFailure : this.onFailure.bind(this)
Expand Down Expand Up @@ -169,28 +170,4 @@ IndexerStats.Progress.prototype = {
this.timeDisplayElement.update(remainingTimeDisplay);
this.progressBarElement.style.width = percentDone + '%';
}
};

document.observe("dom:loaded", function() {
$$('.hackathon_indexerstats_progress').each(function (progressbar) {
progressbar.progress = new IndexerStats.Progress(progressbar);
});
indexer_processes_grid_massactionJsObject.apply = indexer_processes_grid_massactionJsObject.apply.wrap(
function(parent) {
if (this.select.value == 'reindex') {
var firstProcessId = this.checkedString.split(',', 1);
var progressbar = $('indexer_processes_grid_table')
.select('input[name=process][value=' + firstProcessId + ']')[0]
.parentNode.parentNode
.select('.hackathon_indexerstats_info')[0];
progressbar.addClassName('hackathon_indexerstats_progress');
progressbar.parentNode.removeClassName('hackathon_indexerstats_finished');
progressbar.progress = new IndexerStats.Progress(progressbar);
}
parent();
if (this.select.value == 'reindex') {
IndexerStats.status.update();
}
});
IndexerStats.status = new IndexerStats.Status();
});
};