mirror of
https://github.com/openfaas/faas.git
synced 2025-06-10 09:16:48 +00:00
Enable client response time in the UI
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
parent
b19bf0a136
commit
9783f96f7b
@ -27,7 +27,7 @@
|
||||
|
||||
<md-toolbar class="md-theme-indigo">
|
||||
<div class="md-toolbar-tools">
|
||||
<a href="https://www.openfaas.com/" target="_blank"><img src="icon.png" alt="OpenFaaS Icon" width="60px" height="60px" class="md-avatar"/></a>
|
||||
<a href="https://www.openfaas.com/" target="_blank"><img src="icon.png" alt="OpenFaaS Icon" width="60px" height="60px" class="md-avatar" /></a>
|
||||
<h1 style="flex: 1 1 auto;"> OpenFaaS Portal</h1>
|
||||
<md-button ng-click="toggleSideNav()" class="md-icon-button" aria-label="Back" hide-gt-sm>
|
||||
<md-icon md-svg-icon="img/icons/ic_arrow_back_white.svg"></md-icon>
|
||||
@ -137,11 +137,16 @@
|
||||
<textarea ng-model="invocation.request" class="monospace" cols="80" rows="4"></textarea>
|
||||
</md-input-container>
|
||||
</div>
|
||||
|
||||
<div layout-gt-sm="row">
|
||||
<md-input-container class="md-block" flex-gt-sm>
|
||||
<label>Response status</label>
|
||||
<input ng-model="invocationStatus" type="text" readonly="readonly">
|
||||
</md-input-container>
|
||||
<md-input-container class="md-block" flex-gt-sm>
|
||||
<label>Round-trip (s)</label>
|
||||
<input ng-model="roundTripDuration" type="text" readonly="readonly">
|
||||
</md-input-container>
|
||||
</div>
|
||||
<div layout-gt-sm="row">
|
||||
<md-input-container class="md-block" flex-gt-sm>
|
||||
|
21
gateway/assets/script/bootstrap.js
vendored
21
gateway/assets/script/bootstrap.js
vendored
@ -11,6 +11,8 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
|
||||
$scope.invocationRequest = "";
|
||||
$scope.invocationResponse = "";
|
||||
$scope.invocationStatus = "";
|
||||
$scope.invocationStart = new Date().getTime();
|
||||
$scope.roundTripDuration = "";
|
||||
$scope.invocation = {
|
||||
contentType: "text"
|
||||
};
|
||||
@ -26,7 +28,7 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
|
||||
service: ""
|
||||
};
|
||||
|
||||
$scope.invocation.request = ""
|
||||
$scope.invocation.request = "";
|
||||
|
||||
setInterval(function() {
|
||||
refreshData();
|
||||
@ -52,21 +54,28 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
|
||||
$scope.invocationInProgress = true;
|
||||
$scope.invocationResponse = "";
|
||||
$scope.invocationStatus = null;
|
||||
$scope.roundTripDuration = "";
|
||||
$scope.invocationStart = new Date().getTime()
|
||||
|
||||
$http(options)
|
||||
.then(function(response) {
|
||||
if($scope.invocation && $scope.invocation.contentType == "json") {
|
||||
if ($scope.invocation && $scope.invocation.contentType == "json") {
|
||||
$scope.invocationResponse = JSON.stringify(response.data, -1, " ");
|
||||
} else {
|
||||
$scope.invocationResponse = response.data;
|
||||
}
|
||||
$scope.invocationInProgress = false;
|
||||
$scope.invocationStatus = response.status;
|
||||
var now = new Date().getTime();
|
||||
$scope.roundTripDuration = (now - $scope.invocationStart) / 1000;
|
||||
showPostInvokedToast("Success");
|
||||
|
||||
}).catch(function(error1) {
|
||||
$scope.invocationInProgress = false;
|
||||
$scope.invocationResponse = error1.statusText + "\n" + error1.data;
|
||||
$scope.invocationStatus = error1.status;
|
||||
var now = new Date().getTime();
|
||||
$scope.roundTripDuration = (now - $scope.invocationStart) / 1000;
|
||||
|
||||
showPostInvokedToast("Error");
|
||||
});
|
||||
@ -110,6 +119,7 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
|
||||
$scope.invocationStatus = "";
|
||||
$scope.invocationInProgress = false;
|
||||
$scope.invocation.contentType = "text";
|
||||
$scope.invocation.roundTripDuration = "";
|
||||
}
|
||||
};
|
||||
|
||||
@ -177,12 +187,12 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
|
||||
functionName: $scope.selectedFunction.name
|
||||
},
|
||||
method: "DELETE",
|
||||
headers: { "Content-Type": "application/json"},
|
||||
headers: { "Content-Type": "application/json" },
|
||||
responseType: "json"
|
||||
};
|
||||
|
||||
return $http(options);
|
||||
}).then(function(){
|
||||
}).then(function() {
|
||||
showPostInvokedToast("Success");
|
||||
}).catch(function(err) {
|
||||
if (err) {
|
||||
@ -194,4 +204,5 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
|
||||
};
|
||||
|
||||
fetch();
|
||||
}]);
|
||||
}
|
||||
]);
|
Loading…
x
Reference in New Issue
Block a user