diff --git a/gateway/assets/newfunction.html b/gateway/assets/newfunction.html new file mode 100644 index 00000000..d8d30b76 --- /dev/null +++ b/gateway/assets/newfunction.html @@ -0,0 +1,34 @@ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+ +
+
+ + + Close Dialog + + + Create + + +
diff --git a/gateway/assets/script/bootstrap.js b/gateway/assets/script/bootstrap.js index 72425375..154b336b 100644 --- a/gateway/assets/script/bootstrap.js +++ b/gateway/assets/script/bootstrap.js @@ -1,7 +1,8 @@ "use strict" var app = angular.module('faasGateway', ['ngMaterial']); -app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$mdDialog', function($scope, $log, $http, $location, $timeout, $mdDialog) { +app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$mdDialog', + function($scope, $log, $http, $location, $timeout, $mdDialog) { $scope.functions = []; $scope.invocationRequest = ""; $scope.invocationResponse = ""; @@ -9,6 +10,9 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md $scope.invocation = { contentType: "text" }; + $scope.functionTemplate = { + image: "" + }; $scope.invocation.request = "" setInterval(function() { refreshData(); @@ -32,9 +36,6 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md $scope.invocationResponse = error1; $scope.invocationStatus = null; }); - - // console.log("POST /function/"+ $scope.selectedFunction.name); - // console.log("Body: " + $scope.invocation.request); }; var refreshData = function() { @@ -77,29 +78,59 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$timeout', '$md } }; - var showDialog = function() { - var alert = $mdDialog.alert({ - title: 'New function', - textContent: 'New functions are not supported yet, but will be defined here.', - ok: 'Close' - }); - $mdDialog - .show(alert) - .finally(function() { - alert = undefined; - }); + var showDialog=function($event) { + var parentEl = angular.element(document.body); + $mdDialog.show({ + parent: parentEl, + targetEvent: $event, + templateUrl: "newfunction.html", + locals: { + item: $scope.functionTemplate + }, + controller: DialogController + }); + }; + + var DialogController = function($scope, $mdDialog, item) { + $scope.item = item; + $scope.closeDialog = function() { + $mdDialog.hide(); + }; + + $scope.createFunc = function() { + console.log($scope.item); + $scope.closeDialog(); + }; }; - // TODO: popup + form to create new Docker service. - // More to follow @ https://material.angularjs.org/latest/demo/dialog $scope.newFunction = function() { - // $scope.functions.push({ - // name: "f" + ($scope.functions.length + 2), - // replicas: 0, - // invokedCount: 0 - // }); - showDialog() + showDialog(); }; fetch(); -}]); \ No newline at end of file +}]); + + +// '' + +// ' '+ +// ''+ +// '
'+ +// ''+ +// ''+ +// ''+ +// ''+ +// ''+ +// ''+ +// ''+ +// ''+ +// '
'+ +// '
' + +// ' ' + +// ' ' + +// ' Close Dialog' + +// ' ' + +// ' ' + +// ' Create' + +// ' ' + +// ' ' + +// '
' \ No newline at end of file