PluginProbe
ElasticPress / 5.0.0
ElasticPress v5.0.0
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
elasticpress / includes / partials / stats-page.php

stats-page.php in ElasticPress 5.0.0, at includes/partials/stats-page.php

98 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Template for ElasticPress Index health page
4 *
5 * @since 3.1
6 * @package elasticpress
7 */
8
9 use ElasticPress\IndexHelper;
10 use ElasticPress\Stats;
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // Exit if accessed directly.
14 }
15
16 require_once __DIR__ . '/header.php';
17
18 $index_meta = IndexHelper::factory()->get_index_meta();
19
20 if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) {
21 $sync_url = network_admin_url( 'admin.php?page=elasticpress-sync' );
22 } else {
23 $sync_url = admin_url( 'admin.php?page=elasticpress-sync' );
24 }
25
26 Stats::factory()->build_stats();
27
28 $index_health = Stats::factory()->get_health();
29 $totals = Stats::factory()->get_totals();
30 ?>
31
32 <div class="error-overlay <?php if ( ! empty( $index_meta ) ) : ?>syncing<?php endif; ?>"></div>
33 <div class="wrap metabox-holder">
34 <h1><?php esc_html_e( 'Index Health', 'elasticpress' ); ?></h1>
35
36 <?php if ( ! empty( $index_health ) ) : ?>
37 <div class="ep-flex-container">
38 <div class="stats-list postbox">
39 <h2 class="hndle stats-list-th"><span><?php esc_html_e( 'Index list', 'elasticpress' ); ?></span><span><?php esc_html_e( 'Health', 'elasticpress' ); ?></span></h2>
40 <?php
41 foreach ( $index_health as $index_stat ) :
42 ?>
43 <p class="inside"><?php echo esc_html( $index_stat['name'] ); ?>
44 <span class="status-circle <?php echo esc_attr( $index_stat['health'] ); ?>-status">
45 <?php echo esc_html( $index_stat['health'] ); ?>
46 </span>
47 </p>
48 <?php endforeach; ?>
49 </div>
50 <div class="stats-queries postbox">
51 <h2 class="hndle"><?php esc_html_e( 'Queries & Indexing total', 'elasticpress' ); ?></h2>
52 <div class="ep-qchart-container">
53 <div class="inside">
54 <canvas id="queriesTotalChart" width="400" height="400"></canvas>
55 </div>
56 </div>
57 </div>
58 <div class="postbox doc-chart">
59 <h2 class="hndle"><?php esc_html_e( 'Documents', 'elasticpress' ); ?></h2>
60 <div class="inside">
61 <canvas id="documentChart" width="800" height="450"></canvas>
62 </div>
63 </div>
64 <div class="postbox ep-totals">
65 <h2 class="hndle">Totals</h2>
66 <div class="ep-flex-container">
67 <div class="ep-totals-column inside">
68 <p class="ep-totals-title"><?php esc_html_e( 'Total Documents', 'elasticpress' ); ?></p>
69 <p class="ep-totals-data"><?php echo esc_html( $totals['docs'] ); ?></p>
70 </div>
71 <div class="ep-totals-column inside">
72 <p class="ep-totals-title"><?php esc_html_e( 'Total Size', 'elasticpress' ); ?></p>
73 <p class="ep-totals-data"><?php echo esc_html( Stats::factory()->convert_to_readable_size( $totals['size'] ) ); ?></p>
74 </div>
75 <div class="ep-totals-column inside">
76 <p class="ep-totals-title"><?php esc_html_e( 'Total Memory', 'elasticpress' ); ?></p>
77 <p class="ep-totals-data"><?php echo esc_html( Stats::factory()->convert_to_readable_size( $totals['memory'] ) ); ?></p>
78 </div>
79 </div>
80 </div>
81 </div>
82 <?php else : ?>
83 <p>
84 <?php
85 printf(
86 /* translators: %s: Sync page link. */
87 esc_html__( 'We could not find any data for your Elasticsearch indices. Maybe you need to %s?', 'elasticpress' ),
88 sprintf(
89 '<a href="%1$s">%2$s</a>',
90 esc_url( $sync_url ),
91 esc_html__( 'sync your content', 'elasticpress' )
92 )
93 );
94 ?>
95 </p>
96 <?php endif; ?>
97 </div>
98