mirror of
https://github.com/sismics/docs.git
synced 2024-12-22 11:23:48 +01:00
More loading feedback (client)
This commit is contained in:
parent
464d43194b
commit
0bc658a396
@ -10,6 +10,7 @@ import java.util.Set;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.StringField;
|
||||
import org.apache.lucene.document.TextField;
|
||||
import org.apache.lucene.index.DirectoryReader;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.queries.TermsFilter;
|
||||
@ -171,12 +172,17 @@ public class LuceneDao {
|
||||
TermsFilter userFilter = new TermsFilter(terms);
|
||||
|
||||
// Search
|
||||
IndexSearcher searcher = new IndexSearcher(AppContext.getInstance().getIndexingService().getDirectoryReader());
|
||||
DirectoryReader directoryReader = AppContext.getInstance().getIndexingService().getDirectoryReader();
|
||||
Set<String> documentIdList = new HashSet<String>();
|
||||
if (directoryReader == null) {
|
||||
// The directory reader is not yet initialized (probably because there is nothing indexed)
|
||||
return documentIdList;
|
||||
}
|
||||
IndexSearcher searcher = new IndexSearcher(directoryReader);
|
||||
TopDocs topDocs = searcher.search(query, userFilter, Integer.MAX_VALUE);
|
||||
ScoreDoc[] docs = topDocs.scoreDocs;
|
||||
|
||||
// Extract document IDs
|
||||
Set<String> documentIdList = new HashSet<String>();
|
||||
for (int i = 0; i < docs.length; i++) {
|
||||
org.apache.lucene.document.Document document = searcher.doc(docs[i].doc);
|
||||
String type = document.get("type");
|
||||
|
@ -128,7 +128,6 @@ public class IndexingService extends AbstractScheduledService {
|
||||
public DirectoryReader getDirectoryReader() {
|
||||
if (directoryReader == null) {
|
||||
if (!DirectoryReader.indexExists(directory)) {
|
||||
log.info("Lucene directory not yet created");
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
|
@ -1 +1 @@
|
||||
- Encrypt files stored on FS (server)
|
||||
- Encrypt files stored on FS (server)
|
||||
|
@ -60,7 +60,7 @@
|
||||
<div class="navbar" ng-controller="Navigation">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<div class="brand loader" ng-class="{hide: !isLoading() }">
|
||||
<div class="brand loader hidden-phone" ng-class="{hide: !isLoading() }">
|
||||
<img src="img/loader.gif" />
|
||||
</div>
|
||||
|
||||
|
@ -1,56 +1,60 @@
|
||||
<form class="form-horizontal" name="documentForm">
|
||||
<div class="control-group" ng-class="{ error: !documentForm.title.$valid }">
|
||||
<label class="control-label" for="inputTitle">Title</label>
|
||||
<div class="controls">
|
||||
<input required ng-maxlength="100" class="input-block-level" type="text" id="inputTitle"
|
||||
placeholder="Title" name="title" ng-model="document.title" autocomplete="off"
|
||||
typeahead="document for document in getTitleTypeahead($viewValue) | filter: $viewValue"
|
||||
typeahead-wait-ms="200" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group" ng-class="{ error: !documentForm.description.$valid }">
|
||||
<label class="control-label" for="inputDescription">Description</label>
|
||||
<div class="controls">
|
||||
<textarea ng-maxlength="4000" class="input-block-level" rows="5" id="inputDescription" name="description" ng-model="document.description"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputCreateDate">Creation date</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="inputCreateDate" ng-readonly="true" datepicker-popup="yyyy-MM-dd" ng-model="document.create_date" starting-day="1" show-weeks="false" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputCreateDate">Language</label>
|
||||
<div class="controls">
|
||||
<select id="inputLanguage" ng-model="document.language">
|
||||
<option value="fra">French</option>
|
||||
<option value="eng">English</option>
|
||||
<option value="jpn">Japanese</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputFiles">New files</label>
|
||||
<div class="controls">
|
||||
<file class="input-block-level" id="inputFiles" multiple="multiple" ng-model="newFiles" accept="image/png,image/jpg,image/jpeg,image/gif,application/pdf" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputTags">Tags</label>
|
||||
<div class="controls">
|
||||
<select-tag tags="document.tags" class="input-block-level" ref="inputTags" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary" ng-disabled="!documentForm.$valid || fileIsUploading" ng-click="edit()">{{ isEdit() ? 'Edit' : 'Add' }}</button>
|
||||
<button type="submit" class="btn" ng-click="cancel()">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
<img src="img/loader.gif" ng-if="!document && isEdit()" />
|
||||
|
||||
<div class="row-fluid" ng-show="fileIsUploading">
|
||||
<h4>Uploading files...</h4>
|
||||
<div class="span6"><progress percent="fileProgress" class="progress-info active"></progress></div>
|
||||
</div>
|
||||
|
||||
<alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{ alert.msg }}</alert>
|
||||
<div ng-if="document || !isEdit()">
|
||||
<form class="form-horizontal" name="documentForm">
|
||||
<div class="control-group" ng-class="{ error: !documentForm.title.$valid }">
|
||||
<label class="control-label" for="inputTitle">Title</label>
|
||||
<div class="controls">
|
||||
<input required ng-maxlength="100" class="input-block-level" type="text" id="inputTitle"
|
||||
placeholder="Title" name="title" ng-model="document.title" autocomplete="off"
|
||||
typeahead="document for document in getTitleTypeahead($viewValue) | filter: $viewValue"
|
||||
typeahead-wait-ms="200" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group" ng-class="{ error: !documentForm.description.$valid }">
|
||||
<label class="control-label" for="inputDescription">Description</label>
|
||||
<div class="controls">
|
||||
<textarea ng-maxlength="4000" class="input-block-level" rows="5" id="inputDescription" name="description" ng-model="document.description"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputCreateDate">Creation date</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="inputCreateDate" ng-readonly="true" datepicker-popup="yyyy-MM-dd" ng-model="document.create_date" starting-day="1" show-weeks="false" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputCreateDate">Language</label>
|
||||
<div class="controls">
|
||||
<select id="inputLanguage" ng-model="document.language">
|
||||
<option value="fra">French</option>
|
||||
<option value="eng">English</option>
|
||||
<option value="jpn">Japanese</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputFiles">New files</label>
|
||||
<div class="controls">
|
||||
<file class="input-block-level" id="inputFiles" multiple="multiple" ng-model="newFiles" accept="image/png,image/jpg,image/jpeg,image/gif,application/pdf" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputTags">Tags</label>
|
||||
<div class="controls">
|
||||
<select-tag tags="document.tags" class="input-block-level" ref="inputTags" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary" ng-disabled="!documentForm.$valid || fileIsUploading" ng-click="edit()">{{ isEdit() ? 'Edit' : 'Add' }}</button>
|
||||
<button type="submit" class="btn" ng-click="cancel()">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="row-fluid" ng-show="fileIsUploading">
|
||||
<h4>Uploading files...</h4>
|
||||
<div class="span6"><progress percent="fileProgress" class="progress-info active"></progress></div>
|
||||
</div>
|
||||
|
||||
<alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{ alert.msg }}</alert>
|
||||
</div>
|
@ -1,62 +1,66 @@
|
||||
<h2 ng-show="isEdit()">Edit
|
||||
<small>"{{ user.username }}"</small>
|
||||
</h2>
|
||||
<h2 ng-show="!isEdit()">Add
|
||||
<small>user</small>
|
||||
</h2>
|
||||
<form class="form-horizontal" name="editUserForm" novalidate>
|
||||
<div class="control-group" ng-class="{ error: !editUserForm.username.$valid, success: editUserForm.username.$valid }">
|
||||
<label class="control-label" for="inputUsername">Username</label>
|
||||
<img src="img/loader.gif" ng-if="!user && isEdit()" />
|
||||
|
||||
<div class="controls">
|
||||
<input name="username" type="text" id="inputUsername" required ng-disabled="isEdit()"
|
||||
ng-minlength="3" ng-maxlength="50" placeholder="Username" ng-model="user.username"/>
|
||||
<span class="help-inline" ng-show="editUserForm.username.$error.required">Required</span>
|
||||
<span class="help-inline" ng-show="editUserForm.username.$error.minlength">Too short</span>
|
||||
<span class="help-inline" ng-show="editUserForm.username.$error.maxlength">Too long</span>
|
||||
<div ng-if="user || !isEdit()">
|
||||
<h2 ng-show="isEdit()">Edit
|
||||
<small>"{{ user.username }}"</small>
|
||||
</h2>
|
||||
<h2 ng-show="!isEdit()">Add
|
||||
<small>user</small>
|
||||
</h2>
|
||||
<form class="form-horizontal" name="editUserForm" novalidate>
|
||||
<div class="control-group" ng-class="{ error: !editUserForm.username.$valid, success: editUserForm.username.$valid }">
|
||||
<label class="control-label" for="inputUsername">Username</label>
|
||||
|
||||
<div class="controls">
|
||||
<input name="username" type="text" id="inputUsername" required ng-disabled="isEdit()"
|
||||
ng-minlength="3" ng-maxlength="50" placeholder="Username" ng-model="user.username"/>
|
||||
<span class="help-inline" ng-show="editUserForm.username.$error.required">Required</span>
|
||||
<span class="help-inline" ng-show="editUserForm.username.$error.minlength">Too short</span>
|
||||
<span class="help-inline" ng-show="editUserForm.username.$error.maxlength">Too long</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group" ng-class="{ error: !editUserForm.email.$valid, success: editUserForm.email.$valid }">
|
||||
<label class="control-label" for="inputEmail">E-mail</label>
|
||||
|
||||
<div class="controls">
|
||||
<input name="email" type="email" id="inputEmail" required
|
||||
ng-minlength="3" ng-maxlength="50" placeholder="E-mail" ng-model="user.email"/>
|
||||
<span class="help-inline" ng-show="editUserForm.email.$error.required">Required</span>
|
||||
<span class="help-inline" ng-show="editUserForm.email.$error.email">Must be a valid e-mail</span>
|
||||
<span class="help-inline" ng-show="editUserForm.email.$error.minlength">Too short</span>
|
||||
<span class="help-inline" ng-show="editUserForm.email.$error.maxlength">Too long</span>
|
||||
<div class="control-group" ng-class="{ error: !editUserForm.email.$valid, success: editUserForm.email.$valid }">
|
||||
<label class="control-label" for="inputEmail">E-mail</label>
|
||||
|
||||
<div class="controls">
|
||||
<input name="email" type="email" id="inputEmail" required
|
||||
ng-minlength="3" ng-maxlength="50" placeholder="E-mail" ng-model="user.email"/>
|
||||
<span class="help-inline" ng-show="editUserForm.email.$error.required">Required</span>
|
||||
<span class="help-inline" ng-show="editUserForm.email.$error.email">Must be a valid e-mail</span>
|
||||
<span class="help-inline" ng-show="editUserForm.email.$error.minlength">Too short</span>
|
||||
<span class="help-inline" ng-show="editUserForm.email.$error.maxlength">Too long</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group" ng-class="{ error: !editUserForm.password.$valid, success: editUserForm.password.$valid }">
|
||||
<label class="control-label" for="inputPassword">Password</label>
|
||||
|
||||
<div class="controls">
|
||||
<input name="password" type="password" id="inputPassword" ng-required="!isEdit()"
|
||||
ng-minlength="8" ng-maxlength="50" placeholder="Password" ng-model="user.password"/>
|
||||
<span class="help-inline" ng-show="editUserForm.password.$error.required">Required</span>
|
||||
<span class="help-inline" ng-show="editUserForm.password.$error.minlength">Too short</span>
|
||||
<span class="help-inline" ng-show="editUserForm.password.$error.maxlength">Too long</span>
|
||||
<div class="control-group" ng-class="{ error: !editUserForm.password.$valid, success: editUserForm.password.$valid }">
|
||||
<label class="control-label" for="inputPassword">Password</label>
|
||||
|
||||
<div class="controls">
|
||||
<input name="password" type="password" id="inputPassword" ng-required="!isEdit()"
|
||||
ng-minlength="8" ng-maxlength="50" placeholder="Password" ng-model="user.password"/>
|
||||
<span class="help-inline" ng-show="editUserForm.password.$error.required">Required</span>
|
||||
<span class="help-inline" ng-show="editUserForm.password.$error.minlength">Too short</span>
|
||||
<span class="help-inline" ng-show="editUserForm.password.$error.maxlength">Too long</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group"
|
||||
ng-class="{ error: !editUserForm.passwordconfirm.$valid, success: editUserForm.passwordconfirm.$valid }">
|
||||
<label class="control-label" for="inputPasswordConfirm">Password (confirm)</label>
|
||||
|
||||
<div class="controls">
|
||||
<input name="passwordconfirm" type="password" id="inputPasswordConfirm" ng-required="!isEdit()"
|
||||
ui-validate="'$value == user.password'" ui-validate-watch="'user.password'"
|
||||
placeholder="Password (confirm)" ng-model="user.passwordconfirm"/>
|
||||
<span class="help-inline" ng-show="editUserForm.passwordconfirm.$error.validator">Password and password confirmation must match</span>
|
||||
<div class="control-group"
|
||||
ng-class="{ error: !editUserForm.passwordconfirm.$valid, success: editUserForm.passwordconfirm.$valid }">
|
||||
<label class="control-label" for="inputPasswordConfirm">Password (confirm)</label>
|
||||
|
||||
<div class="controls">
|
||||
<input name="passwordconfirm" type="password" id="inputPasswordConfirm" ng-required="!isEdit()"
|
||||
ui-validate="'$value == user.password'" ui-validate-watch="'user.password'"
|
||||
placeholder="Password (confirm)" ng-model="user.passwordconfirm"/>
|
||||
<span class="help-inline" ng-show="editUserForm.passwordconfirm.$error.validator">Password and password confirmation must match</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary" ng-click="edit()" ng-disabled="!editUserForm.$valid">
|
||||
<span class="icon-pencil icon-white"></span> {{ isEdit() ? 'Edit' : 'Add' }}
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger" ng-click="remove()" ng-show="isEdit()">
|
||||
<span class="icon-trash icon-white"></span> Delete
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{ alert.msg }}</alert>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary" ng-click="edit()" ng-disabled="!editUserForm.$valid">
|
||||
<span class="icon-pencil icon-white"></span> {{ isEdit() ? 'Edit' : 'Add' }}
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger" ng-click="remove()" ng-show="isEdit()">
|
||||
<span class="icon-trash icon-white"></span> Delete
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{ alert.msg }}</alert>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user