This commit is contained in:
Alex Ellis 2017-09-13 09:54:14 -07:00
commit 622b24268d
3 changed files with 48 additions and 3 deletions

View File

@ -0,0 +1,4 @@
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/>
<path d="M0 0h24v24H0z" fill="none"/>
</svg>

After

Width:  |  Height:  |  Size: 241 B

View File

@ -54,9 +54,17 @@
<md-card-title>
<md-card-title-text>
<div layout="row" layout-align="space-between">
<span class="md-headline">
{{function.name}}
</span>
<md-button ng-click="deleteFunction()" class="md-icon-button" aria-label="Delete">
<md-tooltip md-direction="left">Delete</md-tooltip>
<md-icon md-svg-icon="img/icons/ic_delete_black.svg"></md-icon>
</md-button>
</div>
<div layout-gt-sm="row">
<md-input-container class="md-icon-float md-block">
<label>Replicas</label>

View File

@ -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();
}]);