"use strict" 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() { 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