Improvement: Add property to VF - complex types 21/74921/4
authorTomasz Golabek <tomasz.golabek@nokia.com>
Wed, 19 Dec 2018 14:26:34 +0000 (15:26 +0100)
committerIdan Amit <idan.amit@intl.att.com>
Tue, 1 Jan 2019 09:29:17 +0000 (09:29 +0000)
Handling booleans inside map at parameter area

Change-Id: I7cc149e20ee133b22ede74f41f1d230cdd799d90
Issue-ID: SDC-1996
Signed-off-by: Tomasz Golabek <tomasz.golabek@nokia.com>
catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.html
catalog-ui/src/app/ng2/components/ui/dynamic-element/dynamic-element.component.ts

index ec33593..d4e7b02 100644 (file)
@@ -46,6 +46,7 @@
                 pattern="validationUtils.getValidationPattern(property.type)"
                 [value]="property.isDeclared ? property.value : property.valueObj"
                 [type]="property.isDeclared ? 'string' : property.type"
+                [childType]="property.schema.property.type"
                 [name]="property.name"
                 [path]="property.propertiesName"
                 (elementChanged)="onElementChanged($event)"
index c15f92c..76b0b9e 100644 (file)
@@ -16,6 +16,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ============LICENSE_END=========================================================
+ * Modifications copyright (c) 2018 Nokia
+ * ================================================================================
  */
 
 import * as _ from "lodash";
@@ -52,6 +54,7 @@ export class DynamicElementComponent {
 
     @ViewChild('target', { read: ViewContainerRef }) target: any;
     @Input() type: any;
+    @Input() childType: any;
     @Input() name: string;
     @Input() testId: string;
     @Input() readonly:boolean;
@@ -96,6 +99,9 @@ export class DynamicElementComponent {
             case this.type === 'boolean':
                 this.elementCreatorIdentifier = DynamicElementComponentCreatorIdentifier.BOOLEAN;
                 break;
+          case this.type === 'map':
+                this.createElementCreatorIdentifierForChild();
+                break;
             default:
                 this.elementCreatorIdentifier = DynamicElementComponentCreatorIdentifier.DEFAULT;
         }
@@ -118,6 +124,25 @@ export class DynamicElementComponent {
         }
     }
 
+    createElementCreatorIdentifierForChild():void{
+      switch(this.childType) {
+        case 'integer':
+          this.elementCreatorIdentifier = DynamicElementComponentCreatorIdentifier.INTEGER;
+          break;
+        case 'float':
+          this.elementCreatorIdentifier = DynamicElementComponentCreatorIdentifier.FLOAT;
+          break;
+        case 'string':
+          this.elementCreatorIdentifier = DynamicElementComponentCreatorIdentifier.STRING;
+          break;
+        case 'boolean':
+          this.elementCreatorIdentifier = DynamicElementComponentCreatorIdentifier.BOOLEAN;
+          break;
+        default:
+          this.elementCreatorIdentifier = DynamicElementComponentCreatorIdentifier.DEFAULT;
+      }
+    }
+
     createComponentByIdentifier() {
         switch(this.elementCreatorIdentifier) {
             case DynamicElementComponentCreatorIdentifier.SUBNETPOOLID: