From 04fead5eabc4e68fcd746b8c400ded5eeb41266b Mon Sep 17 00:00:00 2001 From: Alistair Hey Date: Sun, 15 Dec 2019 16:23:26 +0000 Subject: [PATCH] Hide the namespace selector when on swarm or <2 K8s ns We now hide the new namespace dropdown selector when there is only 1 namespace, or when we are on swarm This is also hidden in the function create page and the function detail page Signed-off-by: Alistair Hey --- gateway/assets/index.html | 6 +++--- gateway/assets/script/bootstrap.js | 9 +++++++-- gateway/assets/templates/newfunction.html | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/gateway/assets/index.html b/gateway/assets/index.html index 8c1d0f29..48937e79 100644 --- a/gateway/assets/index.html +++ b/gateway/assets/index.html @@ -54,9 +54,9 @@ - + - + {{ namespace }} @@ -127,7 +127,7 @@ - + diff --git a/gateway/assets/script/bootstrap.js b/gateway/assets/script/bootstrap.js index 1966b69d..d31604fb 100644 --- a/gateway/assets/script/bootstrap.js +++ b/gateway/assets/script/bootstrap.js @@ -23,7 +23,6 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$interval', '$f contentType: "text" }; - $scope.namespaceSelect = $scope.selectedNamespace; $scope.baseUrl = $location.absUrl().replace(/\ui\/$/, ''); try { $scope.canCopyToClipboard = document.queryCommandSupported('copy'); @@ -43,6 +42,8 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$interval', '$f showPostInvokedToast(msg); } + + $scope.toggleSideNav = function() { $mdSidenav('left').toggle(); }; @@ -310,7 +311,7 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$interval', '$f $scope.labelsToLabelInputs(func.labels); $scope.annotationsToAnnotationInputs(func.annotations); $scope.secretsToSecretInputs(func.secrets); - $scope.item.namespace = func.selectedNamespace; + $scope.item.namespace = $scope.namespaceSelected(); $scope.selectedFunc = func; @@ -365,6 +366,10 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$interval', '$f }); }; + $scope.fnNamespaceSelected = function(inputNamespace) { + $scope.namespaceSelect = inputNamespace; + } + $scope.onEnvInputExpand = function() { $scope.envFieldsVisible = !$scope.envFieldsVisible; } diff --git a/gateway/assets/templates/newfunction.html b/gateway/assets/templates/newfunction.html index 92d10b38..891ab185 100644 --- a/gateway/assets/templates/newfunction.html +++ b/gateway/assets/templates/newfunction.html @@ -58,12 +58,12 @@ -
+
Namespace your function runs in i.e. 'openfaas-fn'. Only namespaces OpenFaaS can manage will show here - + {{ namespace }}