Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status Report fixes #3154

Merged
merged 2 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Add anchor IDs to report sections.
  • Loading branch information
JakePT committed Nov 24, 2022
commit e94e094357bc4b5bd7d34fbcc0beb95fa17d7e79
2 changes: 1 addition & 1 deletion assets/js/status-report/components/reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ import Report from './reports/report';
*/
export default ({ reports }) => {
return Object.entries(reports).map(([key, { actions, groups, title }]) => (
<Report actions={actions} groups={groups} key={key} title={title} />
<Report actions={actions} groups={groups} id={key} key={key} title={title} />
));
};
7 changes: 4 additions & 3 deletions assets/js/status-report/components/reports/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ import Value from './report/value';
* @param {object} props Component props.
* @param {Array} props.actions Report actions.
* @param {object} props.groups Report groups.
* @param {string} props.id Report ID.
* @param {string} props.title Report title.
* @returns {WPElement} Report component.
*/
export default ({ actions, groups, title }) => {
export default ({ actions, groups, id, title }) => {
if (groups.length < 1) {
return null;
}

return (
<Panel>
<Panel id={title}>
<PanelHeader>
<h2>{title}</h2>
<h2 id={id}>{title}</h2>
{actions.map(({ href, label }) => (
<Button
href={decodeEntities(href)}
Expand Down
4 changes: 2 additions & 2 deletions includes/classes/Screen/StatusReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function get_reports() : array {
/* this filter is documented in elasticpress.php */
$query_logger = apply_filters( 'ep_query_logger', new \ElasticPress\QueryLogger() );
if ( $query_logger ) {
$reports['failed_queries'] = new \ElasticPress\StatusReport\FailedQueries( $query_logger );
$reports['failed-queries'] = new \ElasticPress\StatusReport\FailedQueries( $query_logger );
}

$reports['indices'] = new \ElasticPress\StatusReport\Indices();
Expand All @@ -97,7 +97,7 @@ public function get_reports() : array {
$reports['autosuggest'] = new \ElasticPress\StatusReport\ElasticPressIo();
}

$reports['last_sync'] = new \ElasticPress\StatusReport\LastSync();
$reports['last-sync'] = new \ElasticPress\StatusReport\LastSync();
$reports['features'] = new \ElasticPress\StatusReport\Features();

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/php/TestStatusReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testGetReports() {

$reports = $status_report->get_reports();
$this->assertSame(
[ 'wordpress', 'indexable', 'elasticpress', 'failed_queries', 'indices', 'last_sync', 'features' ],
[ 'wordpress', 'indexable', 'elasticpress', 'failed-queries', 'indices', 'last-sync', 'features' ],
array_keys( $reports )
);
}
Expand All @@ -46,7 +46,7 @@ public function testGetReportsFilter() {

$reports = $status_report->get_reports();
$this->assertSame(
[ 'wordpress', 'indexable', 'elasticpress', 'failed_queries', 'indices', 'last_sync', 'features', 'custom' ],
[ 'wordpress', 'indexable', 'elasticpress', 'failed-queries', 'indices', 'last-sync', 'features', 'custom' ],
array_keys( $reports )
);
}
Expand All @@ -63,8 +63,8 @@ public function testGetReportsSkipped() {

$reports = $status_report->get_reports();
$this->assertSame(
[ 'elasticpress', 'failed_queries', 'indices', 'last_sync', 'features' ],
[ 'elasticpress', 'failed-queries', 'indices', 'last-sync', 'features' ],
array_keys( $reports )
);
}
}
}