diff --git a/gateway/assets/script/bootstrap.js b/gateway/assets/script/bootstrap.js index 38e5ce32e747893a983cc5d3123d7d8ee3c28e86..6c5af9a1f6f243e138b92d5cd0d4f7cd3486a59b 100644 --- a/gateway/assets/script/bootstrap.js +++ b/gateway/assets/script/bootstrap.js @@ -4,8 +4,8 @@ var app = angular.module('faasGateway', ['ngMaterial']); -app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$mdDialog', - function($scope, $log, $http, $location, $timeout, $mdDialog) { +app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$mdDialog', '$mdToast', + function($scope, $log, $http, $location, $timeout, $mdDialog, $mdToast) { $scope.functions = []; $scope.invocationRequest = ""; $scope.invocationResponse = ""; @@ -22,10 +22,20 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md }; $scope.invocation.request = "" + setInterval(function() { refreshData(); }, 1000); + $scope.showPostInvokedToast = function(val) { + $mdToast.show( + $mdToast.simple() + .textContent(val) + .position("top right") + .hideDelay(500) + ); + }; + $scope.fireRequest = function() { var options = { @@ -35,18 +45,24 @@ 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.invocationResponse = ""; + $scope.invocationStatus = null; $http(options) .then(function(response) { if($scope.invocation && $scope.invocation.contentType == "json") { $scope.invocationResponse = JSON.stringify(response.data, -1, " "); + } else { - $scope.invocationResponse = response.data; + $scope.invocationResponse = response.data; } $scope.invocationStatus = response.status; + $scope.showPostInvokedToast("Success"); }).catch(function(error1) { $scope.invocationResponse = error1.statusText + "\n" + error1.data; $scope.invocationStatus = error1.status; + + $scope.showPostInvokedToast("Error"); }); }; diff --git a/gateway/build.sh b/gateway/build.sh index 9e625a8855d30b3c4da5da16e1e98f1e926ebbbb..f1050d4cd80058d41b44c6ad46525f514b28a323 100755 --- a/gateway/build.sh +++ b/gateway/build.sh @@ -3,7 +3,6 @@ export eTAG="latest-dev" echo $1 if [ $1 ] ; then - echo "set this" eTAG=$1 fi