From 153a35821f0d25ce23cca467b76c5a7c5092c744 Mon Sep 17 00:00:00 2001 From: Tal Gitelman Date: Mon, 3 Jul 2017 20:16:55 +0300 Subject: [sdc] - last merges before moving to LF Change-Id: I0df3ec795f0de84229ea4bb4806ec8f959243557 Signed-off-by: Tal Gitelman --- .../graphs-v2/common/style/component-instances-nodes-style.ts | 9 ++++++--- .../directives/property-types/type-map/type-map-directive.html | 2 +- .../app/directives/property-types/type-map/type-map-directive.ts | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'catalog-ui/src/app/directives') 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 @@
Add
+ data-ng-class="{'disabled': readOnly || !schemaProperty.type || mapKeys.indexOf('')>-1 || !isMapKeysUnique}" data-ng-click="addMapItemFields()">Add
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;//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 = {}; -- cgit 1.2.3-korg