Beispiel #1
0
def geoUnclusterData(request, uid):
    """Get diagram for moduleId"""
    try:
        nodeId = request.data.get('nodeId')
        rowIndex = request.data.get('rowIndex')
        attIndex = request.data.get('attIndex')
        latField = "latitude"
        if request.data.get('latField'):
            latField = request.data.get('latField')
        lngField = "longitude"
        if request.data.get('lngField'):
            lngField = request.data.get('lngField')
        geoField = "geoField"
        if request.data.get('geoField'):
            geoField = request.data.get('geoField')
        labelField = "labelField"
        if request.data.get('labelField'):
            labelField = request.data.get('labelField')
        sizeField = "sizeField"
        if request.data.get('sizeField'):
            sizeField = request.data.get('sizeField')
        colorField = "colorField"
        if request.data.get('colorField'):
            colorField = request.data.get('colorField')
        iconField = "iconField"
        if request.data.get('geoFiiconFieldeld'):
            iconField = request.data.get('iconField')
        if uid in engines:
            return JsonResponse(engines[uid].model.geoUnclusterData(nodeId, rowIndex, attIndex, latField, lngField, geoField, labelField, sizeField, colorField, iconField), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #2
0
def getStatus(request):
    """GET app status"""
    try:
        app = Application()
        return JsonResponse(app.getStatus(), safe=False)
    except Exception as e:
        return genericApiException(e)
Beispiel #3
0
def stop(request, uid):
    """Stop process"""
    try:
        if uid in engines:
            res = engines[uid].stop()
            return HttpResponse(res)
    except Exception as e:
        return genericApiException(e)
Beispiel #4
0
def checkRead(request):
    """Check read"""
    try:
        _path = request.query_params.get("path")
        import os
        res = str(os.listdir(_path))
        return HttpResponse(res)
    except ValueError as e:
        return genericApiException(e)
Beispiel #5
0
def getpid(request, uid):
    """Return the PID of the uid engine"""
    try:
        if uid in engines:
            return HttpResponse(engines[uid].pid)
        else:
            return ""
    except Exception as e:
        return genericApiException(e)
Beispiel #6
0
def closeModel(request, uid):
    """Close the current model"""
    try:
        if uid in engines:
            engines[uid].model.closeModel()
        # no throw error if engine not exists
        return HttpResponse("ok")
    except Exception as e:
        return genericApiException(e)
Beispiel #7
0
def getModelProperties(request, uid):
    """Get model properties"""
    try:
        if uid in engines:
            return JsonResponse(engines[uid].model.getModelProperties(), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #8
0
def sleep(request):
    """ Try sleep 10 seconds
    """
    try:
        import time
        time.sleep(10)
        return JsonResponse({"sleep": "OK"}, safe=False)
    except ValueError as e:
        return genericApiException(e)
Beispiel #9
0
def getSystemResources(request, uid):
    """Return current system resources"""
    try:
        if uid in engines:
            return JsonResponse(engines[uid].model.getSystemResources(), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #10
0
def getPID(request, uid):
    """Return PID of current model"""
    try:
        if uid in engines:
            return JsonResponse(engines[uid].model.getPID(), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #11
0
def release(request, uid):
    """Release a calc engine"""
    try:
        if uid in engines:
            engines[uid].release()
            del engines[uid]
        return HttpResponse("ok")
    except Exception as e:
        return genericApiException(e)
Beispiel #12
0
def isTable(request, uid):
    """Return 1 if the node is editable table"""
    try:
        if uid in engines:
            _nodeId = request.data.get('nodeId')
            return HttpResponse(engines[uid].model.isTable(_nodeId))
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #13
0
def callWizard(request, uid):
    """Call toolbar wizard"""
    try:
        params = request.data.get('params', '')
        if uid in engines:
            return JsonResponse(engines[uid].model.callWizard(params), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #14
0
def executeButton(request, uid):
    """Execute a button node."""
    try:
        if uid in engines:
            _nodeId = request.data.get('nodeId')
            return JsonResponse(engines[uid].model.executeButton(_nodeId), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #15
0
def getOutputs(request, uid):
    """Return outputs of a node"""
    try:
        if uid in engines:
            _nodeId = request.data.get('nodeId')
            return JsonResponse(engines[uid].model.getOutputs(_nodeId), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #16
0
def createAlias(request, uid):
    """Create alias node for each node in the param nodelist"""
    try:
        if uid in engines:
            _nodeList = jsonpickle.decode(request.data.get('nodeList'))
            return JsonResponse(engines[uid].model.createAlias(_nodeList), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #17
0
def getBreadcrumb(request, uid):
    """Get breadcrumb for a moduleId"""
    try:
        _moduleId = request.data.get('moduleId')
        if uid in engines:
            return JsonResponse(engines[uid].model.getBreadcrumb(_moduleId), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #18
0
def getInstallProgress(request, uid):
    """Get current install progress"""
    try:
        if uid in engines:
            from_line = request.data.get('from_line', '0')
            return JsonResponse(engines[uid].model.getInstallProgress(from_line), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #19
0
def getSelector(request, uid):
    """Return selector data"""
    try:
        _nodeId = request.data.get('nodeId')
        if uid in engines:
            return JsonResponse(engines[uid].model.getSelector(_nodeId), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #20
0
def setNodeIdFromTitle(request, uid):
    """Generate Node identifier from node title"""
    try:
        if uid in engines:
            _nodeId = request.data.get('nodeId', '')
            return JsonResponse(engines[uid].model.setNodeIdFromTitle(_nodeId), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #21
0
def getArrows(request, uid):
    """Get arrows of the module"""
    try:
        _nodeId = request.data.get('nodeId')
        if uid in engines:
            return JsonResponse(engines[uid].model.getArrows(_nodeId), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #22
0
def getIndexesWithLevels(request, uid):
    """Get array of node indexes"""
    try:
        if uid in engines:
            _nodeId = request.data.get('nodeId')
            return JsonResponse(engines[uid].model.getIndexesWithLevels(_nodeId), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #23
0
def profilenode(request, uid):
    """Returns the times of each node calculation used to get the result of this node"""
    try:
        if uid in engines:
            _nodeId = request.data.get('nodeId')
            return HttpResponse(engines[uid].model.profileNode(_nodeId))
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #24
0
def unloadScenario(request, uid):
    """Unload all scenarios """
    try:
        if uid in engines:
            engines[uid].model.unloadScenario()
            return HttpResponse("ok")
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #25
0
def getToolbars(request, uid):
    """Return list of default app toolbars"""
    try:
        extraPath = request.data.get('extraPath', '')
        if uid in engines:
            return JsonResponse(engines[uid].model.getToolbars(extraPath), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #26
0
def isCalcNodes(request, uid):
    """Return array of True,False for each node if this is calculated"""
    try:
        if uid in engines:
            _nodeList = jsonpickle.decode(request.data.get('nodeList'))
            return JsonResponse(engines[uid].model.isCalcNodes(_nodeList), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #27
0
def getCubeValues(request, uid):
    """Return data for cube browser"""
    try:
        if uid in engines:
            _query = jsonpickle.decode(request.data.get('query'))
            return JsonResponse(engines[uid].model.getCubeValues(_query), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #28
0
def getCubeMetadata(request, uid):
    """Return metadadata for view node as cube"""
    try:
        if uid in engines:
            _nodeId = request.data.get('nodeId')
            return JsonResponse(engines[uid].model.getCubeMetadata(_nodeId), safe=False)
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #29
0
def saveModel(request, uid):
    """Save the current Model"""
    try:
        if uid in engines:
            _fileName = request.data.get('filename')
            engines[uid].model.saveModel(_fileName)
            return HttpResponse("ok")
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)
Beispiel #30
0
def deleteNodes(request, uid):
    """Delete nodes by ids """
    try:
        if uid in engines:
            _obj = jsonpickle.decode(request.data.get('obj'))
            engines[uid].model.deleteNodes(_obj)
            return HttpResponse("ok")
        else:
            return manageNoEngine()
    except Exception as e:
        return genericApiException(e)