Skip to content

Commit 10e7f3d

Browse files
updated few runner issues
1 parent 90dd325 commit 10e7f3d

File tree

3 files changed

+146
-36
lines changed

3 files changed

+146
-36
lines changed

css/styles.css

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,11 @@ select:-moz-focusring {
496496
padding: 13px 10px;
497497
}
498498
.api_list_table td:last-child{
499-
width: 15%;
500-
text-align: center;
499+
width: 20%;
500+
text-align: right;
501+
}
502+
.api_list_table thead tr td:last-child{
503+
padding-right: 44px;
501504
}
502505
.api_list_table thead tr{
503506
background: #F1F3F6;
@@ -1120,6 +1123,28 @@ table {
11201123
margin: 0px 30px;
11211124
background-color: #ededed;
11221125
}
1126+
.profiling_block{
1127+
padding: 10px;
1128+
margin: 10px 30px;
1129+
background-color: #ededed;
1130+
}
1131+
.modalbox_content b {
1132+
color: #000000;
1133+
}
1134+
.profiling_each_block{
1135+
margin: 10px;
1136+
min-width: 18%;
1137+
font-size: 10px;
1138+
}
1139+
.profiling_each_block label{
1140+
font-size: 15px;
1141+
vertical-align: top;
1142+
}
1143+
.profiling_each_block input[type=number]{
1144+
width: 100%;
1145+
padding: 5px;
1146+
border: 1px solid #c7c7c7;
1147+
}
11231148
.response_one_summary{
11241149
font-size: 10px;
11251150
max-width: 20%;
@@ -1167,4 +1192,7 @@ table {
11671192
overflow: hidden;
11681193
border-radius: 2px;
11691194
position: relative;
1195+
}
1196+
.logout_button{
1197+
color: #f21e1e;
11701198
}

dashboard.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<html>
1414
<head>
1515
<link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
16+
<link rel="shortcut icon" type="image/png" href="https://miad.mobikul.com/images/favicon.png"/>
1617
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
1718
<link href="css/styles.css?v=1.3" rel="stylesheet"/>
1819
<link href="css/jquery.json-viewer.css?v=1.3" rel="stylesheet"/>
@@ -777,6 +778,15 @@
777778
</tbody>
778779
</table>
779780
</div>
781+
<div class="profiling_block">
782+
<div class="profiling_each_block">
783+
<input type="checkbox" id="enable_profiling"/>
784+
<label for="enable_profiling">Enable Profiling</label>
785+
</div>
786+
<div class="profiling_each_block">
787+
<input id="profiling_frequency" type="number" placeholder="Provide Profiling Frequency, Default is 10"/>
788+
</div>
789+
</div>
780790
<div class="response_summary">
781791
<div class="response_one_summary">
782792
<span class="response_one_summary_key">Status:</span>

js/dashboard.js

Lines changed: 106 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
var db = $(".form_selection").val();
22
var changedGroup = "";
3+
var averageTime = 0;
4+
var frequency = 10;
5+
var runnerCounter = 1;
36
var options = {
47
collapsed: false,
58
withQuotes: false
@@ -676,7 +679,7 @@ function errorNotification(content)
676679
function successNotification(content)
677680
{
678681
$(".modalbox_message_indicator").text("check_circle_outline");
679-
$(".modalbox_content").text(content);
682+
$(".modalbox_content").html(content);
680683
$(".modalbox_title").text("Success Message");
681684
$(".modalbox_overlay").fadeIn();
682685
$(".modalbox").animate({"top":"50%"});
@@ -812,43 +815,112 @@ $(".run_api_send").on("click", function(){
812815
localStorage.runheaders = JSON.stringify(headers);
813816
localStorage.runurlEndPoint = urlEndPoint;
814817
$(".loader_container").show();
815-
$.ajax({
816-
url: "run",
817-
type: "POST",
818-
dataType: "json",
819-
data: {
820-
method: method,
821-
params: params,
822-
headers: headers,
823-
urlEndPoint: urlEndPoint
824-
},
825-
success: function(apiData){
826-
$(".loader_container").hide();
827-
if (apiData["responseCode"] == 200) {
828-
$(".token_block").addClass("hidden");
829-
$(".status_summary").text("200 OK");
830-
localStorage.runresponse = JSON.stringify(apiData["data"]);
831-
$(".run_response_textarea pre").html(JSON.stringify(apiData["data"]));
832-
$(".run_response_textarea pre").jsonViewer(JSON.parse($(".run_response_textarea pre").text()), options);
833-
} else if (apiData["responseCode"] == 401) {
834-
$(".token_block").removeClass("hidden");
835-
$(".status_summary").text("401 Unauthorized");
836-
$(".token_summary").text(apiData["token"]);
818+
if ($("#enable_profiling").prop("checked")) {
819+
var tmpFrequency = $("#profiling_frequency").val().trim();
820+
if (tmpFrequency != "" && tmpFrequency > 1) {
821+
frequency = tmpFrequency;
822+
} else {
823+
frequency = 10;
824+
}
825+
averageTime = 0;
826+
runnerCounter = 1;
827+
profiling(method, params, headers, urlEndPoint);
828+
} else {
829+
$.ajax({
830+
url: "run",
831+
type: "POST",
832+
dataType: "json",
833+
data: {
834+
method: method,
835+
params: params,
836+
headers: headers,
837+
urlEndPoint: urlEndPoint
838+
},
839+
success: function(apiData){
840+
$(".loader_container").hide();
841+
if (apiData["responseCode"] == 200) {
842+
$(".token_block").addClass("hidden");
843+
$(".status_summary").text("200 OK");
844+
localStorage.runresponse = JSON.stringify(apiData["data"]);
845+
$(".run_response_textarea").html("<pre>"+JSON.stringify(apiData["data"])+"</pre>");
846+
$(".run_response_textarea pre").jsonViewer(JSON.parse($(".run_response_textarea pre").text()), options);
847+
} else if (apiData["responseCode"] == 401) {
848+
$(".token_block").removeClass("hidden");
849+
$(".status_summary").text("401 Unauthorized");
850+
$(".token_summary").text(apiData["token"]);
851+
localStorage.runresponse = JSON.stringify(apiData["data"]);
852+
$(".run_response_textarea").html("<pre>"+JSON.stringify(apiData["data"])+"</pre>");
853+
$(".run_response_textarea pre").jsonViewer(JSON.parse($(".run_response_textarea pre").text()), options);
854+
} else {
855+
$(".status_summary").text(apiData["responseCode"]);
856+
$(".run_response_textarea").html(apiData["data"]);
857+
}
858+
$(".time_summary").text(apiData["timetaken"]+" ms");
859+
var size = (apiData["size"]/1024);
860+
if (size < 1) {
861+
$(".size_summary").text(apiData["size"]+" B");
862+
} else {
863+
$(".size_summary").text(size.toFixed(2)+" KB");
864+
}
865+
},
866+
error: function(){
867+
$(".loader_container").hide();
837868
}
838-
$(".time_summary").text(apiData["timetaken"]+" ms");
839-
var size = (apiData["size"]/1024);
840-
if (size < 1) {
841-
$(".size_summary").text(apiData["size"]+" B");
869+
});
870+
}
871+
}
872+
});
873+
874+
function profiling (
875+
method,
876+
params,
877+
headers,
878+
urlEndPoint
879+
) {
880+
$.ajax({
881+
url: "run",
882+
type: "POST",
883+
dataType: "json",
884+
data: {
885+
method: method,
886+
params: params,
887+
headers: headers,
888+
urlEndPoint: urlEndPoint
889+
},
890+
success: function(apiData){
891+
if (apiData["responseCode"] == 200) {
892+
runnerCounter ++;
893+
averageTime += apiData["timetaken"];
894+
if (runnerCounter == frequency) {
895+
successNotification("Average time taken is <b>"+(averageTime/frequency).toFixed(2)+" ms</b> for <b>"+frequency+"</b> iteration(s).");
896+
$(".loader_container").hide();
842897
} else {
843-
$(".size_summary").text(size.toFixed(2)+" KB");
898+
profiling(method, params, headers, urlEndPoint);
844899
}
845-
},
846-
error: function(){
847-
$(".loader_container").hide();
900+
} else if (apiData["responseCode"] == 401) {
901+
$(".token_block").removeClass("hidden");
902+
$(".status_summary").text("401 Unauthorized");
903+
$(".token_summary").text(apiData["token"]);
904+
localStorage.runresponse = JSON.stringify(apiData["data"]);
905+
$(".run_response_textarea").html("<pre>"+JSON.stringify(apiData["data"])+"</pre>");
906+
$(".run_response_textarea pre").jsonViewer(JSON.parse($(".run_response_textarea pre").text()), options);
907+
} else {
908+
$(".status_summary").text(apiData["responseCode"]);
909+
$(".run_response_textarea").html(apiData["data"]);
848910
}
849-
});
850-
}
851-
});
911+
$(".time_summary").text(apiData["timetaken"]+" ms");
912+
var size = (apiData["size"]/1024);
913+
if (size < 1) {
914+
$(".size_summary").text(apiData["size"]+" B");
915+
} else {
916+
$(".size_summary").text(size.toFixed(2)+" KB");
917+
}
918+
},
919+
error: function(){
920+
$(".loader_container").hide();
921+
}
922+
});
923+
}
852924

853925
$(".run_api_add").on("click", function(){
854926
$(".loader_container").show();

0 commit comments

Comments
 (0)