summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/directives
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/directives')
-rw-r--r--catalog-ui/src/app/directives/graphs-v2/common/style/component-instances-nodes-style.ts9
-rw-r--r--catalog-ui/src/app/directives/property-types/type-map/type-map-directive.html2
-rw-r--r--catalog-ui/src/app/directives/property-types/type-map/type-map-directive.ts4
3 files changed, 11 insertions, 4 deletions
diff --git a/catalog-ui/src/app/directives/graphs-v2/common/style/component-instances-nodes-style.ts b/catalog-ui/src/app/directives/graphs-v2/common/style/component-instances-nodes-style.ts
index 971dabafe8..87acab6585 100644
--- a/catalog-ui/src/app/directives/graphs-v2/common/style/component-instances-nodes-style.ts
+++ b/catalog-ui/src/app/directives/graphs-v2/common/style/component-instances-nodes-style.ts
@@ -1,4 +1,7 @@
import {GraphColors} from "app/utils/constants";
+import constant = require("lodash/constant");
+import {ImagesUrl} from "app/utils/constants";
+import {AngularJSBridge} from "app/services/angular-js-bridge-service";
/**
* Created by obarda on 12/18/2016.
*/
@@ -215,7 +218,7 @@ export class ComponentInstanceNodesStyle {
type: "default",
single: false,
nodeTypeNames: ["basic-node"],
- imageUrl: '/assets/styles/images/resource-icons/' + 'canvasPlusIcon.png',
+ imageUrl: AngularJSBridge.getAngularConfig().imagesPath + ImagesUrl.CANVAS_PLUS_ICON,
lineWidth: 2,
lineStyle: 'dashed'
@@ -232,7 +235,7 @@ export class ComponentInstanceNodesStyle {
type: "default",
single: false,
nodeTypeNames: ["basic-small-node"],
- imageUrl: '/assets/styles/images/resource-icons/' + 'canvasPlusIcon.png',
+ imageUrl: AngularJSBridge.getAngularConfig().imagesPath + ImagesUrl.CANVAS_PLUS_ICON,
lineWidth: 2,
lineStyle: 'dashed'
}
@@ -248,7 +251,7 @@ export class ComponentInstanceNodesStyle {
type: "default",
single: false,
nodeTypeNames: ["ucpe-cp-node"],
- imageUrl: '/assets/styles/images/resource-icons/' + 'canvasPlusIcon.png',
+ imageUrl: AngularJSBridge.getAngularConfig().imagesPath + ImagesUrl.CANVAS_PLUS_ICON,
lineWidth: 2,
lineStyle: 'dashed'
}
diff --git a/catalog-ui/src/app/directives/property-types/type-map/type-map-directive.html b/catalog-ui/src/app/directives/property-types/type-map/type-map-directive.html
index 37b076f26e..3a4720676c 100644
--- a/catalog-ui/src/app/directives/property-types/type-map/type-map-directive.html
+++ b/catalog-ui/src/app/directives/property-types/type-map/type-map-directive.html
@@ -67,7 +67,7 @@
</div>
<div class="add-map-item" data-ng-class="{'schema-data-type':isSchemaTypeDataType}">
<div class="add-btn" data-tests-id="add-map-item"
- data-ng-class="{'disabled': readOnly || !schemaProperty.type || mapKeys.indexOf('')>-1}" data-ng-click="addMapItemFields()">Add</div>
+ data-ng-class="{'disabled': readOnly || !schemaProperty.type || mapKeys.indexOf('')>-1 || !isMapKeysUnique}" data-ng-click="addMapItemFields()">Add</div>
</div>
</div>
diff --git a/catalog-ui/src/app/directives/property-types/type-map/type-map-directive.ts b/catalog-ui/src/app/directives/property-types/type-map/type-map-directive.ts
index fa71e47804..03690b64f3 100644
--- a/catalog-ui/src/app/directives/property-types/type-map/type-map-directive.ts
+++ b/catalog-ui/src/app/directives/property-types/type-map/type-map-directive.ts
@@ -9,6 +9,7 @@ import {SchemaProperty} from "app/models";
export interface ITypeMapScope extends ng.IScope {
parentFormObj:ng.IFormController;
schemaProperty:SchemaProperty;
+ isMapKeysUnique:boolean;
isSchemaTypeDataType:boolean;
valueObjRef:any;
mapKeys:Array<string>;//array of map keys
@@ -54,6 +55,7 @@ export class TypeMapDirective implements ng.IDirective {
link = (scope:ITypeMapScope, element:any, $attr:any) => {
scope.MapKeyValidationPattern = this.MapKeyValidationPattern;
+ scope.isMapKeysUnique = true;
//reset valueObjRef and mapKeys when schema type is changed
scope.$watchCollection('schemaProperty.type', (newData:any):void => {
@@ -93,8 +95,10 @@ export class TypeMapDirective implements ng.IDirective {
let existsKeyIndex = Object.keys(scope.valueObjRef).indexOf(newKey);
if (existsKeyIndex > -1 && existsKeyIndex != index) {
scope.parentFormObj[fieldName].$setValidity('keyExist', false);
+ scope.isMapKeysUnique = false;
} else {
scope.parentFormObj[fieldName].$setValidity('keyExist', true);
+ scope.isMapKeysUnique = true;
if (!scope.parentFormObj[fieldName].$invalid) {
//To preserve the order of the keys, delete each one and recreate
let newObj = {};