Merge pull request #349 from algairim/improvements/catalog-saver
Catalog-saver improvements
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 6cd7ff4..3018f32 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 @@
$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 @@
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 b39fd73..0bdfbcb 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>