From a5445100050e49e83f73424198d73cd72d672a4d Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Sun, 4 Mar 2018 14:53:33 +0200 Subject: Sync Integ to Master Change-Id: I71e3acc26fa612127756ac04073a522b9cc6cd74 Issue-ID: SDC-977 Signed-off-by: Gitelman, Tal (tg851x) --- .../forms/artifact-form/artifact-form-view-model.ts | 1 + .../forms/attribute-form/attribute-from-view-model.ts | 1 + .../base-property-form/property-form-base-model.ts | 1 + .../component-property-form/property-form-view-model.ts | 3 ++- .../module-property-modal/module-property-model.ts | 12 +++++++++++- .../module-property-modal/module-property-view.html | 3 ++- .../resource-instance-name-model.ts | 1 + 7 files changed, 19 insertions(+), 3 deletions(-) (limited to 'catalog-ui/src/app/view-models/forms') diff --git a/catalog-ui/src/app/view-models/forms/artifact-form/artifact-form-view-model.ts b/catalog-ui/src/app/view-models/forms/artifact-form/artifact-form-view-model.ts index 1306565016..a09e30c330 100644 --- a/catalog-ui/src/app/view-models/forms/artifact-form/artifact-form-view-model.ts +++ b/catalog-ui/src/app/view-models/forms/artifact-form/artifact-form-view-model.ts @@ -19,6 +19,7 @@ */ 'use strict'; +import * as _ from "lodash"; import {ArtifactModel, Resource, Component} from "app/models"; import {ArtifactsUtils, FormState, ValidationUtils, ArtifactType} from "app/utils"; import {CacheService} from "app/services"; diff --git a/catalog-ui/src/app/view-models/forms/attribute-form/attribute-from-view-model.ts b/catalog-ui/src/app/view-models/forms/attribute-form/attribute-from-view-model.ts index 4c114b16e6..0e4a851aa6 100644 --- a/catalog-ui/src/app/view-models/forms/attribute-form/attribute-from-view-model.ts +++ b/catalog-ui/src/app/view-models/forms/attribute-form/attribute-from-view-model.ts @@ -19,6 +19,7 @@ */ 'use strict'; +import * as _ from "lodash"; import {AttributeModel, Component} from "app/models"; import {IMapRegex, ValidationUtils, FormState, PROPERTY_TYPES} from "app/utils"; diff --git a/catalog-ui/src/app/view-models/forms/property-forms/base-property-form/property-form-base-model.ts b/catalog-ui/src/app/view-models/forms/property-forms/base-property-form/property-form-base-model.ts index 726b61eda2..1f922cdaf9 100644 --- a/catalog-ui/src/app/view-models/forms/property-forms/base-property-form/property-form-base-model.ts +++ b/catalog-ui/src/app/view-models/forms/property-forms/base-property-form/property-form-base-model.ts @@ -22,6 +22,7 @@ * Created by obarda on 1/19/2017. */ 'use strict'; +import * as _ from "lodash"; import {DataTypesService} from "app/services/data-types-service"; import {PropertyModel, DataTypesMap, Component} from "app/models"; import {ValidationUtils, PROPERTY_DATA} from "app/utils"; diff --git a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts index 0ad55715db..8ea2e8cf76 100644 --- a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts +++ b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts @@ -19,6 +19,7 @@ */ 'use strict'; +import * as _ from "lodash"; import { PROPERTY_TYPES, ModalsHandler, ValidationUtils, PROPERTY_VALUE_CONSTRAINTS, FormState, PROPERTY_DATA} from "app/utils"; import {DataTypesService} from "app/services"; @@ -257,7 +258,7 @@ export class PropertyFormViewModel { let myValueString:string = JSON.stringify(this.$scope.myValue); property.value = myValueString; } - this.component.updateInstanceProperty(property).then(onPropertySuccess, onPropertyFaild); + this.component.updateInstanceProperties(property.resourceInstanceUniqueId, [property]).then((propertiesFromBE) => onPropertySuccess(propertiesFromBE[0]), onPropertyFaild); } else { if (!this.$scope.editPropertyModel.property.simpleType && !this.$scope.isSimpleType(property.type)) { let myValueString:string = JSON.stringify(this.$scope.myValue); diff --git a/catalog-ui/src/app/view-models/forms/property-forms/module-property-modal/module-property-model.ts b/catalog-ui/src/app/view-models/forms/property-forms/module-property-modal/module-property-model.ts index 3a61371e85..510814b333 100644 --- a/catalog-ui/src/app/view-models/forms/property-forms/module-property-modal/module-property-model.ts +++ b/catalog-ui/src/app/view-models/forms/property-forms/module-property-modal/module-property-model.ts @@ -22,6 +22,7 @@ * Created by obarda on 1/18/2017. */ 'use strict'; +import * as _ from "lodash"; import {PropertyModel, DisplayModule, Component, Resource, Service, ComponentInstance} from "app/models"; import {UNIQUE_GROUP_PROPERTIES_NAME} from "app/utils"; import {IPropertyFormBaseViewScope, PropertyFormBaseView} from "../base-property-form/property-form-base-model"; @@ -102,7 +103,9 @@ export class ModulePropertyView extends PropertyFormBaseView { } } else { deferred.resolve(true); - this.$uibModalInstance.close(); + if (isNeedToCloseModal === true) { + this.$uibModalInstance.close(); + } } return deferred.promise; @@ -147,6 +150,13 @@ export class ModulePropertyView extends PropertyFormBaseView { this.initValidation(); + this.$scope.clearValidationError = ():void => { + this.$scope.forms.editForm.$valid = true; + this.$scope.forms.editForm.$invalid = false; + this.$scope.forms.editForm['value'].$error = {}; + this.$scope.forms.editForm.$error = {}; + } + // put default value when instance value is empty this.$scope.onValueChange = ():void => { diff --git a/catalog-ui/src/app/view-models/forms/property-forms/module-property-modal/module-property-view.html b/catalog-ui/src/app/view-models/forms/property-forms/module-property-modal/module-property-view.html index 175f4c199b..ff48cc2357 100644 --- a/catalog-ui/src/app/view-models/forms/property-forms/module-property-modal/module-property-view.html +++ b/catalog-ui/src/app/view-models/forms/property-forms/module-property-modal/module-property-view.html @@ -12,7 +12,8 @@ name="value" data-ng-pattern="getValidationPattern(property.type)" data-ng-model-options="{ debounce: 200 }" - data-ng-change="onValueChange()" + data-ng-blur="onValueChange()" + data-ng-focus="clearValidationError()" />