Skip to content

Commit

Permalink
Add validation
Browse files Browse the repository at this point in the history
  • Loading branch information
kinow committed Jan 26, 2019
1 parent 4f983d9 commit 6956f75
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions annif/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ <h2>REST API</h2>
<div id="app">
<template v-if="errors.length">
<b>Please correct the following error(s):</b>
<ul>
<li v-for="error in errors"><% error %></li>
</ul>
<div class="alert alert-warning" role="alert" v-for="error in errors"><% error %></div>
</template>
<div class="row mb-5">
<div class="col-md-8">
Expand Down Expand Up @@ -165,14 +163,19 @@ <h2 class="mt-4">Results</h2>\
// TBD: replace once using shared data (state pattern, or vuex)
if (data.results.length === 0) {
$('#results').append(
$("<p>No results returned</p>")
$('<div class="alert alert-warning" role="alert">No results returned</div>')
);
return;
}
for (var i = 0; i < data.results.length; i++) {
var result = data.results[i];
this_.results.push(result);
}
},
error: function() {
$('#results').append(
$('<div class="alert alert-danger" role="alert">Server returned error when analyzing data</div>')
);
}
});
}
Expand Down

0 comments on commit 6956f75

Please sign in to comment.