Skip to content

Commit 24bbba4

Browse files
committed
Keys table fixes
1 parent 8292174 commit 24bbba4

File tree

19 files changed

+141
-200
lines changed

19 files changed

+141
-200
lines changed

assets/css/styles.css

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,8 @@ video {
634634
max-width: 100%;
635635
}
636636

637-
.max-w-md {
638-
max-width: 28rem;
637+
.max-w-lg {
638+
max-width: 32rem;
639639
}
640640

641641
.max-w-xs {
@@ -1558,6 +1558,10 @@ video {
15581558
display: grid;
15591559
}
15601560

1561+
.md\:w-72 {
1562+
width: 18rem;
1563+
}
1564+
15611565
.md\:min-w-\[35rem\] {
15621566
min-width: 35rem;
15631567
}
@@ -1596,37 +1600,17 @@ video {
15961600
}
15971601

15981602
@media (min-width: 1024px) {
1599-
.lg\:mb-0 {
1600-
margin-bottom: 0px;
1601-
}
1602-
16031603
.lg\:flex {
16041604
display: flex;
16051605
}
16061606

1607-
.lg\:grid {
1608-
display: grid;
1609-
}
1610-
1611-
.lg\:grid-cols-2 {
1612-
grid-template-columns: repeat(2, minmax(0, 1fr));
1613-
}
1614-
16151607
.lg\:items-center {
16161608
align-items: center;
16171609
}
16181610

1619-
.lg\:justify-end {
1620-
justify-content: flex-end;
1621-
}
1622-
16231611
.lg\:gap-2 {
16241612
gap: 0.5rem;
16251613
}
1626-
1627-
.lg\:gap-4 {
1628-
gap: 1rem;
1629-
}
16301614
}
16311615

16321616
.\[\&\:last-child\>\*\]\:border-b-0:last-child>* {

assets/js/scripts.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ if (delete_all) {
114114
keys.forEach(key => {
115115
key.remove();
116116
});
117+
118+
document.getElementById('table-no-keys').classList.remove('hidden');
117119
}
118120
});
119121
});

src/Dashboards/APCu/APCuTrait.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static function (string $key, string $value, int $ttl): bool {
224224
);
225225
}
226226

227-
if (isset($_POST['export_btn'])) {
227+
if (isset($_GET['export_btn'])) {
228228
Helpers::export($keys, 'apcu_backup', static fn (string $key): string => base64_encode(serialize(apcu_fetch($key))));
229229
}
230230

@@ -233,11 +233,10 @@ static function (string $key, string $value, int $ttl): bool {
233233
$info = apcu_cache_info(true);
234234

235235
return $this->template->render('dashboards/apcu', [
236-
'keys' => $paginator->getPaginated(),
237-
'all_keys' => (int) $info['num_entries'],
238-
'new_key_url' => Http::queryString([], ['form' => 'new']),
239-
'paginator' => $paginator->render(),
240-
'view_key' => Http::queryString([], ['view' => 'key', 'key' => '__key__']),
236+
'keys' => $paginator->getPaginated(),
237+
'all_keys' => (int) $info['num_entries'],
238+
'paginator' => $paginator->render(),
239+
'view_key' => Http::queryString([], ['view' => 'key', 'key' => '__key__']),
241240
]);
242241
}
243242
}

src/Dashboards/Memcached/MemcachedTrait.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,18 +247,17 @@ private function mainDashboard(): string {
247247
);
248248
}
249249

250-
if (isset($_POST['export_btn'])) {
250+
if (isset($_GET['export_btn'])) {
251251
Helpers::export($keys, 'memcached_backup', fn (string $key): string => base64_encode($this->memcached->getKey($key)));
252252
}
253253

254254
$paginator = new Paginator($this->template, $keys);
255255

256256
return $this->template->render('dashboards/memcached', [
257-
'keys' => $paginator->getPaginated(),
258-
'all_keys' => count($this->all_keys),
259-
'new_key_url' => Http::queryString([], ['form' => 'new']),
260-
'paginator' => $paginator->render(),
261-
'view_key' => Http::queryString([], ['view' => 'key', 'key' => '__key__']),
257+
'keys' => $paginator->getPaginated(),
258+
'all_keys' => count($this->all_keys),
259+
'paginator' => $paginator->render(),
260+
'view_key' => Http::queryString([], ['view' => 'key', 'key' => '__key__']),
262261
]);
263262
}
264263
}

src/Dashboards/OPCache/OPCacheTrait.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,13 @@ private function getCachedScripts(): array {
156156
private function mainDashboard(): string {
157157
$cached_scripts = $this->getCachedScripts();
158158
$paginator = new Paginator($this->template, $cached_scripts, [['ignore', 'pp', 's'], ['p' => '']]);
159-
$is_ignored = isset($_GET['ignore']) && $_GET['ignore'] === 'yes';
160159
$status = opcache_get_status(false);
161160

162161
return $this->template->render('dashboards/opcache', [
163162
'cached_scripts' => $paginator->getPaginated(),
164-
'all_files' => $status['opcache_statistics']['num_cached_scripts'],
163+
'all_keys' => $status['opcache_statistics']['num_cached_scripts'],
165164
'paginator' => $paginator->render(),
166-
'ignore_url' => Http::queryString(['pp', 'p'], ['ignore' => $is_ignored ? 'no' : 'yes']),
167-
'is_ignored' => $is_ignored,
165+
'is_ignored' => isset($_GET['ignore']) && $_GET['ignore'] === 'yes',
168166
]);
169167
}
170168
}

src/Dashboards/Redis/RedisTrait.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -429,18 +429,17 @@ function (string $key, string $value, int $ttl): bool {
429429
);
430430
}
431431

432-
if (isset($_POST['export_btn'])) {
432+
if (isset($_GET['export_btn'])) {
433433
Helpers::export($keys, 'redis_backup', fn (string $key): string => bin2hex($this->redis->dump($key)));
434434
}
435435

436436
$paginator = new Paginator($this->template, $keys, [['db', 's', 'pp'], ['p' => '']]);
437437

438438
return $this->template->render('dashboards/redis/redis', [
439-
'keys' => $paginator->getPaginated(),
440-
'all_keys' => $this->redis->dbSize(),
441-
'new_key_url' => Http::queryString(['db'], ['form' => 'new']),
442-
'paginator' => $paginator->render(),
443-
'view_key' => Http::queryString(['db', 's'], ['view' => 'key', 'key' => '__key__']),
439+
'keys' => $paginator->getPaginated(),
440+
'all_keys' => $this->redis->dbSize(),
441+
'paginator' => $paginator->render(),
442+
'view_key' => Http::queryString(['db', 's'], ['view' => 'key', 'key' => '__key__']),
444443
]);
445444
}
446445
}

src/Http.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static function stopRedirect(): void {
2222
* @param array<int|string, int|string> $additional Additional parameters with their new value.
2323
*/
2424
public static function queryString(array $preserve = [], array $additional = []): string {
25-
$keep = ['dashboard', 'server', 's', 'sortdir', 'sortcol'];
25+
$keep = ['dashboard', 'server', 'db', 's', 'sortdir', 'sortcol'];
2626
$preserve = array_flip(array_merge($keep, $preserve));
2727
$query = [];
2828

src/Template.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ private function initTwig(): Environment {
7070

7171
$twig->addFunction(new TwigFunction('svg', Helpers::svg(...), ['is_safe' => ['html']]));
7272
$twig->addFunction(new TwigFunction('add_global', $this->addGlobal(...), ['is_safe' => ['html']]));
73+
$twig->addFunction(new TwigFunction('link', Http::queryString(...), ['is_safe' => ['html']]));
7374

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

templates/components/alert.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{% set alert_color = 'bg-red-500' %}
55
{% endif %}
66

7-
<div class="py-3 px-4 flex items-center rounded {{ alert_color ? alert_color : 'bg-indigo-500' }} shadow-lg fixed top-5 right-5 z-50 max-w-md">
7+
<div class="py-3 px-4 flex items-center rounded {{ alert_color ? alert_color : 'bg-indigo-500' }} shadow-lg fixed top-5 right-5 z-50 max-w-lg">
88
<div class="mr-3 text-white break-all">{{ message|raw }}</div>
99
<button type="button" class="close text-white hover:opacity-75" onclick="this.parentElement.remove();">
1010
{{ svg('close', 13) }}

templates/components/button.twig

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
{% set btn_color = 'bg-primary-500 hover:bg-primary-600 focus:ring-primary-200 disabled:bg-primary-300 dark:bg-primary-700 dark:hover:bg-primary-800 dark:focus:ring-primary-400 dark:disabled:bg-primary-400' %}
77
{% endif %}
88

9-
{% set classes = 'inline-flex items-center border border-transparent rounded py-1.5 px-3 text-base font-semibold text-white align-middle shadow focus:ring dark:text-white ' ~ btn_color %}
9+
{% set size = small ? 'text-sm' : 'text-base' %}
10+
{% set icon_size = small ? 12 : 16 %}
11+
12+
{% set classes = size ~ ' inline-flex items-center border border-transparent rounded py-1.5 px-3 font-semibold text-white align-middle shadow focus:ring dark:text-white ' ~ btn_color %}
1013

1114
{% if link %}
1215
<a href="{{ link }}" class="{{ classes ~ class|space }}">
1316
{% if icon %}
14-
{{ svg(icon, 16, (text ? 'mr-1' : '')) }}
17+
{{ svg(icon, icon_size, (text ? 'mr-1' : '')) }}
1518
{% endif %}
1619
{{ text }}
1720
</a>
@@ -26,11 +29,11 @@
2629
{% endfor %}
2730
{% endmacro %}
2831

29-
{% set id = id is not empty ? 'id="'~id~'" name="'~id~'" ' : '' %}
32+
{% set id = id is not empty ? 'id="' ~ id ~ '" name="' ~ id ~ '" ' : '' %}
3033

3134
<button type="{{ submit ? 'submit' : 'button' }}" {{ id|raw }}class="{{ classes ~ class|space }}"{{ _self.attr(attributes) }}>
3235
{% if icon %}
33-
{{ svg(icon, 16, (text ? 'mr-1' : '')) }}
36+
{{ svg(icon, icon_size, (text ? 'mr-1' : '')) }}
3437
{% endif %}
3538
{{ text }}
3639
</button>

0 commit comments

Comments
 (0)