Skip to content

Commit

Permalink
added luwak empty and disabled to rekon
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhunter committed May 23, 2011
1 parent 27f6330 commit 2d66cd6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
8 changes: 4 additions & 4 deletions app/luwak-row.html.template
Expand Up @@ -2,17 +2,17 @@
<th> <th>
<em><%= Rekon.luwakUrl() %>/</em><%= file %> <em><%= Rekon.luwakUrl() %>/</em><%= file %>
</th> </th>
<td>
<a href="#/luwak/<%= file %>" class="view icon" onclick="alert('This feature is pending');return false;">View</a>
</td>
<td> <td>
<a href="<%= Rekon.luwakUrl() %>/<%= file %>" class="riak icon" target="_blank">Riak</a> <a href="<%= Rekon.luwakUrl() %>/<%= file %>" class="riak icon" target="_blank">Riak</a>
</td> </td>
<!--<td>
<a href="#/luwak/<%= file %>" class="view icon" onclick="alert('This feature is pending');return false;">View</a>
</td>
<td> <td>
<a href="#" class="edit icon" onclick="alert('This feature is pending');return false;">Edit</a> <a href="#" class="edit icon" onclick="alert('This feature is pending');return false;">Edit</a>
</td> </td>
<td> <td>
<a href="#" class="delete icon" onclick="alert('This feature is pending');return false;">Delete</a> <a href="#" class="delete icon" onclick="alert('This feature is pending');return false;">Delete</a>
</td> </td>-->
</tr> </tr>


6 changes: 3 additions & 3 deletions app/luwak.html.template
Expand Up @@ -6,15 +6,15 @@
<input id="row_search" type="text" /> <input id="row_search" type="text" />
<em class="hint">Type to filter rows</em> <em class="hint">Type to filter rows</em>
</th> </th>
<th>View</th>
<th>Riak</th> <th>Riak</th>
<!--<th>View</th>
<th>Edit</th> <th>Edit</th>
<th>Delete</th> <th>Delete</th>-->
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr class="pending"> <tr class="pending">
<td colspan='5'> <td colspan='2'>
<p class="spinner"> <p class="spinner">
<img src="spinner.gif" alt="Loading..." /> <img src="spinner.gif" alt="Loading..." />
Loading Files... <em class="hint">(This may take a minute if you have a lot)</em> Loading Files... <em class="hint">(This may take a minute if you have a lot)</em>
Expand Down
26 changes: 16 additions & 10 deletions app/rekon.js
Expand Up @@ -228,17 +228,23 @@ rekonApp = Sammy('#container', function(){
// TODO: check Luwak is enabled // TODO: check Luwak is enabled


header('Luwak', document.location.origin + "/luwak"); header('Luwak', document.location.origin + "/luwak");
context.render('luwak.html.template').appendTo('#main'); context.render('luwak.html.template').appendTo('#main').then(function(){


luwak.files(function(files) { luwak.files(function(files) {
if (files.length > 0) { if (files === null) {
fileRows = files.map(function(file){ return {file:file};}); console.log('not working');
context.renderEach('luwak-row.html.template', fileRows).replace('#files tbody').then( $('#files .pending td').html(
function() { searchable('#luwak tbody'); } '<p><b>Luwak is not enabled.</b> Please add <code>{luwak, [{enabled, true}]}</code> to your app.config.</p>');
); }
} else{ else if (files.length > 0) {
alert("Luwak is empty!"); fileRows = files.map(function(file){ return {file:file};});
} context.renderEach('luwak-row.html.template', fileRows).replace('#files tbody').then(
function() { searchable('#luwak tbody'); }
);
} else{
$('#files .pending td').html('<p>You have not added any files to luwak.</p>');
}
});
}); });
}); });


Expand Down
6 changes: 3 additions & 3 deletions app/riak.js
Expand Up @@ -1021,7 +1021,7 @@ function Luwak(client) {
* @param files Array * @param files Array
*/ */
Luwak.prototype.files = function(callback) { Luwak.prototype.files = function(callback) {
jQuery.getJSON(this.client.luwakUrl + "?keys=true", function(data){ jQuery.getJSON(this.client.luwakUrl + "?keys=true").success(
callback(data.keys); function(data){callback(data.keys);}
}); ).error(function(){ callback(null);});
}; };

0 comments on commit 2d66cd6

Please sign in to comment.