Closed sridharan-dlt closed 3 years ago
@arpit9616 could you please review this PR.
@sridharan-dlt , sure. I'll review this today and let you know my feedback.
Ok so here is my question... Am I not exporting a report already visible on the dashboard to csv?
If so then all the data is already at the frontend.
Why would I ever go to backend? We use Papa parse and it is available for frontend anyways (actually creating CSV from scratch is fairly easy anyways).
There are many webapp design methodologies - one that Monkshu uses is do what you can on the frontend reason being imagine 10,000 clients hitting export CSV - would we want to take 5% of their laptop's (or mobile's) CPU or 5% x 10,000 of the backend CPU?
Some frameworks (like PHP) say load the backend but responsive frameworks (like Monkshu) say why? There is a reason my laptop or mobile has a CPU and a capable browser...
This approach minimizes server load as it does most of what can be done in the front end which leads to skinny and cold running servers and fast response time for the clients - also survives network issues etc very nicely.
Okay, @TekMonksGitHub. I totally agree with your points. Will handle the export CSV feature in the frontend, so it will generate a report which is already visible in a dashboard and can also avoid more CPU utilization.
Please close this PR, the total design has to change, and once done will make PR.
Closing for rework using frontend
PR Overview
Refactored the code as per Arpit's comment in PR #18. @TekMonksGitHub could you please review it. Export CSV feature is based on the backend part, which purely depends on DB.