Permalink
Browse files

viewing luwak files list works!

  • Loading branch information...
1 parent 2dc7179 commit 27f6330d1f1194ad9229131c8e442de0d16df6bf @adamhunter adamhunter committed May 18, 2011
Showing with 81 additions and 4 deletions.
  1. +18 −0 app/luwak-row.html.template
  2. +27 −1 app/luwak.html.template
  3. +24 −1 app/rekon.js
  4. +12 −2 app/riak.js
@@ -0,0 +1,18 @@
+<tr>
+ <th>
+ <em><%= Rekon.luwakUrl() %>/</em><%= file %>
+ </th>
+ <td>
+ <a href="#/luwak/<%= file %>" class="view icon" onclick="alert('This feature is pending');return false;">View</a>
+ </td>
+ <td>
+ <a href="<%= Rekon.luwakUrl() %>/<%= file %>" class="riak icon" target="_blank">Riak</a>
+ </td>
+ <td>
+ <a href="#" class="edit icon" onclick="alert('This feature is pending');return false;">Edit</a>
+ </td>
+ <td>
+ <a href="#" class="delete icon" onclick="alert('This feature is pending');return false;">Delete</a>
+ </td>
+</tr>
+
@@ -1 +1,27 @@
-Luwak!
+<div id="luwak" class="screen">
+ <table id="files">
+ <thead>
+ <tr>
+ <th>
+ <input id="row_search" type="text" />
+ <em class="hint">Type to filter rows</em>
+ </th>
+ <th>View</th>
+ <th>Riak</th>
+ <th>Edit</th>
+ <th>Delete</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="pending">
+ <td colspan='5'>
+ <p class="spinner">
+ <img src="spinner.gif" alt="Loading..." />
+ Loading Files... <em class="hint">(This may take a minute if you have a lot)</em>
+ </p>
+ </tr>
+ </tbody>
+ </table>
+</div>
+
+
View
@@ -223,17 +223,40 @@ rekonApp = Sammy('#container', function(){
});
this.get('#/luwak', function(context){
+ luwak = new Luwak(Rekon.client);
+
+ // TODO: check Luwak is enabled
+
header('Luwak', document.location.origin + "/luwak");
context.render('luwak.html.template').appendTo('#main');
+
+ luwak.files(function(files) {
+ if (files.length > 0) {
+ fileRows = files.map(function(file){ return {file:file};});
+ context.renderEach('luwak-row.html.template', fileRows).replace('#files tbody').then(
+ function() { searchable('#luwak tbody'); }
+ );
+ } else{
+ alert("Luwak is empty!");
+ }
+ });
});
});
Rekon = {
client : new RiakClient(),
+ locationUrl : function() {
+ return document.location.protocol + '//' + document.location.host;
+ },
+
baseUrl : function() {
- return document.location.protocol + '//' + document.location.host + this.client.baseUrl;
+ return this.locationUrl() + this.client.baseUrl;
+ },
+
+ luwakUrl : function() {
+ return this.locationUrl() + this.client.luwakUrl;
},
riakUrl : function(append) {
View
@@ -1013,5 +1013,15 @@ function Luwak(client) {
this.client = client;
}
-
-
+/**
+ * Gets the file names for luwak, currently only uses keys=true
+ * and doesn't support streaming keys.
+ * @param callback function
+ * callback - function(keys)
+ * @param files Array
+ */
+Luwak.prototype.files = function(callback) {
+ jQuery.getJSON(this.client.luwakUrl + "?keys=true", function(data){
+ callback(data.keys);
+ });
+};

0 comments on commit 27f6330

Please sign in to comment.