Skip to content

Commit ac6febc

Browse files
committed
Fixes & allow to set default list view
1 parent 83a2cd1 commit ac6febc

File tree

10 files changed

+16
-43
lines changed

10 files changed

+16
-43
lines changed

assets/css/styles.css

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
/*! tailwindcss v4.0.6 | MIT License | https://tailwindcss.com */
1+
/*! tailwindcss v4.0.14 | MIT License | https://tailwindcss.com */
22
@layer theme, base, components, utilities;
33
@layer theme {
44
:root, :host {
5-
--color-primary-50: #f8fafc;
6-
--color-primary-100: #f1f5f9;
75
--color-primary-200: #e2e8f0;
86
--color-primary-300: #cbd5e1;
97
--color-primary-400: #94a3b8;
@@ -12,7 +10,6 @@
1210
--color-primary-700: #334155;
1311
--color-primary-800: #1e293b;
1412
--color-primary-900: #0f172a;
15-
--color-primary-950: #020617;
1613
--link-bg: #64748b;
1714
--link-bg-hover: #334155;
1815
--link-active: #cbd5e1;
@@ -785,6 +782,7 @@
785782
}
786783
.focus\:outline-hidden {
787784
&:focus {
785+
--tw-outline-style: none;
788786
outline-style: none;
789787
@media (forced-colors: active) {
790788
outline: 2px solid transparent;
@@ -1379,32 +1377,6 @@
13791377
.dark #phpinfo .v i {
13801378
color: #c2c2c2;
13811379
}
1382-
@keyframes spin {
1383-
to {
1384-
transform: rotate(360deg);
1385-
}
1386-
}
1387-
@keyframes ping {
1388-
75%, 100% {
1389-
transform: scale(2);
1390-
opacity: 0;
1391-
}
1392-
}
1393-
@keyframes pulse {
1394-
50% {
1395-
opacity: 0.5;
1396-
}
1397-
}
1398-
@keyframes bounce {
1399-
0%, 100% {
1400-
transform: translateY(-25%);
1401-
animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
1402-
}
1403-
50% {
1404-
transform: none;
1405-
animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
1406-
}
1407-
}
14081380
@property --tw-space-x-reverse {
14091381
syntax: "*";
14101382
inherits: false;

config.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,5 @@
129129
'time-format' => 'd. m. Y H:i:s',
130130
'decimal-sep' => ',',
131131
'thousands-sep' => ' ',
132+
'list-view' => 'table', // table/tree - default key list view
132133
];

src/Admin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use RobiNN\Pca\Dashboards\DashboardInterface;
1212

1313
class Admin {
14-
public const VERSION = '2.1.2';
14+
public const VERSION = '2.1.3';
1515

1616
/**
1717
* @var array<string, DashboardInterface>

src/Dashboards/APCu/APCuTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public function getAllKeys(): array {
203203
}
204204
}
205205

206-
if (Http::get('view', 'table') === 'tree') {
206+
if (Http::get('view', Config::get('list-view', 'table')) === 'tree') {
207207
return $this->keysTreeView($keys);
208208
}
209209

src/Dashboards/Memcached/MemcachedTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public function getAllKeys(): array {
223223
}
224224
}
225225

226-
if (Http::get('view', 'table') === 'tree') {
226+
if (Http::get('view', Config::get('list-view', 'table')) === 'tree') {
227227
return $this->keysTreeView($keys);
228228
}
229229

src/Dashboards/Redis/Compatibility/Redis.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ class Redis extends \Redis implements RedisCompatibilityInterface {
3434
*
3535
* @throws DashboardException
3636
*/
37-
public function connection(array $server): self {
37+
public function __construct(array $server) {
38+
parent::__construct();
39+
3840
$server['port'] ??= 6379;
3941

4042
try {
@@ -59,8 +61,6 @@ public function connection(array $server): self {
5961
$connection = $server['path'] ?? $server['host'].':'.$server['port'];
6062
throw new DashboardException($e->getMessage().' ['.$connection.']');
6163
}
62-
63-
return $this;
6464
}
6565

6666
public function getType(string|int $type): string {

src/Dashboards/Redis/RedisDashboard.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ public function connect(array $server): Compatibility\Redis|Compatibility\Predis
8282
}
8383

8484
if ($this->clinet === 'redis') {
85-
$redis = new Compatibility\Redis();
86-
$redis->connection($server);
85+
$redis = new Compatibility\Redis($server);
8786
} elseif ($this->clinet === 'predis') {
8887
$redis = new Compatibility\Predis($server);
8988
} else {

src/Dashboards/Redis/RedisTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ public function getAllKeys(): array {
346346

347347
$keys = array_map(static fn ($key): array => ['key' => $key], $keys_array);
348348

349-
if (Http::get('view', 'table') === 'tree') {
349+
if (Http::get('view', Config::get('list-view', 'table')) === 'tree') {
350350
return $this->keysTreeView($keys);
351351
}
352352

src/Template.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ private function initTwig(): Environment {
7171
$twig->addFunction(new TwigFunction('svg', Helpers::svg(...), ['is_safe' => ['html']]));
7272
$twig->addFunction(new TwigFunction('add_global', $this->addGlobal(...), ['is_safe' => ['html']]));
7373
$twig->addFunction(new TwigFunction('link', Http::queryString(...), ['is_safe' => ['html']]));
74-
$twig->addFunction(new TwigFunction('get', Http::get(...), ['is_safe' => ['html']]));
74+
$twig->addFunction(new TwigFunction('get', Http::get(...)));
75+
$twig->addFunction(new TwigFunction('config', Config::get(...)));
7576

7677
$twig->addFilter(new TwigFilter('space', static function (?string $value, bool $right = false): string {
7778
$right_side = $right ? $value.' ' : ' '.$value;

templates/partials/keys_list.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<div class="flex gap-3">
44
{% if treeview %}
55
<div class="flex border rounded-sm overflow-hidden border-gray-300 dark:border-gray-600 [&>.active]:text-gray-600 dark:[&>.active]:text-gray-300 [&>.active]:bg-gray-200 dark:[&>.active]:bg-gray-950">
6-
<a href="{{ link([], {'view': 'table'}) }}" title="Table view" class="{{ get('view', 'table') == 'table' ? 'active ' : '' }}flex items-center justify-center px-3 py-2 text-gray-400 dark:text-gray-500">
6+
<a href="{{ link([], {'view': 'table'}) }}" title="Table view" class="{{ get('view', config('list-view', 'table')) == 'table' ? 'active ' : '' }}flex items-center justify-center px-3 py-2 text-gray-400 dark:text-gray-500">
77
{{ svg('tableview', 18) }}
88
</a>
9-
<a href="{{ link([], {'view': 'tree'}) }}" title="Tree view" class="{{ get('view', 'table') == 'tree' ? 'active ' : '' }}flex items-center justify-center px-3 py-2 text-gray-400 dark:text-gray-500 border-l border-gray-300 dark:border-gray-600">
9+
<a href="{{ link([], {'view': 'tree'}) }}" title="Tree view" class="{{ get('view', config('list-view', 'table')) == 'tree' ? 'active ' : '' }}flex items-center justify-center px-3 py-2 text-gray-400 dark:text-gray-500 border-l border-gray-300 dark:border-gray-600">
1010
{{ svg('treeview', 18) }}
1111
</a>
1212
</div>
@@ -76,7 +76,7 @@
7676
</div>
7777
</div>
7878

79-
{% if get('view', 'table') == 'tree' %}
79+
{% if treeview and get('view', config('list-view', 'table')) == 'tree' %}
8080
{{ include('partials/tree_view.twig') }}
8181
{% else %}
8282
{{ include('partials/table_view.twig') }}

0 commit comments

Comments
 (0)