summaryrefslogtreecommitdiff
path: root/static/website/js
diff options
context:
space:
mode:
authorPrashant S2019-07-16 14:44:05 +0530
committerGitHub2019-07-16 14:44:05 +0530
commit07ae1bafcc89c187b4471ddcb9fd19bb213d6c87 (patch)
treecbc630be80d0995ded8dfac87c1a759a2b5d3b6b /static/website/js
parent2b9b960c698cd541300fbfa96dc2cec515852adc (diff)
parentd5138c4af46e9519a0c5b18ef7142ffe0a9383fa (diff)
downloadR_on_Cloud_Web_Interface-07ae1bafcc89c187b4471ddcb9fd19bb213d6c87.tar.gz
R_on_Cloud_Web_Interface-07ae1bafcc89c187b4471ddcb9fd19bb213d6c87.tar.bz2
R_on_Cloud_Web_Interface-07ae1bafcc89c187b4471ddcb9fd19bb213d6c87.zip
Merge pull request #2 from prashantsinalkar/master
added file upload feature
Diffstat (limited to 'static/website/js')
-rw-r--r--static/website/js/cloud.js53
1 files changed, 45 insertions, 8 deletions
diff --git a/static/website/js/cloud.js b/static/website/js/cloud.js
index fc0bbfc..7d7d5dd 100644
--- a/static/website/js/cloud.js
+++ b/static/website/js/cloud.js
@@ -1005,13 +1005,50 @@ $(document.body).ready(function() {
e.preventDefault();
});
- //on hover pop the disclaimer
- /*
- $("#disclaimer").hover(function() {
- $('#disclaimer-text').modal({
- show: true
- });
- });
- */
+
+$(document).on("click", "#fileuploadsubmit", function() {
+
+ if(confirm("Uploaded file last only till sesstion. Use direct file name for execution.")){
+ var name = doSubmit();
+ $("<span>" + name + "</span>").insertAfter("#uploaddataset");
+ $("#uploaddatasetModal").modal('hide');
+ $("#uploaddataset").hide();
+ }
+ else{
+ return false;
+ }
+
+
+
+});
+
+$(document).on("click", "#reset", function() {
+ if(confirm("Are you sure you want to reset? Reset will clear of your data/uploaded file.")){
+ document.location.reload(true);
+ }
+ else{
+ return false;
+ }
+});
}); //document.readOnly()
+
+function doSubmit(){
+ // Form Data
+ var formData = new FormData();
+
+ var fileSelect = document.getElementById("fileSelect");
+ if(fileSelect.files && fileSelect.files.length == 1){
+ var file = fileSelect.files[0]
+ formData.set("file", file , file.name);
+ }
+
+ var session_id = document.getElementById("session_id");
+ formData.set("session_id", session_id.value)
+ // Http Request
+ var request = new XMLHttpRequest();
+ request.open('POST', "http://10.101.201.190:8001/upload");
+ request.send(formData);
+ return (fileSelect.files[0].name);
+}
+