From f21f1b1b1f474e311409693f5a49780101cb5bc5 Mon Sep 17 00:00:00 2001 From: shikha0203 Date: Wed, 22 Mar 2023 11:52:31 +0000 Subject: Enable using substitution mapping type directly Issue-ID: SDC-4435 Signed-off-by: shikha0203 Change-Id: Ia3120eb6f03ad861dc87de64a2cb81a61e048f4e --- .../dynamic-property.component.html | 4 ++- .../dynamic-property/dynamic-property.component.ts | 1 + .../properties-table.component.html | 5 +-- .../properties-table/properties-table.component.ts | 12 ++++--- .../properties-assignment.page.component.html | 10 +++--- .../properties-assignment.page.component.ts | 37 ++++++++++++++++++++-- 6 files changed, 55 insertions(+), 14 deletions(-) (limited to 'catalog-ui/src/app/ng2') diff --git a/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.html b/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.html index 038f5f5317..58303a9319 100644 --- a/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.html +++ b/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.html @@ -52,13 +52,14 @@ [name]="property.name" [path]="property.propertiesName" (elementChanged)="onElementChanged($event)" - [readonly]="readonly || property.isDeclared || property.isDisabled || property.isToscaFunction()" + [readonly]="readonly || property.isDeclared || property.isDisabled || property.isToscaFunction() || disablePropertyValue" [testId]="'prop-' + propertyTestsId" [declared] = "property.isDeclared" [constraints] = "constraints" > +
{{property.type | contentAfterLastDot }}
{{property.schema.property.type | contentAfterLastDot }}
@@ -81,6 +82,7 @@ = new EventEmitter(); diff --git a/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.html b/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.html index 6e4edddeb4..526ccf21ce 100644 --- a/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.html +++ b/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.html @@ -75,8 +75,8 @@ -
- +
+ = new EventEmitter(); @Output() selectPropertyRow: EventEmitter = new EventEmitter(); @Output() updateCheckedPropertyCount: EventEmitter = new EventEmitter(); // only for hasDeclareOption @@ -51,6 +50,8 @@ export class PropertiesTableComponent implements OnChanges { @Output() deleteProperty: EventEmitter = new EventEmitter(); private selectedPropertyToDelete: PropertyFEModel; + + sortBy: String; reverse: boolean; direction: number; @@ -59,7 +60,7 @@ export class PropertiesTableComponent implements OnChanges { readonly ascUpperLettersFirst = 1; readonly descLowerLettersFirst = -1; - constructor(private propertiesService: PropertiesService, private modalService: ModalService ) { + constructor(private propertiesService: PropertiesService, private modalService: ModalService) { } ngOnChanges(changes: SimpleChanges): void { @@ -113,6 +114,7 @@ export class PropertiesTableComponent implements OnChanges { this.togggleToscaBtn.emit(prop.isSelected); }; + onDeleteProperty = () => { this.deleteProperty.emit(this.selectedPropertyToDelete); this.modalService.closeCurrentModal(); diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html index 1d8a01d4c8..17c67f4929 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html @@ -29,7 +29,8 @@ [readonly]="isReadonly || resourceIsReadonly" [isLoading]="loadingProperties || savingChangedData" [hasDeclareOption]="true" - [showDelete]="!isReadOnly && isSelf()" + [showDelete]="!isReadonly && isSelf()" + [disablePropertyValue] = "disablePropertyValue()" (propertyChanged)="dataChanged($event)" (propertySelected)="propertySelected($event)" (selectPropertyRow)="selectPropertyRow($event)" @@ -38,14 +39,15 @@ (updateCheckedChildPropertyCount)="updateCheckedChildPropertyCount($event)" (togggleToscaBtn)="togggleToscaBtn($event)" (selectInstanceRow)="selectInstanceRow($event)" - (deleteProperty)="deleteProperty($event)"> + (deleteProperty)="deleteProperty($event)" + >
Add Property
+ (click)="addProperty(component.model)" data-tests-id="properties-add-button" [ngClass]="{'disabled': !showAddProperties()}" >Add Property
Add Input
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts index a987564df4..834f28ed27 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts @@ -71,6 +71,7 @@ import {TranslateService} from "../../shared/translator/translate.service"; import {ToscaFunction} from "../../../models/tosca-function"; import {SubPropertyToscaFunction} from "../../../models/sub-property-tosca-function"; import {DeclareInputComponent} from "./declare-input/declare-input.component"; +import {ElementService} from "../../services/element.service"; import {CustomToscaFunction} from "../../../models/default-custom-functions"; import {ToscaFunctionType} from "../../../models/tosca-function-type.enum"; @@ -128,6 +129,7 @@ export class PropertiesAssignmentComponent { selectedInstance_FlattenCapabilitiesList: Capability[]; componentInstancePropertyMap : PropertiesGroup; defaultInputName: string; + doNotExtendBaseType: boolean; @ViewChild('hierarchyNavTabs') hierarchyNavTabs: Tabs; @ViewChild('propertyInputTabs') propertyInputTabs: Tabs; @@ -150,7 +152,8 @@ export class PropertiesAssignmentComponent { private modalService: ModalService, private keysPipe: KeysPipe, private topologyTemplateService: TopologyTemplateService, - private translateService: TranslateService) { + private translateService: TranslateService, + private service: ElementService) { this.instanceFePropertiesMap = new InstanceFePropertiesMap(); /* This is the way you can access the component data, please do not use any data except metadata, all other data should be received from the new api calls on the first time @@ -236,7 +239,19 @@ export class PropertiesAssignmentComponent { }, error => { this.loadingInstances = false; }); //ignore error + let modelName = this.component.model ? this.component.model : null; + const categoryName= this.component.categories[0].name; + if (this.component.categories[0].name != null && this.component.model != null) { + this.service.getCategoryBaseTypes(categoryName, modelName).subscribe((response: ListBaseTypesResponse) => { + this.doNotExtendBaseType = response.doNotExtendBaseType; + this.loadingProperties = false; + }, error => { + //ignore error + }, () => { + this.loadingProperties = false; + }); + } this.stateChangeStartUnregister = this.$scope.$on('$stateChangeStart', (event, toState, toParams) => { // stop if has changed properties if (this.hasChangedData) { @@ -251,7 +266,7 @@ export class PropertiesAssignmentComponent { this.loadDataTypesByComponentModel(this.component.model); } - ngOnDestroy() { + ngOnDestroy(){ this.eventListenerService.unRegisterObserver(EVENTS.ON_LIFECYCLE_CHANGE); this.stateChangeStartUnregister(); } @@ -278,8 +293,26 @@ export class PropertiesAssignmentComponent { showAddProperties = (): boolean => { if (this.component.isService() && !(this.component).isSubstituteCandidate()) { return false; + } else if (this.hideAddProperties()) { + return false; } return this.isSelf(); + + } + + hideAddProperties = (): boolean => { + if (this.component.isService() && this.doNotExtendBaseType && this.isSelf) { + return true; + } + return false; + + } + + disablePropertyValue = () : boolean => { + if (this.component.isService() && this.doNotExtendBaseType){ + return true; + } + return false; } getServiceProperties() { -- cgit 1.2.3-korg