From cf5edfb3a6475ea20898fbb9f675634f706f8127 Mon Sep 17 00:00:00 2001 From: rizalfr Date: Tue, 22 May 2018 11:16:01 +0700 Subject: [PATCH] enabling upload on json also --- locust/static/locust.js | 17 +++++++++--- locust/static/style.css | 22 +++++++-------- locust/templates/index.html | 55 +++++++------------------------------ locust/web.py | 4 ++- 4 files changed, 37 insertions(+), 61 deletions(-) diff --git a/locust/static/locust.js b/locust/static/locust.js index d606433a8c..c05db9cabb 100644 --- a/locust/static/locust.js +++ b/locust/static/locust.js @@ -174,14 +174,23 @@ $("#directories .select2").select2({ placeholder: "Select a state" }); -$('#upload_btn_submit').click(function(event){ +var whichform = $('.upload_file_form')[0]; + +$('#upload_py_submit').click(function(event){ + event.preventDefault(); + whichform = $('.upload_file_form')[0]; + $('.upload_file_form').submit(); +}); + +$('#upload_json_submit').click(function(event){ event.preventDefault(); - $('#upload_file_form').submit(); + whichform = $('.upload_file_form')[1]; + $('.upload_file_form').submit(); }); -$('#upload_file_form').submit(function(event) { +$('.upload_file_form').submit(function(event) { event.preventDefault(); - var form = $('#upload_file_form')[0]; + var form = whichform; var form_data = new FormData(form); $.ajax({ type: 'POST', diff --git a/locust/static/style.css b/locust/static/style.css index a5745b0f85..a7a14b4434 100644 --- a/locust/static/style.css +++ b/locust/static/style.css @@ -308,7 +308,7 @@ label[for="json_option"]+div{ .start button, .edit button, .edit_config button[type=submit], .multiple_column button, -#new-test-confirmation .btn-newtest, #upload_btn_submit { +#new-test-confirmation .btn-newtest, #upload_json_submit, #upload_py_submit { margin: 20px 0px 20px 0px; float: right; font-size: 14px; @@ -566,7 +566,7 @@ ul.tabs li a.current:after { } -#add-new-file-modal, #upload_json_modal, #new-test-confirmation { +#add-new-file-modal, #upload-json-modal, #new-test-confirmation { width: 398px; position: absolute; left: 50%; @@ -581,7 +581,7 @@ ul.tabs li a.current:after { box-shadow: 0 0 120px rgba(0,0,0,0.3); } -#add-new-file-modal, #upload_json_modal { +#add-new-file-modal, #upload-json-modal { padding-left : 1%; padding-right: 1%; height: 275px; @@ -591,25 +591,25 @@ ul.tabs li a.current:after { width: 450px; } -#add-new-file-modal .modal-dialog, #new-test-confirmation .modal-dialog, #upload_json_modal .modal-dialog{ +#add-new-file-modal .modal-dialog, #new-test-confirmation .modal-dialog, #upload-json-modal .modal-dialog{ display: flex; flex-direction: column; vertical-align: middle; margin-top: 0px; margin-bottom: -50px; } -#add-new-file-modal .modal-header, #new-test-confirmation .modal-header, #upload_json_modal .modal-header { +#add-new-file-modal .modal-header, #new-test-confirmation .modal-header, #upload-json-modal .modal-header { border-bottom-color: transparent; } -#add-new-file-modal .close, #new-test-confirmation .close, #upload_json_modal .close { +#add-new-file-modal .close, #new-test-confirmation .close, #upload-json-modal .close { color: #addf82; } -#new-test-confirmation .modal-header .close, #add-new-file-modal .close, #upload_json_modal .modal-header .close{ +#new-test-confirmation .modal-header .close, #add-new-file-modal .close, #upload-json-modal .modal-header .close{ margin-right: -25px; padding: 3px; } -#new-test-confirmation .modal-body, #add-new-file-modal .modal-body, #upload_json_modal .modal-body { +#new-test-confirmation .modal-body, #add-new-file-modal .modal-body, #upload-json-modal .modal-body { padding-top: 25px; padding-bottom: 0px; color: white; @@ -625,14 +625,14 @@ ul.tabs li a.current:after { #new-test-confirmation .modal-header .close { margin-right: -10px; } -#add-new-file-modal .modal-content, #new-test-confirmation .modal-content, #upload_json_modal .modal-content { +#add-new-file-modal .modal-content, #new-test-confirmation .modal-content, #upload-json-modal .modal-content { background-color: #132b21; border-color: transparent; } -#add-new-file-modal .modal-title, #new-test-confirmation .modal-title, #upload_json_modal .modal-title { +#add-new-file-modal .modal-title, #new-test-confirmation .modal-title, #upload-json-modal .modal-title { color:#addf82; } -#upload_file_form, #new-test-confirmation { +.upload_file_form, #new-test-confirmation { color: white; } .about { diff --git a/locust/templates/index.html b/locust/templates/index.html index 86f4d83c81..7c629161fe 100644 --- a/locust/templates/index.html +++ b/locust/templates/index.html @@ -132,7 +132,7 @@ @@ -239,42 +239,7 @@

Ramping

-
- - -
-
-

HOME

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna - aliqua.

-
- - - -
-
+
@@ -310,11 +275,11 @@
- +
-