From 988c855163f9511a45f11b16c592239edefdf305 Mon Sep 17 00:00:00 2001 From: Burton Rheutan Date: Sun, 6 Jan 2019 10:55:31 -0600 Subject: [PATCH] Gateway UI - validate manual input This change validates manual input to the gateway UI when deploying new functions. This is to prevent poor user experience when attempting to deploy a function manually from the UI. The validation check on the function name is the same pattern that is used in the CLI to ensure that when the deploy button is pressed, the function will not fail validation. Signed-off-by: Burton Rheutan --- gateway/assets/script/bootstrap.js | 2 +- gateway/assets/templates/newfunction.html | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gateway/assets/script/bootstrap.js b/gateway/assets/script/bootstrap.js index 01b002a2..57274dea 100644 --- a/gateway/assets/script/bootstrap.js +++ b/gateway/assets/script/bootstrap.js @@ -2,7 +2,7 @@ // Copyright (c) Alex Ellis 2017. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -var app = angular.module('faasGateway', ['ngMaterial', 'faasGateway.funcStore']); +var app = angular.module('faasGateway', ['ngMaterial', 'ngMessages', 'faasGateway.funcStore']); app.controller("home", ['$scope', '$log', '$http', '$location', '$interval', '$filter', '$mdDialog', '$mdToast', '$mdSidenav', function($scope, $log, $http, $location, $interval, $filter, $mdDialog, $mdToast, $mdSidenav) { diff --git a/gateway/assets/templates/newfunction.html b/gateway/assets/templates/newfunction.html index 659c154f..ec9dead4 100644 --- a/gateway/assets/templates/newfunction.html +++ b/gateway/assets/templates/newfunction.html @@ -28,13 +28,20 @@ Docker image name and tag to use for function i.e. functions/alpine:latest +
+
Docker image is required.
+
Name of the function - must be a valid DNS entry - + +
+
Function name is required.
+
Function name can only contain a-z, 0-9 and dashes
+
@@ -64,7 +71,7 @@ Close Dialog - + Deploy