app/js/tree_logic.js
// batch updates in the future.
batch updates in the future.
batch updates in the future .
function updateNode(node, key, value) {
    console.log("update node called: ");
    console.log(node);
    let tempObj = {};
    tempObj[key] = value;
    $('#' + currentWorkspace + '_tree').tree(
        'updateNode',
        node,
        tempObj
    );
    updateTab(node)
    addTreeTooltips(currentWorkspace);
    if (node.type == "file") {
        var sendData = {
            id: node.id,
            path: node.path,
            name: node.name,
            legacy_ingest: node.legacy_ingest,
            ingest: node.ingest,
            source: node.source,
            icon: node.icon,
            last_accessed: node.last_accessed
        }
        console.log("Send data: ");
        console.log(sendData);
        addToQueue("index/update/" + currentWorkspace, null, {"json_lst": [sendData]}, currentWorkspace);
    }
}
function updateNode ( node , key , value ) { console . log ( "update node called: " ) ; console . log ( node ) ; let tempObj = { } ; tempObj [ key ] = value ; $ ( '#' + currentWorkspace + '_tree' ) . tree ( 'updateNode' , node , tempObj ) ; updateTab ( node ) addTreeTooltips ( currentWorkspace ) ; if ( node . type == "file" ) { var sendData = { id : node . id , path : node . path , name : node . name , legacy_ingest : node . legacy_ingest , ingest : node . ingest , source : node . source , icon : node . icon , last_accessed : node . last_accessed } console . log ( "Send data: " ) ; console . log ( sendData ) ; addToQueue ( "index/update/" + currentWorkspace , null , { "json_lst" : [ sendData ] } , currentWorkspace ) ; } }
batch updates in the future.
batch updates in the future .
// Update the node // Updates chrome tab for the node // Write tree data to tree json file in the workspace repo //treeToJson(currentWorkspace); // Adds tooltip logic to tree (when when updating a node in this case) // Trigger reindexing of node // Convert to required format for JSON.stringify (no circular relationships in JSON) // Sends index command, node Id, and current workspace to backend