Skip to content
Snippets Groups Projects
Commit be4eea92 authored by Lucas Roesler's avatar Lucas Roesler Committed by Alex Ellis
Browse files

Add spinner during funciton invoke in the web ui


**What**
- Add a simple sinner when the function is invoked
- Disable the invoke button until the request returns

Signed-off-by: default avatarLucas Roesler <roesler.lucas@gmail.com>
parent fdbffa1e
No related branches found
No related tags found
No related merge requests found
......@@ -115,10 +115,11 @@
</span>
<div layout-gt-sm="row">
<md-input-container class="md-block" flex-gt-sm>
<button ng-click="fireRequest()" class="md-raised md-button md-ink-ripple" type="button">
<button ng-click="fireRequest()" class="md-raised md-button md-ink-ripple" type="button" ng-disabled="invocationInProgress">
<span class="ng-scope">Invoke</span><div class="md-ripple-container"></div>
</button>
</md-input-container>
<md-progress-circular md-mode="indeterminate" ng-show="invocationInProgress"></md-progress-circular>
</div>
<div layout-gt-sm="row">
......
......@@ -7,6 +7,7 @@ var app = angular.module('faasGateway', ['ngMaterial']);
app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$mdDialog', '$mdToast', '$mdSidenav',
function($scope, $log, $http, $location, $timeout, $mdDialog, $mdToast, $mdSidenav) {
$scope.functions = [];
$scope.invocationInProgress = false;
$scope.invocationRequest = "";
$scope.invocationResponse = "";
$scope.invocationStatus = "";
......@@ -41,7 +42,6 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
};
$scope.fireRequest = function() {
var options = {
url: "/function/" + $scope.selectedFunction.name,
data: $scope.invocation.request,
......@@ -49,6 +49,7 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
headers: { "Content-Type": $scope.invocation.contentType == "json" ? "application/json" : "text/plain" },
responseType: $scope.invocation.contentType
};
$scope.invocationInProgress = true;
$scope.invocationResponse = "";
$scope.invocationStatus = null;
......@@ -59,9 +60,11 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
} else {
$scope.invocationResponse = response.data;
}
$scope.invocationInProgress = false;
$scope.invocationStatus = response.status;
showPostInvokedToast("Success");
}).catch(function(error1) {
$scope.invocationInProgress = false;
$scope.invocationResponse = error1.statusText + "\n" + error1.data;
$scope.invocationStatus = error1.status;
......@@ -105,6 +108,7 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
$scope.invocation.request = "";
$scope.invocationResponse = "";
$scope.invocationStatus = "";
$scope.invocationInProgress = false;
$scope.invocation.contentType = "text";
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment