Skip to content

Commit

Permalink
Add secondary tabs for database query
Browse files Browse the repository at this point in the history
Fixes phpmyadmin#13621 QBE selenium tests broken since merge of phpmyadmin#13342

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
  • Loading branch information
MauricioFauth committed Oct 16, 2018
1 parent e19a777 commit ef24087
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 7 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ phpMyAdmin - ChangeLog
- issue #14438 Invisible Icon "Show Full Queries"
- issue #14133 CSS issue in Designer
- issue #14447 Error while copying database (pma__column_info)
- issue #13621 QBE selenium tests broken since merge of #13342

4.8.3 (2018-08-22)
- issue #14314 Error when naming a database '0'
Expand Down
20 changes: 19 additions & 1 deletion db_qbe.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use PhpMyAdmin\Response;
use PhpMyAdmin\SavedSearches;
use PhpMyAdmin\Sql;
use PhpMyAdmin\Template;
use PhpMyAdmin\Url;
use PhpMyAdmin\Util;

Expand All @@ -20,9 +21,9 @@
require_once 'libraries/common.inc.php';

$response = Response::getInstance();
$relation = new Relation();

// Gets the relation settings
$relation = new Relation();
$cfgRelation = $relation->getRelationsParam();

$savedSearchList = array();
Expand Down Expand Up @@ -138,6 +139,23 @@
// create new qbe search instance
$db_qbe = new Qbe($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::get('secondary_tabs')->render([
'url_params' => $url_params,
'sub_tabs' => $secondaryTabs,
])
);

$url = 'db_designer.php' . Url::getCommon(
array_merge(
$url_params,
Expand Down
1 change: 1 addition & 0 deletions libraries/classes/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,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',
Expand Down
1 change: 1 addition & 0 deletions libraries/classes/Database/Qbe.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use PhpMyAdmin\Core;
use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Message;
use PhpMyAdmin\Relation;
use PhpMyAdmin\Table;
use PhpMyAdmin\Template;
Expand Down
15 changes: 11 additions & 4 deletions libraries/classes/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,18 @@ private function _getDbTabs()
$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');
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -3978,7 +3978,7 @@ public static function getMenuTabList($level = null)
'structure' => __('Structure'),
'sql' => __('SQL'),
'search' => __('Search'),
'multi_table_query' => __('Query'),
'query' => __('Query'),
'export' => __('Export'),
'import' => __('Import'),
'operation' => __('Operations'),
Expand Down
15 changes: 15 additions & 0 deletions templates/database/multi_table_query/form.twig
Original file line number Diff line number Diff line change
@@ -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 %}
{{ Util_getDivForSliderEffect('query_div', 'Query window'|trans, 'open') }}
<form action="" id="query_form">
<input type="hidden" id="db_name" value="{{ db }}">
Expand Down
4 changes: 3 additions & 1 deletion test/selenium/QueryByExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class QueryByExampleTest extends TestBase
*/
public function setUp()
{
$this->markTestSkipped('Broken, see https://github.com/phpmyadmin/phpmyadmin/issues/13621');
parent::setUp();

$this->dbQuery(
Expand Down Expand Up @@ -65,6 +64,9 @@ public function testQueryByExample()
$this->waitForElement('byPartialLinkText', 'Query')->click();
$this->waitAjax();

$this->waitForElement('byPartialLinkText', 'Query by example')->click();
$this->waitAjax();

/* Select Columns to be used in the query */
$select = $this->select(
$this->waitForElement('byName', 'criteriaColumn[0]')
Expand Down

0 comments on commit ef24087

Please sign in to comment.