import json
import logging
from django.views.generic import View
from arches.app.models.models import ETLModule
from arches.app.utils.response import JSONResponse

logger = logging.getLogger(__name__)


class ETLManagerView(View):
    """
    to get the ETL modules from db
    """

    def get(self, request):
        etl_modules = ETLModule.objects.all()
        return JSONResponse(etl_modules)

    def post(self, request):
        """
        instantiate the proper module with proper action and pass the request
        possible actions are "import", "validate", "return first line", ""
        """
        action = request.POST.get("action")
        module = request.POST.get("module")
        import_module = ETLModule.objects.get(pk=module).get_class_module()(request)
        import_function = getattr(import_module, action)
        response = import_function(request=request)
        if response["success"]:
            ret = {"result": response["data"]}
            return JSONResponse(ret)
        else:
            return JSONResponse(status=400, reason=response["error"])

@@ -104,17 +104,41 @@
 TLModule
+, LoadEvent, LoadStaging
 %0A
-
 from arc
@@ -340,44 +340,432 @@
     
-etl_modules = ETLModule.objects.all(
+action = request.GET.get(%22action%22, None)%0A        loadid = request.GET.get(%22loadid%22, None)%0A        if action == %22modules%22 or action is None:%0A            response = ETLModule.objects.all()%0A        elif action == %22loadEvent%22:%0A            response = LoadEvent.objects.all()%0A        elif action == %22stagedData%22 and loadid:%0A            response = LoadStaging.objects.get(loadid=loadid)%0A        print(action)%0A        print(response
 )%0A  
@@ -794,19 +794,16 @@
 nse(
-etl_modules
+response
 )%0A%0A 

Update etl backend, #8289