From 5dbd0a5cbfe00eed5fa11a32ebeac9fbfc79a362 Mon Sep 17 00:00:00 2001 From: Rida Abou-Haidar Date: Mon, 27 May 2019 13:24:38 -0400 Subject: [PATCH] [dataquery] Removed last instance of GetJS.php (#4499) Remove straggling reference to GetJS.php, which was removed with the transition to "real" routing. --- modules/README.md | 3 +-- modules/dataquery/js/react.tabs.js | 2 +- modules/dataquery/jsx/react.tabs.js | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/README.md b/modules/README.md index f20fd0a9de6..b74722905cd 100644 --- a/modules/README.md +++ b/modules/README.md @@ -11,8 +11,7 @@ Modules should be entirely self-contained into a subdirectory with the following help/ - Contains a markdown file of help content for each page in this module - js/ - This contains any javascript for the module. They are accessed with GetJS.php in - Loris, which does necessary permission checking and returns the file. + js/ - This contains any javascript for the module. php/ - This contains the NDB_Menu_Filter and/or NDB_Form for the module diff --git a/modules/dataquery/js/react.tabs.js b/modules/dataquery/js/react.tabs.js index 8f1835e8217..15c1734a24b 100644 --- a/modules/dataquery/js/react.tabs.js +++ b/modules/dataquery/js/react.tabs.js @@ -6,5 +6,5 @@ * @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 * @link https://github.com/mohadesz/Loris-Trunk */ -var Loading=React.createClass({displayName:"Loading",render:function(){return React.createElement("div",{className:"row"},React.createElement("h3",{className:"text-center loading-header"},"We are currently working hard to load your data. Please be patient."),React.createElement("div",{className:"spinner"},React.createElement("div",{className:"bounce1"}),React.createElement("div",{className:"bounce2"}),React.createElement("div",{className:"bounce3"})))}}),TabPane=React.createClass({displayName:"TabPane",mixins:[React.addons.PureRenderMixin],render:function(){var classList="tab-pane";return this.props.Active&&(classList+=" active"),this.props.Loading?React.createElement("div",{className:classList,id:this.props.TabId},React.createElement(Loading,null)):React.createElement("div",{className:classList,id:this.props.TabId},React.createElement("h1",null,this.props.Title),this.props.children)}}),InfoTabPane=React.createClass({displayName:"InfoTabPane",mixins:[React.addons.PureRenderMixin],render:function(){return React.createElement(TabPane,{Title:"Welcome to the Data Query Tool",TabId:this.props.TabId,Active:!0,Loading:this.props.Loading},React.createElement("p",null,"Data was last updated on ",this.props.UpdatedTime,"."),React.createElement("p",null,"Please define or use your query by using the following tabs."),React.createElement("dl",null,React.createElement("dt",null,"Define Fields"),React.createElement("dd",null,"Define the fields to be added to your query here."),React.createElement("dt",null,"Define Filters"),React.createElement("dd",null,"Define the criteria to filter the data for your query here."),React.createElement("dt",null,"View Data"),React.createElement("dd",null,"See the results of your query."),React.createElement("dt",null,"Statistical Analysis"),React.createElement("dd",null,"Visualize or see basic statistical measures from your query here."),React.createElement("dt",null,"Load Saved Query"),React.createElement("dd",null,"Load a previously saved query (by name) by selecting from this menu."),React.createElement("dt",null,"Manage Saved Queries"),React.createElement("dd",null,"Either save your current query or see the criteria of previously saved quer ies here.")))}}),FieldSelectTabPane=React.createClass({displayName:"FieldSelectTabPane",render:function(){return React.createElement(TabPane,{TabId:this.props.TabId,Loading:this.props.Loading},React.createElement(FieldSelector,{title:"Fields",items:this.props.categories,onFieldChange:this.props.onFieldChange,selectedFields:this.props.selectedFields,Visits:this.props.Visits,fieldVisitSelect:this.props.fieldVisitSelect}))}}),FilterSelectTabPane=React.createClass({displayName:"FilterSelectTabPane",render:function(){return React.createElement(TabPane,{TabId:this.props.TabId,Loading:this.props.Loading},React.createElement(FilterBuilder,{items:this.props.categories,updateFilter:this.props.updateFilter,filter:this.props.filter,Visits:this.props.Visits}))}}),ViewDataTabPane=React.createClass({displayName:"ViewDataTabPane",getInitialState:function(){return{sessions:[]}},runQuery:function(){this.props.onRunQueryClicked&&this.props.onRunQueryClicked(this.props.Fields,this.props.Sessions)},changeDataDisplay:function(displayID){this.props.changeDataDisplay(displayID)},getOrCreateProgressElement:function(id){var progress,element=document.getElementById(id);return element?element:(progress=document.getElementById("progress"),element=document.createElement("div"),element.setAttribute("id",id),progress.appendChild(element),element)},getOrCreateDownloadLink:function(fileName,type){var parentEl,el2,element=document.getElementById("DownloadLink"+fileName);return element?element:(parentEl=document.getElementById("downloadlinksUL"),element=document.createElement("a"),element.download=fileName,element.type=type,element.textContent="Zip file: "+fileName,element.setAttribute("id","DownloadLink"+fileName),el2=document.createElement("li"),el2.appendChild(element),parentEl.appendChild(el2),element)},downloadData:function(){var FileList=(new JSZip,this.props.FileData);if(void 0===FileList)return void alert("No Data is available to download");var saveworker=(new Array(FileList.length),void 0),dataURLs=[],that=this;window.dataBlobs=[],(FileList.length<100||confirm("You are trying to download more than 100 files. This may be slow or crash your web browser.\n\nYou may want to consider splitting your query into more, smaller queries by defining more restrictive filters.\n\nPress OK to continue with attempting to download current files or cancel to abort."))&&(saveworker=new Worker(loris.BaseURL+"/GetJS.php?Module=dataquery&file=workers/savezip.js"),saveworker.addEventListener("message",function(e){var link,progress,FileName,NewFileName,downloadLinks,i;if("SaveFile"===e.data.cmd)progress=that.getOrCreateProgressElement("download_progress"),window.dataBlobs[e.data.FileNo-1]=new Blob([e.data.buffer],{type:"application/zip"}),dataURLs[e.data.FileNo-1]=window.URL.createObjectURL(window.dataBlobs[e.data.FileNo-1]),link=that.getOrCreateDownloadLink(e.data.Filename,"application/zip"),link.href=dataURLs[e.data.FileNo-1],progress=that.getOrCreateProgressElement("zip_progress"),progress.textContent="";else if("Progress"===e.data.cmd)progress=that.getOrCreateProgressElement("download_progress"),progress.innerHTML='Downloading files: '+e.data.Complete+" out of "+e.data.Total+"";else if("Finished"===e.data.cmd){if(1===dataURLs.length&&$("#downloadlinksUL li a")[0].click(),dataURLs.length>1)for(progress=document.getElementById("downloadlinks"),progress.style.display="initial",downloadLinks=$("#downloadlinksUL li a"),i=0;imax||void 0===max)&&void 0!==arr[i][0]&&null!==arr[i][0]&&(max=arr[i][0]);return[min,max]},updateScatterplot:function(){var min,max,group_label,minmax,LS,slope,start,label,dataset,xaxis=document.getElementById("scatter-xaxis").value,yaxis=document.getElementById("scatter-yaxis").value,grouping=document.getElementById("scatter-group").value,data=this.props.Data,points=[],field1=[],field2=[],grouped_points={},i=0,plots=[],plotY=function(x){return[x,start+slope*x]};for(i=0;i"+jStat.covariance(field1,field2)+""+jStat.corrcoeff(field1,field2)+"")},render:function(){var options=this.props.Fields.map(function(element,key){return console.log(element),React.createElement("option",{value:key},element)}),scatterStyle={width:"500px",height:"500px"};return React.createElement("div",null,React.createElement("h2",null,"Scatterplot"),React.createElement("div",{className:"col-xs-4 col-md-3"},"Column for X Axis"),React.createElement("div",{className:"col-xs-8 col-md-3"},React.createElement("select",{id:"scatter-xaxis",onChange:this.updateScatterplot},React.createElement("option",null,"None"),options)),React.createElement("div",{className:"col-xs-4 col-md-3"},"Column for Y Axis"),React.createElement("div",{className:"col-xs-8 col-md-3"},React.createElement("select",{id:"scatter-yaxis",onChange:this.updateScatterplot},React.createElement("option",null,"None"),options)),React.createElement("div",{className:"col-xs-4 col-md-3"},"Group by column"),React.createElement("div",{className:"col-xs-8 col-md-3"},React.createElement("select",{id:"scatter-group",onChange:this.updateScatterplot},React.createElement("option",null,"None"),options)),React.createElement("h3",null,"Scatterplot"),React.createElement("div",{id:"scatterplotdiv",style:scatterStyle}),React.createElement("h3",null,"Statistics"),React.createElement("table",{id:"correlationtbl"},React.createElement("thead",null,React.createElement("tr",null,React.createElement("th",null,"Covariance"),React.createElement("th",null,"Correlation Coefficient"))),React.createElement("tbody",null)))}}),StatsVisualizationTabPane=React.createClass({displayName:"StatsVisualizationTabPane",getDefaultProps:function(){return{Data:[]}},getInitialState:function(){return{displayed:!1}},render:function(){if(0===this.props.Data.length)var content=React.createElement("div",null,"Could not calculate stats, query not run");else{for(var stats=jStat(this.props.Data),min=stats.min(),max=stats.max(),stddev=stats.stdev(),mean=stats.mean(),meandev=stats.meandev(),meansqerr=stats.meansqerr(),quartiles=stats.quartiles(),rows=[],i=0;i'+e.data.Complete+" out of "+e.data.Total+"";else if("Finished"===e.data.cmd){if(1===dataURLs.length&&$("#downloadlinksUL li a")[0].click(),dataURLs.length>1)for(progress=document.getElementById("downloadlinks"),progress.style.display="initial",downloadLinks=$("#downloadlinksUL li a"),i=0;imax||void 0===max)&&void 0!==arr[i][0]&&null!==arr[i][0]&&(max=arr[i][0]);return[min,max]},updateScatterplot:function(){var min,max,group_label,minmax,LS,slope,start,label,dataset,xaxis=document.getElementById("scatter-xaxis").value,yaxis=document.getElementById("scatter-yaxis").value,grouping=document.getElementById("scatter-group").value,data=this.props.Data,points=[],field1=[],field2=[],grouped_points={},i=0,plots=[],plotY=function(x){return[x,start+slope*x]};for(i=0;i"+jStat.covariance(field1,field2)+""+jStat.corrcoeff(field1,field2)+"")},render:function(){var options=this.props.Fields.map(function(element,key){return console.log(element),React.createElement("option",{value:key},element)}),scatterStyle={width:"500px",height:"500px"};return React.createElement("div",null,React.createElement("h2",null,"Scatterplot"),React.createElement("div",{className:"col-xs-4 col-md-3"},"Column for X Axis"),React.createElement("div",{className:"col-xs-8 col-md-3"},React.createElement("select",{id:"scatter-xaxis",onChange:this.updateScatterplot},React.createElement("option",null,"None"),options)),React.createElement("div",{className:"col-xs-4 col-md-3"},"Column for Y Axis"),React.createElement("div",{className:"col-xs-8 col-md-3"},React.createElement("select",{id:"scatter-yaxis",onChange:this.updateScatterplot},React.createElement("option",null,"None"),options)),React.createElement("div",{className:"col-xs-4 col-md-3"},"Group by column"),React.createElement("div",{className:"col-xs-8 col-md-3"},React.createElement("select",{id:"scatter-group",onChange:this.updateScatterplot},React.createElement("option",null,"None"),options)),React.createElement("h3",null,"Scatterplot"),React.createElement("div",{id:"scatterplotdiv",style:scatterStyle}),React.createElement("h3",null,"Statistics"),React.createElement("table",{id:"correlationtbl"},React.createElement("thead",null,React.createElement("tr",null,React.createElement("th",null,"Covariance"),React.createElement("th",null,"Correlation Coefficient"))),React.createElement("tbody",null)))}}),StatsVisualizationTabPane=React.createClass({displayName:"StatsVisualizationTabPane",getDefaultProps:function(){return{Data:[]}},getInitialState:function(){return{displayed:!1}},render:function(){if(0===this.props.Data.length)var content=React.createElement("div",null,"Could not calculate stats, query not run");else{for(var stats=jStat(this.props.Data),min=stats.min(),max=stats.max(),stddev=stats.stdev(),mean=stats.mean(),meandev=stats.meandev(),meansqerr=stats.meansqerr(),quartiles=stats.quartiles(),rows=[],i=0;i