diff --git a/deploy_stack.sh b/deploy_stack.sh index c55fc271..a900d6d5 100755 --- a/deploy_stack.sh +++ b/deploy_stack.sh @@ -1,4 +1,4 @@ #!/bin/sh echo "Deploying stack" -docker stack rm func ; docker stack deploy func --compose-file docker-compose.yml +docker stack deploy func --compose-file docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml index e613213b..cf66e1da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -104,6 +104,15 @@ services: no_proxy: "gateway" https_proxy: $https_proxy + markdown: + image: alexellis2/faas-markdownrender:latest + depends_on: + - gateway + networks: + - functions + environment: + no_proxy: "gateway" + https_proxy: $https_proxy # alexacolorchange: # image: alexellis2/faas-alexachangecolorintent diff --git a/gateway/assets/index.html b/gateway/assets/index.html index 43b0c7ce..6f6f5d13 100644 --- a/gateway/assets/index.html +++ b/gateway/assets/index.html @@ -50,11 +50,11 @@
+ - @@ -77,12 +77,44 @@ - - + + + + + Invoke function + +
+ + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+ +
+
diff --git a/gateway/assets/script/bootstrap.js b/gateway/assets/script/bootstrap.js index 43ca49e0..c15ee55a 100644 --- a/gateway/assets/script/bootstrap.js +++ b/gateway/assets/script/bootstrap.js @@ -3,11 +3,55 @@ var app = angular.module('faasGateway', ['ngMaterial']); app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', function($scope, $log, $http, $location, $timeout) { $scope.functions = []; + $scope.invocationRequest = ""; + $scope.invocationResponse = ""; + $scope.invocationStatus = ""; + $scope.invocation = { + }; + $scope.invocation.request = "" setInterval(function() { - fetch(); + refreshData(); }, 1000); + $scope.fireRequest = function() { + $http({url:"/function/"+$scope.selectedFunction.name, data: $scope.invocation.request, method: "POST", headers: {"Content-Type": "text/plain"}, responseType: "text"}). + then(function(response) { + $scope.invocationResponse = response.data; + $scope.invocationStatus = response.status; + }).catch(function(error1) { + $scope.invocationResponse = error1; + $scope.invocationStatus = null; + }); + + console.log("POST /function/"+ $scope.selectedFunction.name); + console.log("Body: " + $scope.invocation.request); + }; + + var refreshData = function () { + var previous = $scope.functions; + + var cl = function(previousItems) { + $http.get("/system/functions").then(function(response) { + if(response && response.data) { + if(previousItems.length !=response.data.length) { + $scope.functions = response.data; + } else { + for(var i =0;i<$scope.functions.length;i++) { + for(var j =0;j