mirror of
https://github.com/openfaas/faas.git
synced 2025-06-08 16:26:47 +00:00
fixed unexpected behavior where the selected function properties don't get
updated after adding/deleting a different function. Signed-off-by: Ken Fukuyama <kenfdev@gmail.com>
This commit is contained in:
parent
02642ffb3f
commit
7d860bff41
@ -72,7 +72,7 @@
|
||||
<div flex></div>
|
||||
</md-content>
|
||||
|
||||
<md-content flex layout="column" ng-repeat="function in functions" ng-show="function.name == selectedFunction.name">
|
||||
<md-content flex layout="column" ng-repeat="function in functions" ng-if="function.name == selectedFunction.name">
|
||||
|
||||
<md-card md-theme="default" md-theme-watch>
|
||||
<md-card-title>
|
||||
|
20
gateway/assets/script/bootstrap.js
vendored
20
gateway/assets/script/bootstrap.js
vendored
@ -4,8 +4,8 @@
|
||||
|
||||
var app = angular.module('faasGateway', ['ngMaterial', 'faasGateway.funcStore']);
|
||||
|
||||
app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$mdDialog', '$mdToast', '$mdSidenav',
|
||||
function($scope, $log, $http, $location, $timeout, $mdDialog, $mdToast, $mdSidenav) {
|
||||
app.controller("home", ['$scope', '$log', '$http', '$location', '$interval', '$filter', '$mdDialog', '$mdToast', '$mdSidenav',
|
||||
function($scope, $log, $http, $location, $interval, $filter, $mdDialog, $mdToast, $mdSidenav) {
|
||||
var newFuncTabIdx = 0;
|
||||
$scope.functions = [];
|
||||
$scope.invocationInProgress = false;
|
||||
@ -31,19 +31,15 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
|
||||
labels: {}
|
||||
};
|
||||
|
||||
$scope.isReady = function(selectedFunction) {
|
||||
return (selectedFunction.ready != undefined && selectedFunction.ready == true);
|
||||
}
|
||||
|
||||
$scope.invocation.request = "";
|
||||
var fetchFunctionsDelay = 3500;
|
||||
var queryFunctionDelay = 2500;
|
||||
|
||||
var fetchFunctionsInterval = setInterval(function() {
|
||||
var fetchFunctionsInterval = $interval(function() {
|
||||
refreshData();
|
||||
}, fetchFunctionsDelay);
|
||||
|
||||
var queryFunctionInterval = setInterval(function() {
|
||||
var queryFunctionInterval = $interval(function() {
|
||||
if($scope.selectedFunction && $scope.selectedFunction.name) {
|
||||
refreshFunction($scope.selectedFunction);
|
||||
}
|
||||
@ -169,6 +165,14 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
|
||||
if (response && response.data) {
|
||||
if (previousItems.length != response.data.length) {
|
||||
$scope.functions = response.data;
|
||||
|
||||
// update the selected function object because the newly fetched object from the API becomes a different object
|
||||
var filteredSelectedFunction = $filter('filter')($scope.functions, {name: $scope.selectedFunction.name}, true);
|
||||
if (filteredSelectedFunction && filteredSelectedFunction.length > 0) {
|
||||
$scope.selectedFunction = filteredSelectedFunction[0];
|
||||
} else {
|
||||
$scope.selectedFunction = undefined;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < $scope.functions.length; i++) {
|
||||
for (var j = 0; j < response.data.length; j++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user