Add auto-refresh to UI

This commit is contained in:
Alex Ellis
2017-01-22 14:11:36 +00:00
parent cf2317696d
commit 79bc6a54ea
6 changed files with 27 additions and 19 deletions

View File

@ -1,10 +1,18 @@
"use strict"
var app = angular.module('faasGateway', ['ngMaterial']);
app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', function($scope, $log, $http, $location, $timeout) {
$scope.functions = [];
$http.get("/system/functions").then(function(response) {
$scope.functions = response.data;
});
setInterval(function() {
fetch();
}, 1000);
var fetch = function() {
$http.get("/system/functions").then(function(response) {
$scope.functions = response.data;
});
};
$scope.showFunction = function(fn) {
$scope.selectedFunction = fn;
@ -18,4 +26,6 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', func
invokedCount: 0
});
};
fetch();
}]);