Skip to content

Commit b8cd068

Browse files
committed
Fix #11 #19
1 parent ef2bee8 commit b8cd068

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

resources/views/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<td><code>{{ $key[0] }}</code></td>
7676
<td>
7777
@php($type = $key[1]->getPayload())
78-
<span class="label label-{{ \Encore\Admin\RedisManager\RedisManager::$typeColor[$type] }}">{{ $type }}</span>
78+
<span class="label label-{{ \Encore\Admin\RedisManager\RedisManager::typeColor($type) }}">{{ $type }}</span>
7979
</td>
8080
<td>{{ $key[2] }}</td>
8181
<td>

resources/views/layout.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
@foreach($connections[$conn] as $name => $value)
4545
<tr>
4646
<td width="160px">{{ $name }}</td>
47-
<td><span class="label label-primary">{{ $value }}</span></td>
47+
<td><span class="label label-primary">{{ is_array($value) ? json_encode($value) : $value }}</span></td>
4848
</tr>
4949
@endforeach
5050
</table>

src/RedisController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function index()
2525
$connection = request('conn', 'default');
2626

2727
$manager = $this->manager();
28-
28+
//dd($manager->getConnections());
2929
$variables = [
3030
'conn' => $connection,
3131
'info' => $manager->getInformation(),

src/RedisManager.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Encore\Admin\RedisManager\DataType\Strings;
1212
use Illuminate\Http\Request;
1313
use Illuminate\Redis\Connections\Connection;
14+
use Illuminate\Support\Arr;
1415
use Illuminate\Support\Collection;
1516
use Illuminate\Support\Facades\Redis;
1617
use Predis\Collection\Iterator\Keyspace;
@@ -267,4 +268,14 @@ public function execute($command)
267268

268269
return $this->getConnection()->executeRaw($command);
269270
}
271+
272+
/**
273+
* @param string $type
274+
*
275+
* @return mixed
276+
*/
277+
public static function typeColor($type)
278+
{
279+
return Arr::get(static::$typeColor, $type, 'default');
280+
}
270281
}

0 commit comments

Comments
 (0)