diff --git a/app/code/community/Hackathon/IndexerStats/controllers/Adminhtml/ProcessController.php b/app/code/community/Hackathon/IndexerStats/controllers/Adminhtml/ProcessController.php index 66667ec..bdd5622 100644 --- a/app/code/community/Hackathon/IndexerStats/controllers/Adminhtml/ProcessController.php +++ b/app/code/community/Hackathon/IndexerStats/controllers/Adminhtml/ProcessController.php @@ -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) diff --git a/app/design/adminhtml/base/default/layout/hackathon_indexerstats.xml b/app/design/adminhtml/default/default/layout/hackathon_indexerstats.xml similarity index 79% rename from app/design/adminhtml/base/default/layout/hackathon_indexerstats.xml rename to app/design/adminhtml/default/default/layout/hackathon_indexerstats.xml index e6a7860..8d835fe 100644 --- a/app/design/adminhtml/base/default/layout/hackathon_indexerstats.xml +++ b/app/design/adminhtml/default/default/layout/hackathon_indexerstats.xml @@ -20,5 +20,8 @@ hackathon_indexerstats/index_progress.js + + + \ No newline at end of file diff --git a/app/design/adminhtml/default/default/template/hackathon/indexerstats/process/js.phtml b/app/design/adminhtml/default/default/template/hackathon/indexerstats/process/js.phtml new file mode 100644 index 0000000..5c34cb5 --- /dev/null +++ b/app/design/adminhtml/default/default/template/hackathon/indexerstats/process/js.phtml @@ -0,0 +1,26 @@ + + \ No newline at end of file diff --git a/js/hackathon_indexerstats/index_progress.js b/js/hackathon_indexerstats/index_progress.js index a1bccfc..aef8b3b 100644 --- a/js/hackathon_indexerstats/index_progress.js +++ b/js/hackathon_indexerstats/index_progress.js @@ -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) @@ -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(); -}); \ No newline at end of file +}; \ No newline at end of file