mirror of
https://github.com/openfaas/faas.git
synced 2025-06-09 08:46:48 +00:00
Refresh function image during ui update loop
**What** - Update the function image value during the `refreshData` Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
This commit is contained in:
parent
0ae105164f
commit
cb367096ae
15
gateway/assets/script/bootstrap.js
vendored
15
gateway/assets/script/bootstrap.js
vendored
@ -180,17 +180,20 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$interval', '$f
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var refreshData = function() {
|
var refreshData = function () {
|
||||||
var previous = $scope.functions;
|
var previous = $scope.functions;
|
||||||
|
|
||||||
var cl = function(previousItems) {
|
var cl = function (previousItems) {
|
||||||
$http.get("../system/functions").then(function(response) {
|
$http.get("../system/functions").then(function (response) {
|
||||||
if (response && response.data) {
|
if (response == null || response.data == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (previousItems.length != response.data.length) {
|
if (previousItems.length != response.data.length) {
|
||||||
$scope.functions = response.data;
|
$scope.functions = response.data;
|
||||||
|
|
||||||
// update the selected function object because the newly fetched object from the API becomes a different object
|
// 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);
|
var filteredSelectedFunction = $filter('filter')($scope.functions, { name: $scope.selectedFunction.name }, true);
|
||||||
if (filteredSelectedFunction && filteredSelectedFunction.length > 0) {
|
if (filteredSelectedFunction && filteredSelectedFunction.length > 0) {
|
||||||
$scope.selectedFunction = filteredSelectedFunction[0];
|
$scope.selectedFunction = filteredSelectedFunction[0];
|
||||||
} else {
|
} else {
|
||||||
@ -200,13 +203,13 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$interval', '$f
|
|||||||
for (var i = 0; i < $scope.functions.length; i++) {
|
for (var i = 0; i < $scope.functions.length; i++) {
|
||||||
for (var j = 0; j < response.data.length; j++) {
|
for (var j = 0; j < response.data.length; j++) {
|
||||||
if ($scope.functions[i].name == response.data[j].name) {
|
if ($scope.functions[i].name == response.data[j].name) {
|
||||||
|
$scope.functions[i].image = response.data[j].image;
|
||||||
$scope.functions[i].replicas = response.data[j].replicas;
|
$scope.functions[i].replicas = response.data[j].replicas;
|
||||||
$scope.functions[i].invocationCount = response.data[j].invocationCount;
|
$scope.functions[i].invocationCount = response.data[j].invocationCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
cl(previous);
|
cl(previous);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user