mirror of
https://github.com/openfaas/faas.git
synced 2025-06-13 18:56:46 +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
@ -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>
|
||||
|
15
gateway/assets/script/bootstrap.js
vendored
15
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,6 +54,8 @@ 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) {
|
||||
@ -62,11 +66,16 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
|
||||
}
|
||||
$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 = "";
|
||||
}
|
||||
};
|
||||
|
||||
@ -194,4 +204,5 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
|
||||
};
|
||||
|
||||
fetch();
|
||||
}]);
|
||||
}
|
||||
]);
|
Loading…
x
Reference in New Issue
Block a user