mirror of
https://github.com/openfaas/faas.git
synced 2025-06-21 11:56:29 +00:00
Make UI block until function reports readiness
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
30
gateway/assets/script/bootstrap.js
vendored
30
gateway/assets/script/bootstrap.js
vendored
@ -31,11 +31,37 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
|
||||
labels: {}
|
||||
};
|
||||
|
||||
$scope.isReady = function(selectedFunction) {
|
||||
if(selectedFunction.ready != undefined && selectedFunction.ready) {
|
||||
return "Ready";
|
||||
}
|
||||
return "Querying..";
|
||||
}
|
||||
|
||||
$scope.invocation.request = "";
|
||||
|
||||
setInterval(function() {
|
||||
$scope.fetchFunctionsDelay = 3500;
|
||||
$scope.queryFunctionDelay = 2500;
|
||||
|
||||
$scope.fetchFunctionsInterval = setInterval(function() {
|
||||
refreshData();
|
||||
}, 1000);
|
||||
}, $scope.fetchFunctionsDelay);
|
||||
|
||||
$scope.queryFunctionInterval = setInterval(function() {
|
||||
if($scope.selectedFunction && $scope.selectedFunction.name) {
|
||||
refreshFunction($scope.selectedFunction);
|
||||
}
|
||||
}, $scope.queryFunctionDelay);
|
||||
|
||||
var refreshFunction = function(functionInstance) {
|
||||
$http.get("../system/function/" + functionInstance.name)
|
||||
.then(function(response) {
|
||||
functionInstance.ready = (response.data && response.data.availableReplicas && response.data.availableReplicas >0);
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.error(err);
|
||||
});
|
||||
};
|
||||
|
||||
var showPostInvokedToast = function(message, duration) {
|
||||
$mdToast.show(
|
||||
|
Reference in New Issue
Block a user