Example #1
0
 public static function digestKeyspace($keys, $path)
 {
     $seps = RedisTreeModel::option('separators');
     $out = [];
     foreach ($keys as $key) {
         $key = substr($key, strlen($path));
         if (!str_contains($key, $seps)) {
             $out[] = $key;
             continue;
         }
         foreach ($seps as $separator) {
             $nodes = explode($separator, $key);
             if (!$nodes) {
                 continue;
             }
             // To make sure this isnt a sub-key with a differnt kind
             // of separator, we will test if the resulting relKey
             // has a separator value still, if so skip
             if (str_contains($nodes[0], $seps)) {
                 continue;
             }
             $out[] = $nodes[0] . $separator;
         }
     }
     sort($out);
     return array_unique($out);
 }
 public function getIndex()
 {
     // Find filter path and decode it
     $path = \Input::get('node');
     if ($path) {
         $path = hex2bin($path);
     }
     // Create escaped redis search string
     $escaped = RedisTreeModel::redisEscape($path);
     // Pull keys from redis matching search
     $keys = \Redis::keys("{$escaped}*");
     // Sort the keys
     sort($keys);
     $data = RedisTreeModel::digestKeyspace($keys, $path);
     return \view('redistree::keys.index', ['keys' => $keys, 'path' => $path, 'data' => $data, 'dirs' => RedisTreeModel::option('separators'), 'segs' => RedisTreeModel::segments($path)]);
 }
Example #3
0
                <span class="glyphicon glyphicon-folder-close" aria-hidden="true"></span>
                Keyspace Separators
            </h3>
        </div>
        <div class="panel-body">
            <div class="row">
                @foreach(\config('redistree.separators') as $sep)
                <div class="col-xs-12 col-sm-4 col-md-3 col-lg-2">
                    <button type="button" class="btn btn-default toggleSep">
                        {{ $sep }}
                    </button>
                    <input name="opts[separators][]"
                           value="{{ $sep }}"
                           type="checkbox"                            
                           <?php 
if (in_array($sep, RedisTreeModel::option('separators'))) {
    echo 'CHECKED';
}
?>
                           data-reverse>
                </div>
                @endforeach
            </div>
        </div>
        <div class="panel-footer">
            <button type="button" class="btn btn-default btn-primary">
                Save
            </button>
            @if (\Session::pull('optionsSaved'))
            <span id="spanSaved" style="margin-left: 4px;" class="label label-success">
                <span class="glyphicon glyphicon-saved" aria-hidden="true"></span>
Example #4
0
    #divRowData > div.row {
        padding-top: 6px;
        padding-bottom: 6px;
    }
    .divKeyNameCell {
        font-size: 18px;
        word-wrap: break-word;
    }
</style>
@endsection

@section('tail')
<script>

    var dangerPrompt = <?php 
echo (int) RedisTreeModel::option('danger_prompt');
?>
;

    function ajaxDeleteNode(node) {
        if (dangerPrompt === 1) {
            if (!confirm('Are you sure you want to delete this node?\n\n' + node)) {
                return false;
            }
        }
        var data = 'node=' + encodeURIComponent(node);
        sendAjax('{!! \action("$controller@postDeleteNode") !!}', data);
    }

    function ajaxDeleteKey(key) {
        if (dangerPrompt === 1) {