Skip to content

Commit

Permalink
Fix #11 #19
Browse files Browse the repository at this point in the history
  • Loading branch information
z-song committed Jul 10, 2019
1 parent ef2bee8 commit b8cd068
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion resources/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<td><code>{{ $key[0] }}</code></td>
<td>
@php($type = $key[1]->getPayload())
<span class="label label-{{ \Encore\Admin\RedisManager\RedisManager::$typeColor[$type] }}">{{ $type }}</span>
<span class="label label-{{ \Encore\Admin\RedisManager\RedisManager::typeColor($type) }}">{{ $type }}</span>
</td>
<td>{{ $key[2] }}</td>
<td>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
@foreach($connections[$conn] as $name => $value)
<tr>
<td width="160px">{{ $name }}</td>
<td><span class="label label-primary">{{ $value }}</span></td>
<td><span class="label label-primary">{{ is_array($value) ? json_encode($value) : $value }}</span></td>
</tr>
@endforeach
</table>
Expand Down
2 changes: 1 addition & 1 deletion src/RedisController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function index()
$connection = request('conn', 'default');

$manager = $this->manager();

//dd($manager->getConnections());
$variables = [
'conn' => $connection,
'info' => $manager->getInformation(),
Expand Down
11 changes: 11 additions & 0 deletions src/RedisManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Encore\Admin\RedisManager\DataType\Strings;
use Illuminate\Http\Request;
use Illuminate\Redis\Connections\Connection;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Redis;
use Predis\Collection\Iterator\Keyspace;
Expand Down Expand Up @@ -267,4 +268,14 @@ public function execute($command)

return $this->getConnection()->executeRaw($command);
}

/**
* @param string $type
*
* @return mixed
*/
public static function typeColor($type)
{
return Arr::get(static::$typeColor, $type, 'default');
}
}

0 comments on commit b8cd068

Please sign in to comment.