File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed
app/code/Magento/Indexer/Block/Backend/Grid/Column/Renderer Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change 5
5
*/
6
6
namespace Magento \Indexer \Block \Backend \Grid \Column \Renderer ;
7
7
8
+ use Magento \Customer \Model \Customer ;
9
+
8
10
/**
9
11
* Renderer for 'Scheduled' column in indexer grid
10
12
*/
@@ -18,13 +20,35 @@ class Scheduled extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstr
18
20
*/
19
21
public function render (\Magento \Framework \DataObject $ row )
20
22
{
23
+ if ($ this ->isPreferRealtime ($ row ->getIndexerId ())) {
24
+ $ scheduleClass = 'grid-severity-major ' ;
25
+ $ realtimeClass = 'grid-severity-notice ' ;
26
+ } else {
27
+ $ scheduleClass = 'grid-severity-notice ' ;
28
+ $ realtimeClass = 'grid-severity-major ' ;
29
+ }
30
+
21
31
if ($ this ->_getValue ($ row )) {
22
- $ class = ' grid-severity-notice ' ;
32
+ $ class = $ scheduleClass ;
23
33
$ text = __ ('Update by Schedule ' );
24
34
} else {
25
- $ class = ' grid-severity-major ' ;
35
+ $ class = $ realtimeClass ;
26
36
$ text = __ ('Update on Save ' );
27
37
}
38
+
28
39
return '<span class=" ' . $ class . '"><span> ' . $ text . '</span></span> ' ;
29
40
}
41
+
42
+ /**
43
+ * Determine if an indexer is recommended to be in 'realtime' mode
44
+ *
45
+ * @param string $indexer
46
+ * @return bool
47
+ */
48
+ public function isPreferRealtime (string $ indexer ): bool
49
+ {
50
+ return in_array ($ indexer , [
51
+ Customer::CUSTOMER_GRID_INDEXER_ID ,
52
+ ]);
53
+ }
30
54
}
You can’t perform that action at this time.
0 commit comments