Commit 374612c4 authored by Romain Loth's avatar Romain Loth

[FEAT] annotation view is showing document text even if the workflow is not finished

parent 1f7ddfe6
...@@ -23,25 +23,34 @@ ...@@ -23,25 +23,34 @@
$rootScope.docId = data.id; $rootScope.docId = data.id;
$rootScope.full_text = data.full_text; $rootScope.full_text = data.full_text;
$rootScope.abstract_text = data.abstract_text; $rootScope.abstract_text = data.abstract_text;
console.log("annotations.document.DocController.getannotations") $rootScope.workflow_finished = data.corpus_status['complete'] ;
// GET the annotationss
NgramListHttpService.get( console.log("workflow status", $rootScope.workflow_finished)
{
'corpusId': $rootScope.corpusId, if ($scope.workflow_finished) {
'docId': $rootScope.docId console.log("annotations.document.DocController.getannotations")
}, // GET the annotationss
function(data) { NgramListHttpService.get(
$rootScope.annotations = data[$rootScope.corpusId.toString()][$rootScope.docId.toString()]; {
// eg id => 'MAPLIST' 'corpusId': $rootScope.corpusId,
$rootScope.lists = data[$rootScope.corpusId.toString()].lists; 'docId': $rootScope.docId
// inverted 'MAPLIST' => id },
$rootScope.listIds = _.invert($rootScope.lists) function(data) {
$scope.dataLoading = false ; $rootScope.annotations = data[$rootScope.corpusId.toString()][$rootScope.docId.toString()];
}, // eg id => 'MAPLIST'
function(data) { $rootScope.lists = data[$rootScope.corpusId.toString()].lists;
console.error("unable to get the list of ngrams"); // inverted 'MAPLIST' => id
} $rootScope.listIds = _.invert($rootScope.lists)
); $scope.dataLoading = false ;
},
function(data) {
console.error("unable to get the list of ngrams");
}
);
}
else {
$scope.dataLoading = false ;
}
}); });
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<div id="annotationsApp" ng-cloak> <div id="annotationsApp" ng-cloak>
<div class="container-fluid"> <div class="container-fluid">
<div class="row-fluid main-panel" ng-controller="NGramHighlightController"> <div class="row-fluid main-panel" ng-controller="NGramHighlightController">
<div class="col-md-4 col-xs-4 tabbable words-panel"> <div ng-if="workflow_finished" class="col-md-4 col-xs-4 tabbable words-panel">
<div class="list-selector"> <div class="list-selector">
<h5>Select highlighted list(s) <h5>Select highlighted list(s)
<select class="selectpicker" multiple ng-change="activeListsChange()" ng-model="lists" ng-controller="ActiveListsController"> <select class="selectpicker" multiple ng-change="activeListsChange()" ng-model="lists" ng-controller="ActiveListsController">
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<ul class="list-group clearfix"> <ul class="list-group clearfix">
<li class="list-group-item small"><span class="badge">journal</span>{[{journal}]}</li> <li class="list-group-item small"><span class="badge">source</span>{[{journal}]}</li>
<li class="list-group-item small"><span class="badge">authors</span>{[{authors}]}</li> <li class="list-group-item small"><span class="badge">authors</span>{[{authors}]}</li>
<li class="list-group-item small"><span class="badge">date</span>{[{publication_date}]}</li> <li class="list-group-item small"><span class="badge">date</span>{[{publication_date}]}</li>
</ul> </ul>
...@@ -108,12 +108,14 @@ ...@@ -108,12 +108,14 @@
<span class="badge">abstract</span> <span class="badge">abstract</span>
</div> </div>
<p id="abstract-text" class="text-container"> <p id="abstract-text" class="text-container">
{[{abstract_text}]}
<div ng-if="abstract_text == null" class="alert alert-info small" role="alert">Empty abstract text</div> <div ng-if="abstract_text == null" class="alert alert-info small" role="alert">Empty abstract text</div>
</p> </p>
<div ng-if="full_text != null"> <div ng-if="full_text != null">
<span class="badge">full article</span> <span class="badge">full article</span>
</div> </div>
<p id="full-text" class="text-container"> <p id="full-text" class="text-container">
{[{full_text}]}
<div ng-if="full_text == null" class="alert alert-info small" role="alert">Empty full text</div> <div ng-if="full_text == null" class="alert alert-info small" role="alert">Empty full text</div>
</p> </p>
</div> </div>
......
...@@ -172,8 +172,9 @@ class Document(APIView): ...@@ -172,8 +172,9 @@ class Document(APIView):
def get(self, request, doc_id): def get(self, request, doc_id):
"""Document by ID""" """Document by ID"""
# implicit global session
node = session.query(Node).filter(Node.id == doc_id).first() node = session.query(Node).filter(Node.id == doc_id).first()
corpus = session.query(Node).filter(Node.id == node.parent_id).first()
corpus_workflow_status = corpus.hyperdata['statuses'][0]
if node is None: if node is None:
raise APIException('This node does not exist', 404) raise APIException('This node does not exist', 404)
...@@ -185,6 +186,7 @@ class Document(APIView): ...@@ -185,6 +186,7 @@ class Document(APIView):
pub_date = node.hyperdata.get('publication_date') pub_date = node.hyperdata.get('publication_date')
data = { data = {
'corpus_status': corpus_workflow_status,
'title': node.hyperdata.get('title'), 'title': node.hyperdata.get('title'),
'authors': node.hyperdata.get('authors'), 'authors': node.hyperdata.get('authors'),
'journal': node.hyperdata.get('journal'), 'journal': node.hyperdata.get('journal'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment