Skip to content

Commit

Permalink
Revert "Fix database names dissapearing from Processes tab"
Browse files Browse the repository at this point in the history
This reverts commit af4434d.
  • Loading branch information
liviuconcioiu committed May 29, 2022
1 parent af4434d commit e9a5ec0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 26 deletions.
23 changes: 14 additions & 9 deletions libraries/classes/Server/Status/Processes.php
Expand Up @@ -70,21 +70,26 @@ public function getList(array $params): array
while ($process = $result->fetchAssoc()) {
// Array keys need to modify due to the way it has used
// to display column values
foreach (array_keys($process) as $key) {
$newKey = ucfirst(mb_strtolower($key));
if ($newKey === $key) {
continue;
if (
(! empty($params['order_by_field']) && ! empty($params['sort_order']))
|| ! empty($params['showExecuting'])
) {
foreach (array_keys($process) as $key) {
$newKey = ucfirst(mb_strtolower($key));
if ($newKey === $key) {
continue;
}

$process[$newKey] = $process[$key];
unset($process[$key]);
}

$process[$newKey] = $process[$key];
unset($process[$key]);
}

$rows[] = [
'id' => $process['Id'],
'user' => $process['User'],
'host' => $process['Host'],
'db' => ! isset($process['Db']) || strlen($process['Db']) === 0 ? '' : $process['Db'],
'db' => ! isset($process['db']) || strlen($process['db']) === 0 ? '' : $process['db'],
'command' => $process['Command'],
'time' => $process['Time'],
'state' => ! empty($process['State']) ? $process['State'] : '---',
Expand Down Expand Up @@ -119,7 +124,7 @@ private function getSortableColumnsForProcessList(bool $showFullSql, array $para
],
[
'column_name' => __('Database'),
'order_by_field' => 'Db',
'order_by_field' => 'db',
],
[
'column_name' => __('Command'),
Expand Down
18 changes: 2 additions & 16 deletions templates/server/status/processes/list.twig
Expand Up @@ -45,25 +45,11 @@
</a>
</td>
<td class="font-monospace text-end">{{ row.id }}</td>
<td>
<a href="{{ url('/server/privileges', {
'username': row.user,
'hostname': row.host,
'dbname': row.db,
'tablename': '',
'routinename': '',
}) }}">
{{ row.user }}
</a>
</td>
<td>{{ row.user }}</td>
<td>{{ row.host }}</td>
<td>
{% if row.db != '' %}
<a href="{{ url('/database/structure', {
'db': row.db,
}) }}">
{{ row.db }}
</a>
{{ row.db }}
{% else %}
<em>{% trans 'None' %}</em>
{% endif %}
Expand Down
Expand Up @@ -77,7 +77,7 @@ public function testIndex(): void

$_POST['full'] = '1';
$_POST['column_name'] = 'Database';
$_POST['order_by_field'] = 'Db';
$_POST['order_by_field'] = 'db';
$_POST['sort_order'] = 'ASC';

$this->dummyDbi->addSelectDb('mysql');
Expand Down

0 comments on commit e9a5ec0

Please sign in to comment.