-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bac830c
Showing
29 changed files
with
2,696 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.DS_Store | ||
phpunit.phar | ||
/vendor | ||
composer.phar | ||
composer.lock | ||
*.project | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Jens Segers | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Redis manager for laravel-admin | ||
======================== | ||
|
||
[![StyleCI](https://styleci.io/repos/97667375/shield?branch=master)](https://styleci.io/repos/97667375) | ||
[![Packagist](https://img.shields.io/packagist/l/laravel-admin-ext/redis-manager.svg?maxAge=2592000)](https://packagist.org/packages/laravel-admin-ext/redis-manager) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/laravel-admin-ext/redis-manager.svg?style=flat-square)](https://packagist.org/packages/laravel-admin-ext/redis-manager) | ||
[![Pull request welcome](https://img.shields.io/badge/pr-welcome-green.svg?style=flat-square)]() | ||
|
||
## Screenshot | ||
|
||
![wx20180413-100502](https://user-images.githubusercontent.com/1479100/38713113-23d561a2-3f02-11e8-9a24-9ecba5f1ea17.png) | ||
|
||
## Installation | ||
|
||
``` | ||
$ composer require laravel-admin-ext/redis-manager | ||
$ php artisan admin:import redis-manager | ||
``` | ||
|
||
Open `http://your-host/admin/redis` in your browser. | ||
|
||
License | ||
------------ | ||
Licensed under [The MIT License (MIT)](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "laravel-admin-ext/redis-manager", | ||
"description": "Redis manager for laravel-admin", | ||
"type": "library", | ||
"keywords": ["laravel-admin", "redis", "manager"], | ||
"homepage": "https://github.com/laravel-admin-extensions/redis-manager", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "z-song", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=7.0.0", | ||
"laravel/framework": "5.5.*", | ||
"encore/laravel-admin": "1.5.*", | ||
"predis/predis": "~1.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "~6.0", | ||
"laravel/laravel": "5.*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Encore\\Admin\\RedisManager\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Encore\\Admin\\RedisManager\\RedisManagerServiceProvider" | ||
] | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
@extends('laravel-admin-redis-manager::layout') | ||
|
||
@section('page') | ||
|
||
<script> Sfdump = window.Sfdump || (function (doc) { var refStyle = doc.createElement('style'), rxEsc = /([.*+?^${}()|\[\]\/\\])/g, idRx = /\bsf-dump-\d+-ref[012]\w+\b/, keyHint = 0 <= navigator.platform.toUpperCase().indexOf('MAC') ? 'Cmd' : 'Ctrl', addEventListener = function (e, n, cb) { e.addEventListener(n, cb, false); }; (doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle); if (!doc.addEventListener) { addEventListener = function (element, eventName, callback) { element.attachEvent('on' + eventName, function (e) { e.preventDefault = function () {e.returnValue = false;}; e.target = e.srcElement; callback(e); }); }; } function toggle(a, recursive) { var s = a.nextSibling || {}, oldClass = s.className, arrow, newClass; if ('sf-dump-compact' == oldClass) { arrow = '▼'; newClass = 'sf-dump-expanded'; } else if ('sf-dump-expanded' == oldClass) { arrow = '▶'; newClass = 'sf-dump-compact'; } else { return false; } a.lastChild.innerHTML = arrow; s.className = newClass; if (recursive) { try { a = s.querySelectorAll('.'+oldClass); for (s = 0; s < a.length; ++s) { if (a[s].className !== newClass) { a[s].className = newClass; a[s].previousSibling.lastChild.innerHTML = arrow; } } } catch (e) { } } return true; }; return function (root) { root = doc.getElementById(root); function a(e, f) { addEventListener(root, e, function (e) { if ('A' == e.target.tagName) { f(e.target, e); } else if ('A' == e.target.parentNode.tagName) { f(e.target.parentNode, e); } }); }; function isCtrlKey(e) { return e.ctrlKey || e.metaKey; } addEventListener(root, 'mouseover', function (e) { if ('' != refStyle.innerHTML) { refStyle.innerHTML = ''; } }); a('mouseover', function (a) { if (a = idRx.exec(a.className)) { try { refStyle.innerHTML = 'pre.sf-dump .'+a[0]+'{background-color: #B729D9; color: #FFF !important; border-radius: 2px}'; } catch (e) { } } }); a('click', function (a, e) { if (/\bsf-dump-toggle\b/.test(a.className)) { e.preventDefault(); if (!toggle(a, isCtrlKey(e))) { var r = doc.getElementById(a.getAttribute('href').substr(1)), s = r.previousSibling, f = r.parentNode, t = a.parentNode; t.replaceChild(r, a); f.replaceChild(a, s); t.insertBefore(s, r); f = f.firstChild.nodeValue.match(indentRx); t = t.firstChild.nodeValue.match(indentRx); if (f && t && f[0] !== t[0]) { r.innerHTML = r.innerHTML.replace(new RegExp('^'+f[0].replace(rxEsc, '\\$1'), 'mg'), t[0]); } if ('sf-dump-compact' == r.className) { toggle(s, isCtrlKey(e)); } } if (doc.getSelection) { try { doc.getSelection().removeAllRanges(); } catch (e) { doc.getSelection().empty(); } } else { doc.selection.empty(); } } }); var indentRx = new RegExp('^('+(root.getAttribute('data-indent-pad') || ' ').replace(rxEsc, '\\$1')+')+', 'm'), elt = root.getElementsByTagName('A'), len = elt.length, i = 0, t = []; while (i < len) t.push(elt[i++]); elt = root.getElementsByTagName('SAMP'); len = elt.length; i = 0; while (i < len) t.push(elt[i++]); root = t; len = t.length; i = t = 0; while (i < len) { elt = root[i]; if ("SAMP" == elt.tagName) { elt.className = "sf-dump-expanded"; a = elt.previousSibling || {}; if ('A' != a.tagName) { a = doc.createElement('A'); a.className = 'sf-dump-ref'; elt.parentNode.insertBefore(a, elt); } else { a.innerHTML += ' '; } a.title = (a.title ? a.title+'\n[' : '[')+keyHint+'+click] Expand all children'; a.innerHTML += '<span>▼</span>'; a.className += ' sf-dump-toggle'; if ('sf-dump' != elt.parentNode.className) { toggle(a); } } else if ("sf-dump-ref" == elt.className && (a = elt.getAttribute('href'))) { a = a.substr(1); elt.className += ' '+a; if (/[\[{]$/.test(elt.previousSibling.nodeValue)) { a = a != elt.nextSibling.id && doc.getElementById(a); try { t = a.nextSibling; elt.appendChild(a); t.parentNode.insertBefore(a, t); if (/^[@#]/.test(elt.innerHTML)) { elt.innerHTML += ' <span>▶</span>'; } else { elt.innerHTML = '<span>▶</span>'; elt.className = 'sf-dump-ref'; } elt.className += ' sf-dump-toggle'; } catch (e) { if ('&' == elt.innerHTML.charAt(0)) { elt.innerHTML = '…'; elt.className = 'sf-dump-ref'; } } } } ++i; } }; })(document); </script><style> pre.sf-dump { display: block; white-space: pre; padding: 5px; } pre.sf-dump span { display: inline; } pre.sf-dump .sf-dump-compact { display: none; } pre.sf-dump abbr { text-decoration: none; border: none; cursor: help; } pre.sf-dump a { text-decoration: none; cursor: pointer; border: 0; outline: none; }pre.sf-dump{ color:#FF8400; line-height:1.2em; font:12px Menlo, Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; word-break: normal}pre.sf-dump .sf-dump-num{font-weight:bold; color:#1299DA}pre.sf-dump .sf-dump-const{font-weight:bold}pre.sf-dump .sf-dump-str{font-weight:bold; color:#56DB3A}pre.sf-dump .sf-dump-note{color:#1299DA}pre.sf-dump .sf-dump-ref{color:#A0A0A0}pre.sf-dump .sf-dump-public{color:#FFFFFF}pre.sf-dump .sf-dump-protected{color:#FFFFFF}pre.sf-dump .sf-dump-private{color:#FFFFFF}pre.sf-dump .sf-dump-meta{color:#B729D9}pre.sf-dump .sf-dump-key{color:#56DB3A}pre.sf-dump .sf-dump-index{color:#1299DA}</style> | ||
|
||
<script> | ||
$(function () { | ||
$('#console-box').slimScroll({ | ||
height: $('#pjax-container').height() - 205 +'px' | ||
}); | ||
var storageKey = function () { | ||
return 'redis-history' | ||
}; | ||
function History () { | ||
this.index = this.count() - 1; | ||
} | ||
History.prototype.store = function () { | ||
var history = localStorage.getItem(storageKey()); | ||
if (!history) { | ||
history = []; | ||
} else { | ||
history = JSON.parse(history); | ||
} | ||
return history; | ||
}; | ||
History.prototype.push = function (record) { | ||
var history = this.store(); | ||
history.push(record); | ||
localStorage.setItem(storageKey(), JSON.stringify(history)); | ||
this.index = this.count() - 1; | ||
}; | ||
History.prototype.count = function () { | ||
return this.store().length; | ||
}; | ||
History.prototype.up = function () { | ||
if (this.index > 0) { | ||
this.index--; | ||
} | ||
return this.store()[this.index]; | ||
}; | ||
History.prototype.down = function () { | ||
if (this.index < this.count() - 1) { | ||
this.index++; | ||
} | ||
return this.store()[this.index]; | ||
}; | ||
History.prototype.clear = function () { | ||
localStorage.removeItem(storageKey()); | ||
}; | ||
var history = new History; | ||
var send = function () { | ||
var $input = $('#console-query'); | ||
$.ajax({ | ||
url: '{{ route('redis-execute', ['conn' => $conn]) }}', | ||
method: 'post', | ||
data: { | ||
conn: '{{ $conn }}', | ||
command: $input.val(), | ||
_token: LA.token | ||
}, | ||
success: function (response) { | ||
history.push($input.val()); | ||
$('#console-box') | ||
.append('<div class="item"><small class="label label-default">'+$('#connections').val()+'> '+$input.val()+'<\/small><\/div>') | ||
.append('<div class="item">'+response+'<\/div>') | ||
.slimScroll({ scrollTo: $("#console-box")[0].scrollHeight }); | ||
$input.val(''); | ||
} | ||
}); | ||
}; | ||
$('#console-query').on('keyup', function (e) { | ||
if (e.keyCode == 13 && $(this).val()) { | ||
send(); | ||
} | ||
if (e.keyCode == 38) { | ||
$(this).val(history.up()); | ||
} | ||
if (e.keyCode == 40) { | ||
$(this).val(history.down()); | ||
} | ||
}); | ||
$('#console-send').click(function () { | ||
send(); | ||
}); | ||
$('#console-clear').click(function () { | ||
$('#console-box').text(''); | ||
}); | ||
}); | ||
</script> | ||
|
||
<div class="box box-primary"> | ||
<div class="box-header with-border"> | ||
<h3 class="box-title">Redis Console</h3> <small></small> | ||
</div> | ||
|
||
<div class="box-body chat" id="console-box"></div> | ||
|
||
<div class="box-footer with-border"> | ||
<div class="input-group"> | ||
|
||
<input class="form-control input-lg" id="console-query" placeholder="Type command"> | ||
|
||
<div class="input-group-btn"> | ||
<button type="button" class="btn btn-primary btn-lg" id="console-send"><i class="fa fa-paper-plane"></i></button> | ||
</div> | ||
|
||
<div class="input-group-btn"> | ||
<button type="button" class="btn btn-warning btn-lg" id="console-clear"><i class="fa fa-trash"></i></button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
<!-- /.box-body --> | ||
|
||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
@extends('laravel-admin-redis-manager::layout') | ||
|
||
@section('page') | ||
|
||
<div class="box box-primary"> | ||
<div class="box-header with-border"> | ||
<h3 class="box-title">Edit</h3> <small></small> | ||
</div> | ||
|
||
|
||
<form class="form-horizontal" method="post" action="{{ route('redis-store-key') }}" pjax-container> | ||
|
||
<div class="box-body"> | ||
|
||
<div class="form-group"> | ||
<label for="inputKey" class="col-sm-2 control-label">Key</label> | ||
|
||
<div class="col-sm-10"> | ||
<input type="text" class="form-control" id="inputKey" placeholder="key" name="key"> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="inputExpire" class="col-sm-2 control-label">Expires</label> | ||
|
||
<div class="col-sm-10"> | ||
<input type="number" class="form-control" name="ttl" id="inputExpire" value="-1"> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label class="col-sm-2 control-label">Field</label> | ||
|
||
<div class="col-sm-10"> | ||
<input class="form-control" name="field"> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label class="col-sm-2 control-label">Value</label> | ||
|
||
<div class="col-sm-10"> | ||
<input class="form-control" name="value"> | ||
</div> | ||
</div> | ||
|
||
{{ csrf_field() }} | ||
<input type="hidden" name="conn" value="{{ $conn }}"> | ||
<input type="hidden" name="type" value="hash"> | ||
</div> | ||
|
||
<div class="box-footer"> | ||
<button type="reset" class="btn btn-default pull-right">Reset</button> | ||
<button class="btn btn-info col-sm-offset-2">Submit</button> | ||
</div> | ||
|
||
</form> | ||
|
||
</div> | ||
<!-- /.box-body --> | ||
|
||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
@extends('laravel-admin-redis-manager::layout') | ||
|
||
@section('page') | ||
|
||
<div class="box box-primary"> | ||
<div class="box-header with-border"> | ||
<h3 class="box-title">Edit</h3> <small></small> | ||
</div> | ||
|
||
|
||
<form class="form-horizontal" method="post" action="{{ route('redis-store-key') }}" pjax-container> | ||
|
||
<div class="box-body"> | ||
|
||
<div class="form-group"> | ||
<label for="inputKey" class="col-sm-2 control-label">Key</label> | ||
|
||
<div class="col-sm-10"> | ||
<input type="text" class="form-control" id="inputKey" placeholder="key" name="key"> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="inputExpire" class="col-sm-2 control-label">Expires</label> | ||
|
||
<div class="col-sm-10"> | ||
<input type="number" class="form-control" id="inputExpire" value="-1" name="ttl"> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="inputItem" class="col-sm-2 control-label">Item</label> | ||
|
||
<div class="col-sm-10"> | ||
<input type="text" class="form-control" name="item" id="inputItem"> | ||
</div> | ||
</div> | ||
|
||
{{ csrf_field() }} | ||
<input type="hidden" name="conn" value="{{ $conn }}"> | ||
<input type="hidden" name="type" value="list"> | ||
</div> | ||
|
||
<div class="box-footer"> | ||
<button type="reset" class="btn btn-default pull-right">Reset</button> | ||
<button class="btn btn-info col-sm-offset-2">Submit</button> | ||
</div> | ||
|
||
</form> | ||
|
||
</div> | ||
<!-- /.box-body --> | ||
|
||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@extends('laravel-admin-redis-manager::layout') | ||
|
||
@section('page') | ||
|
||
<div class="alert alert-warning alert-dismissible"> | ||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> | ||
<h4><i class="icon fa fa-warning"></i>Key [{{ request('key') }}] not exists.</h4> | ||
|
||
</div> | ||
<!-- /.box-body --> | ||
|
||
@endsection |
Oops, something went wrong.