Skip to content

Commit

Permalink
Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia committed Sep 20, 2023
2 parents e3daac8 + 0d986d6 commit b9a4089
Show file tree
Hide file tree
Showing 14 changed files with 1,000 additions and 177 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ All notable changes to this project will be documented in this file, per [the Ke
### Security
-->

## [3.1.0] - 2023-09-20

### Added
- New button to explain ES queries. Props [@burhandodhy](https://github.com/burhandodhy), [@felipeelia](https://github.com/felipeelia), [@MARQAS](https://github.com/MARQAS), and [@brandwaffle](https://github.com/brandwaffle) via [#79](https://github.com/10up/ElasticPress/pull/79) and [#88](https://github.com/10up/ElasticPress/pull/88).
- New button to Reload and retrieve raw ES document. Props [@burhandodhy](https://github.com/burhandodhy), [@felipeelia](https://github.com/felipeelia), and [@brandwaffle](https://github.com/brandwaffle) via [#79](https://github.com/10up/ElasticPress/pull/79).
- Query types (and context when listing queries in the Query Log admin screen.) Props [@felipeelia](https://github.com/felipeelia) and [@burhandodhy](https://github.com/burhandodhy) via [#82](https://github.com/10up/ElasticPress/pull/82).
- Log query by context, status, and fixed time. Props [@felipeelia](https://github.com/felipeelia) via [#83](https://github.com/10up/ElasticPress/pull/83) and [#86](https://github.com/10up/ElasticPress/pull/86).
- Official support to Query Monitor. Props [@felipeelia](https://github.com/felipeelia) via [#84](https://github.com/10up/ElasticPress/pull/84).

### Security
- Bumped `tough-cookie` from 4.1.2 to 4.1.3. Props [@dependabot](https://github.com/dependabot) via [#75](https://github.com/10up/debug-bar-elasticpress/pull/75).
- Bumped `word-wrap` from 1.2.3 to 1.2.4. Props [@dependabot](https://github.com/dependabot) via [#76](https://github.com/10up/debug-bar-elasticpress/pull/76).

## [3.0.0] - 2023-03-23

This release drops the support for older versions of ElasticPress and PHP.
Expand Down Expand Up @@ -83,6 +96,7 @@ This release drops the support for older versions of WordPress Core, ElasticPres
* Initial release

[Unreleased]: https://github.com/10up/debug-bar-elasticpress/compare/trunk...develop
[3.1.0]: https://github.com/10up/debug-bar-elasticpress/compare/3.0.0...3.1.0
[3.0.0]: https://github.com/10up/debug-bar-elasticpress/compare/2.1.1...3.0.0
[2.1.1]: https://github.com/10up/debug-bar-elasticpress/compare/2.1.0...2.1.1
[2.1.0]: https://github.com/10up/debug-bar-elasticpress/compare/2.0.0...2.1.0
Expand Down
2 changes: 1 addition & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The following acknowledges the Maintainers for this repository, those who have C

The following individuals are responsible for curating the list of issues, responding to pull requests, and ensuring regular releases happen.

[Taylor Lovett (@tlovett1)](https://github.com/tlovett1) and [Vasken Hauri (@brandwaffle)](https://github.com/brandwaffle).
[Vasken Hauri (@brandwaffle)](https://github.com/brandwaffle).

## Contributors

Expand Down
56 changes: 39 additions & 17 deletions assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
padding: 0.5em 10px;
}

.ep-queries-debug pre {
padding: 10px;
}

.ep-queries-debug .dashicons {
cursor: pointer;
}
Expand Down Expand Up @@ -43,7 +47,10 @@
}

.ep-queries-buttons-wrapper {
align-items: center;
clear: both;
display: flex;
gap: 10px;
padding: 1em 0;
}

Expand All @@ -66,22 +73,18 @@
clear: left;
}

#query-monitor-main .qm-debug-bar {
margin: 20px;
}

/* stylelint-disable selector-id-pattern */

/* The giant list of selectors here is needed to
* override QM's important rules
*/
#debug-menu-target-EP_Debug_Bar_ElasticPress .button,
#debug-menu-target-EP_Debug_Bar_ElasticPress a.button,
#debug-menu-target-EP_Debug_Bar_ElasticPress button.ep-copy-button.button.qm-button {
#qm-elasticpress .button,
#qm-elasticpress a.button {
background: #f6f7f7 !important;
border-color: #2271b1 !important;
border: 1px solid #2271b1 !important;
border-radius: 3px !important;
border-width: 1px;

/* Overriding some Debug Bar "important" rules */
color: #2271b1 !important;
Expand All @@ -95,37 +98,56 @@
text-shadow: none;
}

#debug-menu-target-EP_Debug_Bar_ElasticPress .button:hover {
#debug-menu-target-EP_Debug_Bar_ElasticPress .button:hover,
#query-monitor-main #qm-elasticpress .button:hover {
background: #f0f0f1;
border-color: #0a4b78;
color: #0a4b78;
text-decoration: none;
color: #0a4b78 !important;
text-decoration: none !important;
}

#debug-menu-target-EP_Debug_Bar_ElasticPress .button:active {
background: #f6f7f7;
border-color: #8c8f94;
#debug-menu-target-EP_Debug_Bar_ElasticPress .button:active,
#query-monitor-main #qm-elasticpress .button:hover {
background: #f6f7f7 !important;
border-color: #8c8f94 !important;
box-shadow: none;
}

#debug-menu-target-EP_Debug_Bar_ElasticPress .button:focus {
#debug-menu-target-EP_Debug_Bar_ElasticPress .button:focus,
#query-monitor-main #qm-elasticpress .button:focus {
outline: none;
}

/* Overriding some Debug Bar "important" rules */
#debug-menu-target-EP_Debug_Bar_ElasticPress .button-primary,
#debug-menu-target-EP_Debug_Bar_ElasticPress a.button-primary,
#debug-menu-target-EP_Debug_Bar_ElasticPress button.button-primary {
#debug-menu-target-EP_Debug_Bar_ElasticPress button.button-primary,
#query-monitor-main #qm-elasticpress .button-primary {
background: #007cba !important;
border: 1px solid #007cba !important;
color: #fff !important;
margin-right: 5px !important;
}

#debug-menu-target-EP_Debug_Bar_ElasticPress a.button-primary:hover,
#debug-menu-target-EP_Debug_Bar_ElasticPress a.button-primary:focus {
#debug-menu-target-EP_Debug_Bar_ElasticPress a.button-primary:focus,
#query-monitor-main #qm-elasticpress a.button-primary:hover,
#query-monitor-main #qm-elasticpress a.button-primary:focus {
background: #007cba !important;
color: #fff !important;
text-decoration: none !important;
}

#query-monitor-main #qm-elasticpress h3,
#query-monitor-main #qm-elasticpress p {
margin: 0 !important;
padding: 0 !important;
text-align: center !important;
}

#query-monitor-main #qm-elasticpress li {
border-top: 1px solid var(--qm-panel-separator) !important;
line-height: 20px !important;
padding: 20px 0 !important;
}

/* stylelint-enable selector-id-pattern */
70 changes: 70 additions & 0 deletions classes/CommonPanel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
/**
* CommonPanel class file.
*
* @since 3.1.0
* @package DebugBarElasticPress
*/

namespace DebugBarElasticPress;

defined( 'ABSPATH' ) || exit;

/**
* CommonPanel class.
*/
class CommonPanel {
/**
* Panel menu title
*
* @var string
*/
public $title = '';

/**
* Class constructor
*/
public function __construct() {
$this->title = esc_html__( 'ElasticPress', 'debug-bar-elasticpress' );
}

/**
* Return the panel title
*
* @return string
*/
public function get_title() : string {
return $this->title;
}
/**
* Enqueue scripts for front end and admin
*/
public function enqueue_scripts_styles() {
if ( ! is_user_logged_in() ) {
return;
}

wp_enqueue_script( 'debug-bar-elasticpress', EP_DEBUG_URL . 'assets/js/main.js', array( 'wp-dom-ready', 'clipboard' ), EP_DEBUG_VERSION, true );
wp_enqueue_style( 'debug-bar-elasticpress', EP_DEBUG_URL . 'assets/css/main.css', array(), EP_DEBUG_VERSION );
}

/**
* Show the contents of the panel
*/
public function render() {
$queries = \ElasticPress\Elasticsearch::factory()->get_query_log();

if ( function_exists( '\ElasticPress\Utils\is_indexing' ) && \ElasticPress\Utils\is_indexing() ) {
?>
<div class="ep-debug-bar-warning">
<?php esc_html_e( 'ElasticPress is currently indexing.', 'debug-bar-elasticpress' ); ?>
</div>
<?php
}

$debug_bar_output = new \DebugBarElasticPress\QueryOutput( $queries );
$debug_bar_output->render_buttons();
$debug_bar_output->render_additional_buttons();
$debug_bar_output->render_queries();
}
}
28 changes: 11 additions & 17 deletions classes/EP_Debug_Bar_ElasticPress.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,28 @@ class EP_Debug_Bar_ElasticPress extends \Debug_Bar_Panel {
*/
public $title;

/**
* Common panel instance
*
* @var \DebugBarElasticPress\CommonPanel
*/
protected $common_panel;

/**
* Initial debug bar stuff
*/
public function init() {
$this->title( esc_html__( 'ElasticPress', 'debug-bar-elasticpress' ) );

add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) );
$this->common_panel = new \DebugBarElasticPress\CommonPanel();
$this->common_panel->enqueue_scripts_styles();
}

/**
* Enqueue scripts for front end and admin
*/
public function enqueue_scripts_styles() {
if ( ! is_user_logged_in() ) {
return;
}

wp_enqueue_script( 'debug-bar-elasticpress', EP_DEBUG_URL . 'assets/js/main.js', array( 'wp-dom-ready', 'clipboard' ), EP_DEBUG_VERSION, true );
wp_enqueue_style( 'debug-bar-elasticpress', EP_DEBUG_URL . 'assets/css/main.css', array(), EP_DEBUG_VERSION );
_deprecated_function( __METHOD__, '3.1.0', 'DebugBarElasticPress\EP_Panel::enqueue_scripts_styles()' );
}

/**
Expand Down Expand Up @@ -85,15 +87,7 @@ public function render() {
?>
</h2>

<?php if ( function_exists( '\ElasticPress\Utils\is_indexing' ) && \ElasticPress\Utils\is_indexing() ) : ?>
<div class="ep-debug-bar-warning">
<?php esc_html_e( 'ElasticPress is currently indexing.', 'debug-bar-elasticpress' ); ?>
</div>
<?php endif; ?>

<?php
$debug_bar_output = new \DebugBarElasticPress\QueryOutput( $queries );
$debug_bar_output->render_buttons();
$debug_bar_output->render_queries();
$this->common_panel->render();
}
}
Loading

0 comments on commit b9a4089

Please sign in to comment.