You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2019/12/20 16:14:28 UTC

[brooklyn-ui] 02/06: require endpoint when provider is azure-arm

This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git

commit cdfca29961cf688a50e148008b4d54b83c6cc060
Author: frogfather <j....@icloud.com>
AuthorDate: Fri Dec 20 10:25:40 2019 +0000

    require endpoint when provider is azure-arm
---
 .../location-manager/app/views/wizard/cloud/cloud.controller.js      | 5 +++++
 .../location-manager/app/views/wizard/cloud/cloud.template.html      | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ui-modules/location-manager/app/views/wizard/cloud/cloud.controller.js b/ui-modules/location-manager/app/views/wizard/cloud/cloud.controller.js
index 996a156..9309e50 100644
--- a/ui-modules/location-manager/app/views/wizard/cloud/cloud.controller.js
+++ b/ui-modules/location-manager/app/views/wizard/cloud/cloud.controller.js
@@ -71,6 +71,11 @@ export function wizardCloudController($element, $state, brSnackbar, locationSpec
         return disabled.indexOf(vm.provider) > -1;
     };
 
+    vm.isEndpointRequired = function () {
+        let required = ['jclouds:azurecompute-arm'];
+        return required.indexOf(vm.provider) > -1;
+    }
+
     vm.save = function () {
         let config = angular.copy(vm.config);
         if (vm.region) {
diff --git a/ui-modules/location-manager/app/views/wizard/cloud/cloud.template.html b/ui-modules/location-manager/app/views/wizard/cloud/cloud.template.html
index 418e2fb..7d22072 100644
--- a/ui-modules/location-manager/app/views/wizard/cloud/cloud.template.html
+++ b/ui-modules/location-manager/app/views/wizard/cloud/cloud.template.html
@@ -67,7 +67,10 @@
 
                     <div class="form-group" ng-class="{'has-error': form.endpoint.$invalid && form.endpoint.$touched}">
                         <label class="control-label" for="endpoint">Cloud endpoint</label>
-                        <input ng-model="vm.endpoint" type="text" class="form-control" id="endpoint" name="endpoint" ng-disabled="vm.isEndpointDisabled()" placeholder="If using a private cloud, the URL to connect to it is required">
+                        <input ng-model="vm.endpoint" type="text" class="form-control" id="endpoint" name="endpoint" ng-required="vm.isEndpointRequired()" ng-disabled="vm.isEndpointDisabled()" placeholder="If using a private cloud, the URL to connect to it is required">
+                        <p class="help-block" ng-show="form.$submitted || form.endpoint.$touched">
+                            <span ng-show="form.endpoint.$error.required">You must specify an endpoint with this provider</span>
+                        </p>
                     </div>
 
                     <div class="form-group" ng-class="{'has-error': form.identity.$invalid && form.identity.$touched}">