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>
<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="#/luwak/<%= file %>" class="view icon" onclick="alert('This feature is pending');return false;">View</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>
</td>-->
</tr>

6 changes: 3 additions & 3 deletions app/luwak.html.template
Expand Up @@ -6,15 +6,15 @@
<input id="row_search" type="text" />
<em class="hint">Type to filter rows</em>
</th>
<th>View</th>
<th>Riak</th>
<!--<th>View</th>
<th>Edit</th>
<th>Delete</th>
<th>Delete</th>-->
</tr>
</thead>
<tbody>
<tr class="pending">
<td colspan='5'>
<td colspan='2'>
<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>
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

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) {
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!");
}
luwak.files(function(files) {
if (files === null) {
console.log('not working');
$('#files .pending td').html(
'<p><b>Luwak is not enabled.</b> Please add <code>{luwak, [{enabled, true}]}</code> to your app.config.</p>');
}
else 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{
$('#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
*/
Luwak.prototype.files = function(callback) {
jQuery.getJSON(this.client.luwakUrl + "?keys=true", function(data){
callback(data.keys);
});
jQuery.getJSON(this.client.luwakUrl + "?keys=true").success(
function(data){callback(data.keys);}
).error(function(){ callback(null);});
};

0 comments on commit 2d66cd6

Please sign in to comment.