summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/directives/property-types/type-map/type-map-directive.ts
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2017-07-03 20:16:55 +0300
committerTal Gitelman <tg851x@intl.att.com>2017-07-03 20:16:55 +0300
commit153a35821f0d25ce23cca467b76c5a7c5092c744 (patch)
tree0c66c4d1310019479e446ea3a4c26faffb0aa33f /catalog-ui/src/app/directives/property-types/type-map/type-map-directive.ts
parentffdda7d685029d6a88ac82ac637e43bba96423cb (diff)
[sdc] - last merges before moving to LF
Change-Id: I0df3ec795f0de84229ea4bb4806ec8f959243557 Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-ui/src/app/directives/property-types/type-map/type-map-directive.ts')
-rw-r--r--catalog-ui/src/app/directives/property-types/type-map/type-map-directive.ts4
1 files changed, 4 insertions, 0 deletions
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 = {};