Commit 26af0583 authored by delanoe's avatar delanoe

Merge remote-tracking branch 'origin/romain-testing' into testing

parents 5826a35c 58734474
...@@ -2378,7 +2378,9 @@ function MainTableAndCharts( ngdata , initial , filtersParams, callerLabel) { ...@@ -2378,7 +2378,9 @@ function MainTableAndCharts( ngdata , initial , filtersParams, callerLabel) {
// restore chart filters // restore chart filters
if (typeof(filtersParams.from) != 'undefined' if (typeof(filtersParams.from) != 'undefined'
&& typeof(filtersParams.to) != 'undefined') { && typeof(filtersParams.to) != 'undefined'
&& ! (filtersParams.from == null)
&& ! (filtersParams.to == null)) {
var fromVal = filtersParams.from var fromVal = filtersParams.from
var toVal = filtersParams.to var toVal = filtersParams.to
......
...@@ -215,7 +215,7 @@ ...@@ -215,7 +215,7 @@
</div>\ </div>\
</div>' </div>'
var finishedHtmlTemplate='\ var finishedHtmlCondi='\
<br>\ <br>\
From: begin of corpus\ From: begin of corpus\
, To: end of corpus\ , To: end of corpus\
...@@ -224,8 +224,8 @@ ...@@ -224,8 +224,8 @@
<li>\ <li>\
<a href="/projects/%%project_id%%/corpora/%%corpus_id%%/explorer?cooc_id=%%cooc_id%%&amp;distance=conditional&amp;bridgeness=5">\ <a href="/projects/%%project_id%%/corpora/%%corpus_id%%/explorer?cooc_id=%%cooc_id%%&amp;distance=conditional&amp;bridgeness=5">\
<span class="glyphicon glyphicon-eye-open" style="font-size:150%"></span>\ <span class="glyphicon glyphicon-eye-open" style="font-size:150%"></span>\
~%%nb_nodes%% nodes,\ ~%%co_nb_nodes%% nodes,\
~%%nb_edges%% edges\ ~%%co_nb_edges%% edges\
with <b>Conditional</b> distance\ with <b>Conditional</b> distance\
</a>\ </a>\
</li>\ </li>\
...@@ -238,6 +238,54 @@ ...@@ -238,6 +238,54 @@
</ul>\ </ul>\
<br>' <br>'
var finishedHtmlDistri='\
<br>\
From: begin of corpus\
, To: end of corpus\
<br>\
<ul id="graph_%%cooc_id%%_finished">\
<li>\
<a href="/projects/%%project_id%%/corpora/%%corpus_id%%/explorer?cooc_id=%%cooc_id%%&amp;distance=conditional&amp;bridgeness=5">\
<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>\
Compute this graph with Conditional distance\
</a>\
</li>\
<li>\
<a href="/projects/%%project_id%%/corpora/%%corpus_id%%/explorer?cooc_id=%%cooc_id%%&amp;distance=conditional&amp;bridgeness=5">\
<span class="glyphicon glyphicon-eye-open" style="font-size:150%"></span>\
~%%di_nb_nodes%% nodes,\
~%%di_nb_edges%% edges\
with <b>Distributional</b> distance\
</a>\
</li>\
</ul>\
<br>'
var finishedHtmlTemplate='\
<br>\
From: begin of corpus\
, To: end of corpus\
<br>\
<ul id="graph_%%cooc_id%%_finished">\
<li>\
<a href="/projects/%%project_id%%/corpora/%%corpus_id%%/explorer?cooc_id=%%cooc_id%%&amp;distance=conditional&amp;bridgeness=5">\
<span class="glyphicon glyphicon-eye-open" style="font-size:150%"></span>\
~%%co_nb_nodes%% nodes,\
~%%co_nb_edges%% edges\
with <b>Conditional</b> distance\
</a>\
</li>\
<li>\
<a href="/projects/%%project_id%%/corpora/%%corpus_id%%/explorer?cooc_id=%%cooc_id%%&amp;distance=distributional&amp;bridgeness=5">\
<span class="glyphicon glyphicon-eye-open" style="font-size:150%"></span>\
~%%di_nb_nodes%% nodes,\
~%%di_nb_edges%% edges\
with <b>Distributional</b> distance\
</a>\
</li>\
</ul>\
<br>'
var baseSkeletonTemplate='\ var baseSkeletonTemplate='\
<div id="graph_%%cooc_id%%" class="graph-elt first-graph">\ <div id="graph_%%cooc_id%%" class="graph-elt first-graph">\
<div class="row">\ <div class="row">\
...@@ -297,12 +345,15 @@ ...@@ -297,12 +345,15 @@
* @param coocId * @param coocId
* @param coocName * @param coocName
* @param coocDate * @param coocDate
* @param nNodes (optional <=> if finished_status) * @param coNbNodes (optional <=> if finished_status on conditional)
* @param nEdges (optional <=> if finished_status) * @param coNbEdges (optional <=> if finished_status on conditional)
* @param diNbNodes (optional <=> if finished_status on distributional)
* @param diNbEdges (optional <=> if finished_status on distributional)
*/ */
function showNewCoocDiv(statusCode, function showNewCoocDiv(statusCode,
coocId, coocName, coocDate, coocId, coocName, coocDate,
nbNodes, nbEdges) { coNbNodes, coNbEdges,
diNbNodes, diNbEdges) {
var resultHtml = baseSkeletonTemplate var resultHtml = baseSkeletonTemplate
// initial if // initial if
...@@ -314,9 +365,22 @@ ...@@ -314,9 +365,22 @@
break; break;
case "finished_status": case "finished_status":
resultHtml = resultHtml.replace(/%%HERE_RESPONSE_DEPENDANT%%/, if ((typeof coNbNodes != 'undefined') && coNbNodes
finishedHtmlTemplate && (typeof diNbNodes != 'undefined') && diNbNodes) {
) resultHtml = resultHtml.replace(/%%HERE_RESPONSE_DEPENDANT%%/,
finishedHtmlTemplate
)
} else if ((typeof coNbNodes != 'undefined') && ! (coNbNodes == null)) {
console.log("condi case", coNbNodes)
resultHtml = resultHtml.replace(/%%HERE_RESPONSE_DEPENDANT%%/,
finishedHtmlCondi
)
} else if ((typeof diNbNodes != 'undefined') && ! (diNbNodes == null)) {
console.log("distri case")
resultHtml = resultHtml.replace(/%%HERE_RESPONSE_DEPENDANT%%/,
finishedHtmlDistri
)
}
break; break;
default: default:
...@@ -332,9 +396,13 @@ ...@@ -332,9 +396,13 @@
resultHtml = resultHtml.replace(/%%cooc_name%%/g, coocName); resultHtml = resultHtml.replace(/%%cooc_name%%/g, coocName);
resultHtml = resultHtml.replace(/%%cooc_date%%/g, formatDateLikeDjango(coocDate)); resultHtml = resultHtml.replace(/%%cooc_date%%/g, formatDateLikeDjango(coocDate));
if (typeof nbEdges != 'undefined' && typeof nbNodes != 'undefined') { if (typeof coNbEdges != 'undefined' && typeof coNbNodes != 'undefined') {
resultHtml = resultHtml.replace(/%%nb_nodes%%/g, nbNodes); resultHtml = resultHtml.replace(/%%co_nb_nodes%%/g, coNbNodes);
resultHtml = resultHtml.replace(/%%nb_edges%%/g, nbEdges); resultHtml = resultHtml.replace(/%%co_nb_edges%%/g, coNbEdges);
}
if (typeof diNbEdges != 'undefined' && typeof diNbNodes != 'undefined') {
resultHtml = resultHtml.replace(/%%di_nb_nodes%%/g, diNbNodes);
resultHtml = resultHtml.replace(/%%di_nb_edges%%/g, diNbEdges);
} }
// what do we do with those results ? // what do we do with those results ?
...@@ -368,8 +436,8 @@ ...@@ -368,8 +436,8 @@
var coocId = null // 1 & 2 var coocId = null // 1 & 2
var coocName = null // 1 & 2 var coocName = null // 1 & 2
var coocDate = null // 1 & 2 var coocDate = null // 1 & 2
var nbNodes = null // 2 var coNbNodes = null // 2
var nbEdges = null // 2 var coNbEdges = null // 2
// run the "save new graph" ajax // run the "save new graph" ajax
// ----------------------------- // -----------------------------
...@@ -441,17 +509,45 @@ ...@@ -441,17 +509,45 @@
var coocNodeDate = data['date'] var coocNodeDate = data['date']
// test if ready like this for the moment // test if ready like this for the moment
if (typeof data['hyperdata']['conditional'] != "undefined") { if ((typeof data['hyperdata']['conditional'] != "undefined")
&& (typeof data['hyperdata']['distributional'] != "undefined")){
console.log("GRAPH is READY", coocNodeId) console.log("GRAPH is READY", coocNodeId)
graphReadyFlag = true graphReadyFlag = true
var nbNodes = data['hyperdata']['conditional']['nodes'] var coNbNodes = data['hyperdata']['conditional']['nodes']
var nbEdges = data['hyperdata']['conditional']['edges'] var coNbEdges = data['hyperdata']['conditional']['edges']
var diNbNodes = data['hyperdata']['distributional']['nodes']
var diNbEdges = data['hyperdata']['distributional']['edges']
// console.warn("running callback for graph id:" + coocNodeId) // console.warn("running callback for graph id:" + coocNodeId)
showNewCoocDiv("finished_status", coocNodeId, showNewCoocDiv("finished_status", coocNodeId,
coocNodeName, coocNodeDate, coocNodeName, coocNodeDate,
nbNodes, nbEdges) coNbNodes, coNbEdges,
diNbNodes, diNbEdges)
} else if (typeof data['hyperdata']['conditional'] != "undefined"){
console.log("conditional GRAPH is READY", coocNodeId)
graphReadyFlag = true
var coNbNodes = data['hyperdata']['conditional']['nodes']
var coNbEdges = data['hyperdata']['conditional']['edges']
// console.warn("running callback for graph id:" + coocNodeId)
showNewCoocDiv("finished_status", coocNodeId,
coocNodeName, coocNodeDate,
coNbNodes, coNbEdges,
null, null)
} else if (typeof data['hyperdata']['distributional'] != "undefined"){
console.log("distributional GRAPH is READY", coocNodeId)
graphReadyFlag = true
var diNbNodes = data['hyperdata']['distributional']['nodes']
var diNbEdges = data['hyperdata']['distributional']['edges']
// console.warn("running callback for graph id:" + coocNodeId)
showNewCoocDiv("finished_status", coocNodeId,
coocNodeName, coocNodeDate,
null, null,
diNbNodes, diNbEdges)
} }
// stopping conditions // stopping conditions
......
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