Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

viewing luwak files list works!

  • Loading branch information...
commit 27f6330d1f1194ad9229131c8e442de0d16df6bf 1 parent 2dc7179
Adam Hunter adamhunter authored
18 app/luwak-row.html.template
... ... @@ -0,0 +1,18 @@
  1 +<tr>
  2 + <th>
  3 + <em><%= Rekon.luwakUrl() %>/</em><%= file %>
  4 + </th>
  5 + <td>
  6 + <a href="#/luwak/<%= file %>" class="view icon" onclick="alert('This feature is pending');return false;">View</a>
  7 + </td>
  8 + <td>
  9 + <a href="<%= Rekon.luwakUrl() %>/<%= file %>" class="riak icon" target="_blank">Riak</a>
  10 + </td>
  11 + <td>
  12 + <a href="#" class="edit icon" onclick="alert('This feature is pending');return false;">Edit</a>
  13 + </td>
  14 + <td>
  15 + <a href="#" class="delete icon" onclick="alert('This feature is pending');return false;">Delete</a>
  16 + </td>
  17 +</tr>
  18 +
28 app/luwak.html.template
... ... @@ -1 +1,27 @@
1   -Luwak!
  1 +<div id="luwak" class="screen">
  2 + <table id="files">
  3 + <thead>
  4 + <tr>
  5 + <th>
  6 + <input id="row_search" type="text" />
  7 + <em class="hint">Type to filter rows</em>
  8 + </th>
  9 + <th>View</th>
  10 + <th>Riak</th>
  11 + <th>Edit</th>
  12 + <th>Delete</th>
  13 + </tr>
  14 + </thead>
  15 + <tbody>
  16 + <tr class="pending">
  17 + <td colspan='5'>
  18 + <p class="spinner">
  19 + <img src="spinner.gif" alt="Loading..." />
  20 + Loading Files... <em class="hint">(This may take a minute if you have a lot)</em>
  21 + </p>
  22 + </tr>
  23 + </tbody>
  24 + </table>
  25 +</div>
  26 +
  27 +
25 app/rekon.js
@@ -223,8 +223,23 @@ rekonApp = Sammy('#container', function(){
223 223 });
224 224
225 225 this.get('#/luwak', function(context){
  226 + luwak = new Luwak(Rekon.client);
  227 +
  228 + // TODO: check Luwak is enabled
  229 +
226 230 header('Luwak', document.location.origin + "/luwak");
227 231 context.render('luwak.html.template').appendTo('#main');
  232 +
  233 + luwak.files(function(files) {
  234 + if (files.length > 0) {
  235 + fileRows = files.map(function(file){ return {file:file};});
  236 + context.renderEach('luwak-row.html.template', fileRows).replace('#files tbody').then(
  237 + function() { searchable('#luwak tbody'); }
  238 + );
  239 + } else{
  240 + alert("Luwak is empty!");
  241 + }
  242 + });
228 243 });
229 244
230 245 });
@@ -232,8 +247,16 @@ rekonApp = Sammy('#container', function(){
232 247 Rekon = {
233 248 client : new RiakClient(),
234 249
  250 + locationUrl : function() {
  251 + return document.location.protocol + '//' + document.location.host;
  252 + },
  253 +
235 254 baseUrl : function() {
236   - return document.location.protocol + '//' + document.location.host + this.client.baseUrl;
  255 + return this.locationUrl() + this.client.baseUrl;
  256 + },
  257 +
  258 + luwakUrl : function() {
  259 + return this.locationUrl() + this.client.luwakUrl;
237 260 },
238 261
239 262 riakUrl : function(append) {
14 app/riak.js
@@ -1013,5 +1013,15 @@ function Luwak(client) {
1013 1013 this.client = client;
1014 1014 }
1015 1015
1016   -
1017   -
  1016 +/**
  1017 + * Gets the file names for luwak, currently only uses keys=true
  1018 + * and doesn't support streaming keys.
  1019 + * @param callback function
  1020 + * callback - function(keys)
  1021 + * @param files Array
  1022 + */
  1023 +Luwak.prototype.files = function(callback) {
  1024 + jQuery.getJSON(this.client.luwakUrl + "?keys=true", function(data){
  1025 + callback(data.keys);
  1026 + });
  1027 +};

0 comments on commit 27f6330

Please sign in to comment.
Something went wrong with that request. Please try again.