diff --git a/gateway/assets/img/icons/ic_delete_black.svg b/gateway/assets/img/icons/ic_delete_black.svg new file mode 100644 index 00000000..f464281a --- /dev/null +++ b/gateway/assets/img/icons/ic_delete_black.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/gateway/assets/index.html b/gateway/assets/index.html index 4f9273b4..18badd0c 100644 --- a/gateway/assets/index.html +++ b/gateway/assets/index.html @@ -54,9 +54,17 @@ - - {{function.name}} - +
+ + {{function.name}} + + + + Delete + + + +
diff --git a/gateway/assets/script/bootstrap.js b/gateway/assets/script/bootstrap.js index 6c5af9a1..8edfdf87 100644 --- a/gateway/assets/script/bootstrap.js +++ b/gateway/assets/script/bootstrap.js @@ -151,5 +151,38 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md showDialog(); }; + $scope.deleteFunction = function($event) { + var confirm = $mdDialog.confirm() + .title('Delete Function') + .textContent('Are you sure you want to delete ' + $scope.selectedFunction.name + '?') + .ariaLabel('Delete function') + .targetEvent($event) + .ok('OK') + .cancel('Cancel'); + + $mdDialog.show(confirm) + .then(function() { + var options = { + url: "/system/functions", + data: { + functionName: $scope.selectedFunction.name + }, + method: "DELETE", + headers: { "Content-Type": "application/json"}, + responseType: "json" + }; + + return $http(options); + }).then(function(){ + $scope.showPostInvokedToast("Success"); + }).catch(function(err) { + if (err) { + // show error toast only if there actually is an err. + // because hitting 'Cancel' also rejects the promise. + $scope.showPostInvokedToast("Error"); + } + }); + }; + fetch(); }]);