self.appWeb=appWeb
def toWebApp(self,fction,*args, **kwargs):
- print ('self.appWeb.fromConnecteur', fction, *args, **kwargs)
- print ('self.appWeb', self.appWeb)
+ # print ('self.appWeb.fromConnecteur', fction, *args, **kwargs)
+ # print ('self.appWeb', self.appWeb)
if self.appWeb == None : # test
return
self.appWeb.fromConnecteur(fction, *args, **kwargs)
monNode=self.monEditeur.getNodeById(id)
#print (' change Valeur', monNode)
(idUnique, commentaire, validite)=monNode.fauxNoeudGraphique.traiteValeurSaisie(valeur)
- print ('retour ChangeValeur',idUnique, commentaire, validite )
+ #print ('retour ChangeValeur',idUnique, commentaire, validite )
return monNode.fauxNoeudGraphique.traiteValeurSaisie(valeur)
#self.toWebApp('retourChangeValeur',id, commentaire, validite ))
+# coding: utf-8
#!/usr/bin/env python3
import sys
sys.path.append('/home/eric/FLASK/eficas.eecj.git/testFlask')
app.register_blueprint(sse, url_prefix='/stream')
def fromConnecteur(maFonction,*args,**kwargs):
- print ('dans propageValidefromConnecteur: ', maFonction)
+ #print ('dans fromConnecteur: ', maFonction)
fnct=globals()[maFonction]
fnct(*args,**kwargs)
#TODO : Rattacher à une session
-# gérer un appel register callback
+# gérer un appel register callback
app.fromConnecteur=fromConnecteur
def propageValide(id, valid):
- print ('dans propageValide: ', id, valid)
+ #print ('dans propageValide: ', id, valid)
sse.publish({"idUnique" : id, "valid":valid, "message": "Hello from propageValide!"}, type='propageValide')
def appendChildren(id, nodeList, pos):
sse.publish({'id':id, 'nodeList':nodeList, 'pos':pos, "message": "Hello from appendChildren!"}, type='appendChildren')
def deleteChildren(idList):
- print ('dans deleteChildren: ', idList)
+ #print ('dans deleteChildren: ', idList)
sse.publish({"idList":idList,"message": "Hello from deleteChildren!"}, type='deleteChildren')
# # Pour test curl
<!-- <div id="tree2"></div> -->
<div class="row">
- <hr>
+ <!-- <hr> -->
<h2>MyDataModel : Testing the WebAPP approach</h2>
- <div class="col-sm-4">
- <h2>Searching</h2>
- <!-- <form> -->
- <div class="form-group">
- <label for="input-search" class="sr-only">Search Tree:</label>
- <input type="input" class="form-control" id="input-search" placeholder="Type to search..." value="">
- </div>
- <div class="checkbox">
- <label>
- <input type="checkbox" class="checkbox" id="chk-ignore-case" value="false">
- Ignore Case
- </label>
- </div>
- <div class="checkbox">
- <label>
- <input type="checkbox" class="checkbox" id="chk-exact-match" value="false">
- Exact Match
- </label>
- </div>
- <div class="checkbox">
- <label>
- <input type="checkbox" class="checkbox" id="chk-reveal-results" value="false">
- Reveal Results
- </label>
- </div>
- <button type="button" class="btn btn-success" id="btn-search">Search</button>
- <button type="button" class="btn btn-default" id="btn-clear-search">Clear</button>
- <!-- </form> -->
- </div>
- <div class="col-sm-4">
+ <!-- <div class="col-sm-4"> -->
+ <!-- <h2>Searching</h2> -->
+ <!-- <\!-- <form> -\-> -->
+ <!-- <div class="form-group"> -->
+ <!-- <label for="input-search" class="sr-only">Search Tree:</label> -->
+ <!-- <input type="input" class="form-control" id="input-search" placeholder="Type to search..." value=""> -->
+ <!-- </div> -->
+ <!-- <div class="checkbox"> -->
+ <!-- <label> -->
+ <!-- <input type="checkbox" class="checkbox" id="chk-ignore-case" value="false"> -->
+ <!-- Ignore Case -->
+ <!-- </label> -->
+ <!-- </div> -->
+ <!-- <div class="checkbox"> -->
+ <!-- <label> -->
+ <!-- <input type="checkbox" class="checkbox" id="chk-exact-match" value="false"> -->
+ <!-- Exact Match -->
+ <!-- </label> -->
+ <!-- </div> -->
+ <!-- <div class="checkbox"> -->
+ <!-- <label> -->
+ <!-- <input type="checkbox" class="checkbox" id="chk-reveal-results" value="false"> -->
+ <!-- Reveal Results -->
+ <!-- </label> -->
+ <!-- </div> -->
+ <!-- <button type="button" class="btn btn-success" id="btn-search">Search</button> -->
+ <!-- <button type="button" class="btn btn-default" id="btn-clear-search">Clear</button> -->
+ <!-- <\!-- </form> -\-> -->
+ <!-- </div> -->
+ <!-- <div class="col-sm-4"> -->
+ <!-- <h2>Results</h2> -->
+ <!-- <div id="search-output"></div> -->
+ <!-- </div> -->
+ </div>
+ <div class="row">
+ <div class="col-sm-12">
<h2>My dataset</h2>
<!-- <div id="treeview-searchable" class=""></div> -->
<!-- <div id="tree1" class="table table-condensed table-hover table-striped fancytree-fade-expander"> -->
<!-- </div> -->
</table>
</div>
- <div class="col-sm-4">
- <h2>Results</h2>
- <div id="search-output"></div>
- </div>
</div>
-
-
+ <div class="row">
+ <h2>Messages</h2>
+ <div id="tree1-messages" class="col-sm-12" >Ouuuu
+ </div>
+ </div>
<!-- <style type="text/css"> -->
<!-- #treetable { -->
<!-- table-layout: fixed; -->
var source = new EventSource("{{ url_for('sse.stream') }}");
source.addEventListener('propageValide', function(event) {
- var data = JSON.parse(event.data);
- alert("The server says " + data.message);
+ var data = JSON.parse(event.data);
+ var message = data.message;
+ // alert("The server says " + data.message);
+ console.log("The server says " + data.message);
+ $("#tree1-messages").text(message);
var tree=$.ui.fancytree.getTree("#tree1");
var activeNode = tree.getActiveNode();
//p1=tree.getNodeByKey('8304986a334211ec853cac220bca9aa6')
}, false);
source.addEventListener('appendChildren', function(event) {
- var data = JSON.parse(event.data);
+ var data = JSON.parse(event.data);
var id = data.id;
var nodeList = data.nodeList;
var pos = data.pos;
+ var message = data.message;
- alert("The server says " + data.message);
- var tree=$.ui.fancytree.getTree("#tree1");
- var activeNode = tree.getActiveNode();
- //p1=tree.getNodeByKey('8304986a334211ec853cac220bca9aa6')
- //activeNode.addChildren({
- // title: "Document using a custom icon",
- // icon: "customdoc1.gif"
- //});
+ //alert("The server says " + data.message);
+ console.log("The server says " + data.message);
+ $("#tree1-messages").text(message);
+ var tree = $.ui.fancytree.getTree("#tree1");
+ //var activeNode = tree.getActiveNode();
+ node=tree.getNodeByKey(id)
+ node.addChildren(nodeList,pos);
+ <!-- node.addChildren({ -->
+ <!-- title: "Document using a custom icon", -->
+ <!-- icon: "customdoc1.gif" -->
+ <!-- }); -->
}, false);
source.addEventListener('deleteChildren', function(event) {
- var data = JSON.parse(event.data);
- var idList = data.idList;
-
- alert("The server says " + data.message);
- var tree=$.ui.fancytree.getTree("#tree1");
- var activeNode = tree.getActiveNode();
- //p1=tree.getNodeByKey('8304986a334211ec853cac220bca9aa6')
+ var data = JSON.parse(event.data);
+ <!-- const keySet = new Set(data.idList); -->
+ var keyList = data.idList;
+ var message = data.message;
+ <!-- const nodeAsKey = function (node,keys) { -->
+ <!-- //?keySet = _isFunction(match) ? keys : _makeNodeTitleMatcher(match); -->
+ <!-- if (node.key === key ) return true; -->
+ <!-- return false; -->
+ <!-- }; -->
+ <!-- var myNodeAsKey= function(n) {return nodeAsKey(n,'efbab07c5d8e11ecbd14ac220bca9aa6');} -->
+ //alert("The server says " + data.message);
+ console.log("The server says " + data.message);
+ $("#tree1-messages").text(message);
+ var tree = $.ui.fancytree.getTree("#tree1");
+ nodeList = keyList.map( (x) => { return tree.getNodeByKey(x) } );
+ nodeList.map( (x) => { x.remove()} );
+
+ //tree.findAll(match);
+ //var activeNode = tree.getActiveNode();
//activeNode.addChildren({
// title: "Document using a custom icon",
// icon: "customdoc1.gif"
</script>
{% endblock %}
-