diff --git a/ChangeLog b/ChangeLog index 6d498419bf..3bbdcedf7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,6 +29,7 @@ phpMyAdmin - ChangeLog - issue #14636 Move operation causes SELECT * FROM `undefined` - issue #14630 Enum '0' produces incorrect search SQL - issue #14223 Fix TypeError in database designer +- issue #13621 QBE selenium tests broken since merge of #13342 4.8.3 (2018-08-22) - issue #14314 Error when naming a database '0' diff --git a/db_qbe.php b/db_qbe.php index 82a8d3b980..9fa1b4c5ed 100644 --- a/db_qbe.php +++ b/db_qbe.php @@ -13,6 +13,7 @@ use PhpMyAdmin\Relation; use PhpMyAdmin\Response; use PhpMyAdmin\SavedSearches; use PhpMyAdmin\Sql; +use PhpMyAdmin\Template; use PhpMyAdmin\Url; use PhpMyAdmin\Util; @@ -22,9 +23,10 @@ use PhpMyAdmin\Util; require_once 'libraries/common.inc.php'; $response = Response::getInstance(); +$relation = new Relation($GLOBALS['dbi']); +$template = new Template(); // Gets the relation settings -$relation = new Relation($GLOBALS['dbi']); $cfgRelation = $relation->getRelationsParam(); $savedSearchList = []; @@ -140,6 +142,23 @@ unset($message_to_display); // create new qbe search instance $db_qbe = new Qbe($GLOBALS['dbi'], $GLOBALS['db'], $savedSearchList, $savedSearch); +$secondaryTabs = [ + 'multi' => [ + 'link' => 'db_multi_table_query.php', + 'text' => __('Multi-table query'), + ], + 'qbe' => [ + 'link' => 'db_qbe.php', + 'text' => __('Query by example'), + ], +]; +$response->addHTML( + $template->render('secondary_tabs', [ + 'url_params' => $url_params, + 'sub_tabs' => $secondaryTabs, + ]) +); + $url = 'db_designer.php' . Url::getCommon( array_merge( $url_params, diff --git a/libraries/classes/Core.php b/libraries/classes/Core.php index 3b9379eb68..045fddd579 100644 --- a/libraries/classes/Core.php +++ b/libraries/classes/Core.php @@ -37,6 +37,7 @@ class Core 'db_export.php', 'db_importdocsql.php', 'db_multi_table_query.php', + 'db_qbe.php', 'db_structure.php', 'db_import.php', 'db_operations.php', diff --git a/libraries/classes/Menu.php b/libraries/classes/Menu.php index 0737a76334..6466a853be 100644 --- a/libraries/classes/Menu.php +++ b/libraries/classes/Menu.php @@ -480,11 +480,18 @@ class Menu $tabs['search']['warning'] = __('Database seems to be empty!'); } - $tabs['multi_table_query']['text'] = __('Query'); - $tabs['multi_table_query']['icon'] = 's_db'; - $tabs['multi_table_query']['link'] = 'db_multi_table_query.php'; + $tabs['query']['text'] = __('Query'); + $tabs['query']['icon'] = 's_db'; + $tabs['query']['link'] = 'db_multi_table_query.php'; + $tabs['query']['active'] = in_array( + basename($GLOBALS['PMA_PHP_SELF']), + array( + 'db_multi_table_query.php', + 'db_qbe.php', + ) + ); if ($num_tables == 0) { - $tabs['qbe']['warning'] = __('Database seems to be empty!'); + $tabs['query']['warning'] = __('Database seems to be empty!'); } $tabs['export']['text'] = __('Export'); diff --git a/libraries/classes/Util.php b/libraries/classes/Util.php index a955dba794..bbfdff6597 100644 --- a/libraries/classes/Util.php +++ b/libraries/classes/Util.php @@ -4051,7 +4051,7 @@ class Util 'structure' => __('Structure'), 'sql' => __('SQL'), 'search' => __('Search'), - 'multi_table_query' => __('Query'), + 'query' => __('Query'), 'export' => __('Export'), 'import' => __('Import'), 'operation' => __('Operations'), diff --git a/templates/database/multi_table_query/form.twig b/templates/database/multi_table_query/form.twig index de43bd2b0d..4f5d38497d 100644 --- a/templates/database/multi_table_query/form.twig +++ b/templates/database/multi_table_query/form.twig @@ -1,3 +1,18 @@ +{% include 'secondary_tabs.twig' with { + 'url_params': { + 'db': db + }, + 'sub_tabs': [ + { + 'link': 'db_multi_table_query.php', + 'text': 'Multi-table query'|trans + }, + { + 'link': 'db_qbe.php', + 'text': 'Query by example'|trans + } + ] +} only %} {% include 'div_for_slider_effect.twig' with { 'id': 'query_div', 'message': 'Query window'|trans, diff --git a/test/selenium/QueryByExampleTest.php b/test/selenium/QueryByExampleTest.php index ab66217b03..e0f6e299a6 100644 --- a/test/selenium/QueryByExampleTest.php +++ b/test/selenium/QueryByExampleTest.php @@ -27,7 +27,6 @@ class QueryByExampleTest extends TestBase */ protected function setUp() { - $this->markTestSkipped('Broken, see https://github.com/phpmyadmin/phpmyadmin/issues/13621'); parent::setUp(); $this->dbQuery( @@ -57,13 +56,16 @@ class QueryByExampleTest extends TestBase $this->waitForElement('partialLinkText', 'Query')->click(); $this->waitAjax(); + $this->waitForElement('partialLinkText', 'Query by example')->click(); + $this->waitAjax(); + /* Select Columns to be used in the query */ - $this->selectByLabel( + $this->selectByValue( $this->waitForElement('name', 'criteriaColumn[0]'), '`test_table`.`id`' ); - $this->selectByLabel( + $this->selectByValue( $this->waitForElement('name', 'criteriaColumn[1]'), '`test_table`.`val`' ); @@ -84,12 +86,12 @@ class QueryByExampleTest extends TestBase ); /* Select sort order amongst columns */ - $this->selectByLabel( + $this->selectByValue( $this->waitForElement('name', 'criteriaSortOrder[0]'), '2' ); - $this->selectByLabel( + $this->selectByValue( $this->waitForElement('name', 'criteriaSortOrder[1]'), '1' );