mirror of
https://github.com/openfaas/faas.git
synced 2025-06-15 19:56:47 +00:00
Give feedback via toast in UI.
This commit is contained in:
parent
5a58db2c50
commit
d127dc7cb0
20
gateway/assets/script/bootstrap.js
vendored
20
gateway/assets/script/bootstrap.js
vendored
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
var app = angular.module('faasGateway', ['ngMaterial']);
|
var app = angular.module('faasGateway', ['ngMaterial']);
|
||||||
|
|
||||||
app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$mdDialog',
|
app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$mdDialog', '$mdToast',
|
||||||
function($scope, $log, $http, $location, $timeout, $mdDialog) {
|
function($scope, $log, $http, $location, $timeout, $mdDialog, $mdToast) {
|
||||||
$scope.functions = [];
|
$scope.functions = [];
|
||||||
$scope.invocationRequest = "";
|
$scope.invocationRequest = "";
|
||||||
$scope.invocationResponse = "";
|
$scope.invocationResponse = "";
|
||||||
@ -22,10 +22,20 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.invocation.request = ""
|
$scope.invocation.request = ""
|
||||||
|
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
refreshData();
|
refreshData();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
|
$scope.showPostInvokedToast = function(val) {
|
||||||
|
$mdToast.show(
|
||||||
|
$mdToast.simple()
|
||||||
|
.textContent(val)
|
||||||
|
.position("top right")
|
||||||
|
.hideDelay(500)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
$scope.fireRequest = function() {
|
$scope.fireRequest = function() {
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
@ -35,18 +45,24 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md
|
|||||||
headers: { "Content-Type": $scope.invocation.contentType == "json" ? "application/json" : "text/plain" },
|
headers: { "Content-Type": $scope.invocation.contentType == "json" ? "application/json" : "text/plain" },
|
||||||
responseType: $scope.invocation.contentType
|
responseType: $scope.invocation.contentType
|
||||||
};
|
};
|
||||||
|
$scope.invocationResponse = "";
|
||||||
|
$scope.invocationStatus = null;
|
||||||
|
|
||||||
$http(options)
|
$http(options)
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
if($scope.invocation && $scope.invocation.contentType == "json") {
|
if($scope.invocation && $scope.invocation.contentType == "json") {
|
||||||
$scope.invocationResponse = JSON.stringify(response.data, -1, " ");
|
$scope.invocationResponse = JSON.stringify(response.data, -1, " ");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$scope.invocationResponse = response.data;
|
$scope.invocationResponse = response.data;
|
||||||
}
|
}
|
||||||
$scope.invocationStatus = response.status;
|
$scope.invocationStatus = response.status;
|
||||||
|
$scope.showPostInvokedToast("Success");
|
||||||
}).catch(function(error1) {
|
}).catch(function(error1) {
|
||||||
$scope.invocationResponse = error1.statusText + "\n" + error1.data;
|
$scope.invocationResponse = error1.statusText + "\n" + error1.data;
|
||||||
$scope.invocationStatus = error1.status;
|
$scope.invocationStatus = error1.status;
|
||||||
|
|
||||||
|
$scope.showPostInvokedToast("Error");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
export eTAG="latest-dev"
|
export eTAG="latest-dev"
|
||||||
echo $1
|
echo $1
|
||||||
if [ $1 ] ; then
|
if [ $1 ] ; then
|
||||||
echo "set this"
|
|
||||||
eTAG=$1
|
eTAG=$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user