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

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


The following commit(s) were added to refs/heads/master by this push:
     new 919ab159 Let the backend to validate versions; add rule to what is 
considered an update
     new b6a05291 Merge pull request #349 from 
algairim/improvements/catalog-saver
919ab159 is described below

commit 919ab15954941800e5db54de45f2e431a9229a01
Author: Mykola Mandra <[email protected]>
AuthorDate: Wed Jul 13 15:16:20 2022 +0100

    Let the backend to validate versions; add rule to what is considered an 
update
    
    Signed-off-by: Mykola Mandra <[email protected]>
---
 .../app/components/catalog-saver/catalog-saver.directive.js  | 12 +-----------
 .../catalog-saver/catalog-saver.modal.template.html          |  3 +--
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git 
a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
 
b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
index 6cd7ff48..3018f325 100644
--- 
a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
+++ 
b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
@@ -90,7 +90,7 @@ export function saveToCatalogModalDirective($rootScope, 
$uibModal, $injector, $f
             $scope.config.original = {}
         }
         $scope.isNewFromTemplate = () => ($scope.config.itemType !== 
'template' && $scope.config.original.itemType === 'template');
-        $scope.isUpdate = () => !$scope.isNewFromTemplate() && 
Object.keys($scope.config.original).length>0;
+        $scope.isUpdate = () => !$scope.isNewFromTemplate() && 
Object.keys($scope.config.original).length>0 && $scope.config.bundle === 
$scope.config.original.bundle;
         $scope.buttonTextFn = () => {
             const name = $scope.config.label || ($scope.isUpdate() && 
($scope.config.name || $scope.config.original.name || 
$scope.config.symbolicName || $scope.config.original.symbolicName));
             return !!name ? 'Update ' + name : 'Add to catalog';
@@ -417,16 +417,6 @@ export function catalogVersionDirective($parse) {
                 ctrl.$validate();
             }
         });
-        scope.$watch(attr.catalogVersionForce, value => {
-            if (force !== value) {
-                force = value;
-                ctrl.$validate();
-            }
-        });
-
-        ctrl.$validators.exist = (modelValue, viewValue) => {
-            return !angular.isDefined(matches) || ctrl.$isEmpty(viewValue) || 
viewValue.endsWith('SNAPSHOT') || force === true || matches.indexOf(viewValue) 
=== -1;
-        };
     }
 }
 
diff --git 
a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html
 
b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html
index b39fd73f..0bdfbcb0 100644
--- 
a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html
+++ 
b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html
@@ -51,7 +51,6 @@
             <p class="help-block">
                 <span ng-if="form.version.$error.required">You must specify a 
version</span>
                 <span ng-if="form.version.$error.pattern">The version can 
contain only letters, numbers as well as the following characters: 
<code>.</code>, <code>-</code> and <code>_</code></span>
-                <span ng-if="form.version.$error.exist">This version has 
already been used</span>
             </p>
         </div>
 
@@ -60,7 +59,7 @@
                 <label class="control-label">Bundle ID</label>
                 <div class="input-group">
                     <span class="input-group-addon">{{catalogBomPrefix}}</span>
-                    <input ng-model="config.bundle" ng-disabled="isUpdate() || 
state.saving" class="form-control" name="bundle" ng-pattern="state.pattern" 
autofocus placeholder="{{ defaultBundle || 'E.g. my-bundle-id' }}"/>
+                    <input ng-model="config.bundle" ng-disabled="state.saving" 
class="form-control" name="bundle" ng-pattern="state.pattern" autofocus 
placeholder="{{ defaultBundle || 'E.g. my-bundle-id' }}"/>
                 </div>
                 <p class="help-block" ng-show="form.bundle.$invalid">
                     <span ng-if="form.bundle.$error.pattern">The bundle ID can 
contain only letters, numbers as well as the following characters: 
<code>.</code>, <code>-</code> and <code>_</code></span>

Reply via email to