diff options
author | 2022-11-24 10:29:04 +0000 | |
---|---|---|
committer | 2023-01-26 23:32:10 +0000 | |
commit | 701e441228724c5b701d94cc3f1e520ce656398a (patch) | |
tree | 5900482086d86f8b8e465e6d4b57db4bd7a94184 /catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts | |
parent | 1bbecd7edbdd907a53812d303d378236d23d071e (diff) |
Import data type in UI
Develop all necessary changes in the UI to allow importing a data type from a yaml file
Issue-ID: SDC-4279
Signed-off-by: franciscovila <javier.paradela.vila@est.tech>
Change-Id: Id413386fad8b362e8c4a1d25c859a22178189074
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts')
-rw-r--r-- | catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts b/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts index f53ad5b376..bcc5fe9c28 100644 --- a/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts +++ b/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -import {Component, Input, OnInit} from '@angular/core'; +import {Component, Inject, Input, OnInit} from '@angular/core'; import {DataTypeModel} from "../../../../models/data-types"; import {DataTypeService} from "../../../services/data-type.service"; import {PropertyBEModel} from "../../../../models/properties-inputs/property-be-model"; @@ -30,6 +30,8 @@ import {ModalModel} from "../../../../models/modal"; import {ButtonModel} from "../../../../models/button"; import {TranslateService} from "../../../shared/translator/translate.service"; import {AddPropertyComponent, PropertyValidationEvent} from "./add-property/add-property.component"; +import {IWorkspaceViewModelScope} from "../../../../view-models/workspace/workspace-view-model"; +import {SdcUiServices} from "onap-ui-angular/dist"; @Component({ selector: 'app-type-workspace-properties', @@ -40,6 +42,8 @@ export class TypeWorkspacePropertiesComponent implements OnInit { @Input() isViewOnly = true; @Input() dataType: DataTypeModel = new DataTypeModel(); + importedFile: File; + derivedFromName: string; properties: Array<PropertyBEModel> = []; filteredProperties: Array<PropertyBEModel> = []; tableHeadersList: Array<TableHeader> = []; @@ -48,7 +52,12 @@ export class TypeWorkspacePropertiesComponent implements OnInit { tableFilterTerm: string = undefined; tableSearchTermUpdate = new Subject<string>(); - constructor(private dataTypeService: DataTypeService, private modalService: ModalService, private translateService: TranslateService) { + constructor(@Inject('$scope') private $scope: IWorkspaceViewModelScope, + @Inject('$state') private $state: ng.ui.IStateService, + protected dataTypeService: DataTypeService, + private modalServiceSdcUI: SdcUiServices.ModalService, + private modalService: ModalService, + private translateService: TranslateService) { } ngOnInit(): void { @@ -70,22 +79,12 @@ export class TypeWorkspacePropertiesComponent implements OnInit { {title: 'Required', property: 'required'}, {title: 'Description', property: 'description'}, ]; - this.tableSortBy = this.tableHeadersList[0].property; } private initProperties(): void { this.dataTypeService.findAllProperties(this.dataType.uniqueId).subscribe(properties => { - this.properties = properties.map(value => { - const property = new PropertyBEModel(value); - if (property.defaultValue) { - property.defaultValue = JSON.parse(property.defaultValue); - } - - return property; - }); - this.filteredProperties = Array.from(this.properties); - this.sort(); + this.showPropertiesMap(properties); }); } @@ -188,6 +187,19 @@ export class TypeWorkspacePropertiesComponent implements OnInit { onRowClick(property: PropertyBEModel) { this.openAddPropertyModal(property, true); } + + private showPropertiesMap(properties: Array<PropertyBEModel>): void { + this.properties = properties.map(value => { + const property = new PropertyBEModel(value); + if (property.defaultValue) { + property.defaultValue = JSON.parse(property.defaultValue); + } + + return property; + }); + this.filteredProperties = Array.from(this.properties); + this.sort(); + } } interface TableHeader { |