summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2
diff options
context:
space:
mode:
authorKrupaNagabhushan <krupa.nagabhushan@est.tech>2021-01-12 13:41:59 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-04-09 06:46:27 +0000
commit6d65fde29c1859a7099d91ed0e8911bcb1823a38 (patch)
treea570de61d7bc39ccfdc2590d4813c97c2d58c18a /catalog-ui/src/app/ng2
parent74f9a13c4211c5d75bbcff1ceb794bd060c6a49f (diff)
Allow property to take its value from defined input list
Issue-ID: SDC-3547 Change-Id: Ic438e8f8943d0f1c656e386611b88b25f879e83b Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech> Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'catalog-ui/src/app/ng2')
-rw-r--r--catalog-ui/src/app/ng2/app.module.ts2
-rw-r--r--catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.html21
-rw-r--r--catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.ts2
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.html31
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.less43
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.ts67
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.module.ts48
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.module.ts3
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html7
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts432
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts3
-rw-r--r--catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts6
-rw-r--r--catalog-ui/src/app/ng2/services/properties.service.ts10
13 files changed, 509 insertions, 166 deletions
diff --git a/catalog-ui/src/app/ng2/app.module.ts b/catalog-ui/src/app/ng2/app.module.ts
index 55dd969a88..88a56100fe 100644
--- a/catalog-ui/src/app/ng2/app.module.ts
+++ b/catalog-ui/src/app/ng2/app.module.ts
@@ -93,6 +93,7 @@ import {ServiceDependenciesModule} from './components/logic/service-dependencies
import {ServiceDependenciesEditorModule} from './pages/service-dependencies-editor/service-dependencies-editor.module';
import {PropertyCreatorModule} from './pages/properties-assignment/property-creator/property-creator.module';
import {DeclareListModule} from './pages/properties-assignment/declare-list/declare-list.module';
+import { InputListModule } from "./pages/properties-assignment/input-list/input-list.module";
import {WorkflowServiceNg2} from './services/workflow.service';
import {ToscaTypesServiceNg2} from "./services/tosca-types.service";
import {CapabilitiesFilterPropertiesEditorComponentModule} from "./pages/composition/capabilities-filter-properties-editor/capabilities-filter-properties-editor.module";
@@ -149,6 +150,7 @@ export function configServiceFactory(config: ConfigService, authService: Authent
AttributesOutputsModule,
PropertyCreatorModule,
DeclareListModule,
+ InputListModule,
PluginFrameModule,
PluginsModule,
InterfaceOperationModule,
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 f6396e6f2c..78c3030842 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
@@ -15,20 +15,19 @@
<div *ngIf="!property.hidden" class="dynamic-property-row nested-level-{{nestedLevel}}" [@fadeIn]
- [ngClass]="{'selected': selectedPropertyId && selectedPropertyId === property.propertiesName, 'readonly': property.isDisabled ||property.isDeclared}"
+ [ngClass]="{'selected': selectedPropertyId && selectedPropertyId === property.propertiesName, 'readonly': property.isDisabled || property.isDeclared || property.isToscaGetFunction()}"
[class.with-top-border]="property.isChildOfListOrMap"
(click)="onClickPropertyRow(property, $event)">
<!-- LEFT CELL -->
<ng-container *ngIf="!isPropertyFEModel">
<div class="table-cell" *ngIf="canBeDeclared" [ngClass]="{'filtered':property.name === propertyNameSearchText}" [class.round-checkbox]="property.isDeclared"> <!-- simple children of complex type [@checkEffect]="property.isDeclared"-->
- <checkbox *ngIf="hasDeclareOption" [(checked)]="property.isSelected" [disabled]="property.isDisabled ||property.isDeclared || readonly" (checkedChange)="checkProperty.emit(property.propertiesName)" ></checkbox>
+ <checkbox *ngIf="hasDeclareOption" [(checked)]="property.isSelected" [disabled]="property.isDisabled || property.isDeclared || readonly || property.isToscaGetFunction()" (checkedChange)="checkProperty.emit(property.propertiesName)" ></checkbox>
<div class="inner-cell-div" tooltip="{{property.name}}"><span>{{property.name}}</span></div>
</div>
<div class="table-cell" *ngIf="!canBeDeclared && !property.isChildOfListOrMap">
<div class="inner-cell-div" tooltip="{{property.name}}"><span>{{property.name}}</span></div>
</div> <!-- simple children of complex type within map or list -->
<div class="table-cell map-entry" *ngIf="property.isChildOfListOrMap && propType == derivedPropertyTypes.MAP"><!-- map left cell -->
- <!--<input [value]="property.mapKey" [placeholder]="property.name" (input)="mapKeyChanged.emit($event.target.value)" [readonly]="readonly" type="text" [ngClass]="{'disabled':readonly, 'error':property.mapKeyError}" required/>-->
<dynamic-element #mapKeyInput
class="value-input"
pattern="validationUtils.getValidationPattern(string)"
@@ -42,31 +41,31 @@
</div>
</ng-container>
<!-- RIGHT CELL OR FULL WIDTH CELL-->
- <ng-container *ngIf="propType == derivedPropertyTypes.SIMPLE || property.isDeclared || (property.isChildOfListOrMap && propType == derivedPropertyTypes.MAP && property.schema.property.isSimpleType)">
+ <ng-container *ngIf="propType == derivedPropertyTypes.SIMPLE || property.isDeclared || property.isToscaGetFunction() || (property.isChildOfListOrMap && propType == derivedPropertyTypes.MAP && property.schema.property.isSimpleType)">
<div class="table-cell">
<dynamic-element class="value-input"
pattern="validationUtils.getValidationPattern(property.type)"
- [value]="property.isDeclared ? property.value : property.valueObj"
- [type]="property.isDeclared ? 'string' : property.type"
+ [value]="property.isDeclared || property.isToscaGetFunction() ? property.value : property.valueObj"
+ [type]="property.isDeclared || property.isToscaGetFunction() ? 'string' : property.type"
[name]="property.name"
[path]="property.propertiesName"
(elementChanged)="onElementChanged($event)"
- [readonly]="readonly || property.isDeclared || property.isDisabled"
+ [readonly]="readonly || property.isDeclared || property.isDisabled || property.isToscaGetFunction()"
[testId]="'prop-' + propertyTestsId"
[declared] = "property.isDeclared"
[constraints] = "constraints"
></dynamic-element>
</div>
</ng-container>
- <ng-container *ngIf="!isPropertyFEModel && propType != derivedPropertyTypes.SIMPLE && !property.isDeclared"> <!-- right cell for complex elements, or list complex -->
+ <ng-container *ngIf="!isPropertyFEModel && propType != derivedPropertyTypes.SIMPLE && !property.isDeclared && !property.isToscaGetFunction()"> <!-- right cell for complex elements, or list complex -->
<div class="table-cell" *ngIf="propType == derivedPropertyTypes.COMPLEX">{{property.type | contentAfterLastDot }}</div>
<div class="table-cell" *ngIf="propType == derivedPropertyTypes.MAP && !property.schema.property.isSimpleType">{{property.schema.property.type | contentAfterLastDot }}</div>
</ng-container>
- <ng-container *ngIf="isPropertyFEModel && (propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && !property.isDeclared"><!-- empty, full-width table cell - for PropertyFEModel of type list or map -->
+ <ng-container *ngIf="isPropertyFEModel && (propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && !property.isDeclared && !property.isToscaGetFunction()"><!-- empty, full-width table cell - for PropertyFEModel of type list or map -->
<div class="table-cell empty"></div>
</ng-container>
<!-- ICONS: add, delete, and expand -->
- <ng-container *ngIf="!property.isDeclared">
+ <ng-container *ngIf="!property.isDeclared && !property.isToscaGetFunction()">
<a *ngIf="(propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && !property.isChildOfListOrMap" class="property-icon add-item" (click)="createNewChildProperty();" [ngClass]="{'disabled':readonly || preventInsertItem(property)}" [attr.data-tests-id]="'add-to-list-' + propertyTestsId">Add value to list</a>
<span *ngIf="property.isChildOfListOrMap" (click)="deleteItem.emit(property);" class="property-icon sprite-new delete-item-icon" [ngClass]="{'disabled':readonly}" [attr.data-tests-id]="'delete-from-list-' + propertyTestsId"></span>
<span *ngIf="!isPropertyFEModel && (propType == derivedPropertyTypes.COMPLEX || ((propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && hasChildren))" (click)="expandChildById(propPath)" class="property-icon sprite-new round-expand-icon" [class.open]="expandedChildId.indexOf(propPath) == 0" [attr.data-tests-id]="'expand-' + propertyTestsId" ></span>
@@ -74,7 +73,7 @@
</div>
<!-- FLAT CHILDREN -->
-<div class="flat-children-container" *ngIf="isPropertyFEModel && !property.isDeclared">
+<div class="flat-children-container" *ngIf="isPropertyFEModel && !property.isDeclared && !property.isToscaGetFunction()">
<ng-container *ngFor="let prop of property.flattenedChildren | filterChildProperties: expandedChildId; trackBy:prop?.propertiesName">
<dynamic-property
[selectedPropertyId]="selectedPropertyId"
diff --git a/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.ts b/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.ts
index 715426f212..1e51b41bf0 100644
--- a/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.ts
+++ b/catalog-ui/src/app/ng2/components/logic/properties-table/dynamic-property/dynamic-property.component.ts
@@ -84,7 +84,7 @@ export class DynamicPropertyComponent {
let primitiveProperties = ['string', 'integer', 'float', 'boolean'];
//Property has constraints
- if(this.property.constraints){
+ if(this.property.constraints && this.property.constraints[0]){
this.constraints = this.property.constraints[0].validValues
}
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.html b/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.html
new file mode 100644
index 0000000000..e0804637c6
--- /dev/null
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.html
@@ -0,0 +1,31 @@
+<!--
+ ~ ============LICENSE_START=======================================================
+ ~ Copyright (C) 2021 Nordix Foundation
+ ~ ================================================================================
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ ~ SPDX-License-Identifier: Apache-2.0
+ ~ ============LICENSE_END=========================================================
+ -->
+
+<div class="input-list">
+ <loader [display]="isLoading" [loaderDelay]="500" [relative]="true" [size]="'large'"></loader>
+ <form class="w-sdc-form">
+ <div class="i-sdc-form-item">
+ <label class="i-sdc-form-label required">Input Value</label>
+ <select [(ngModel)]="selectInputValue" name="selectInputValue">
+ <option *ngFor="let index of inputModel"
+ [ngValue]="index">{{index.name}}</option>
+ </select>
+ </div>
+ </form>
+</div>
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.less b/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.less
new file mode 100644
index 0000000000..e1e9b0d20d
--- /dev/null
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.less
@@ -0,0 +1,43 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+@import '../../../../../assets/styles/variables.less';
+
+.input-list {
+ font-family: @font-opensans-regular;
+ user-select: none;
+ padding-top: 12px;
+ padding-bottom: 20px;
+
+ .i-sdc-form-label {
+ font-size: 12px;
+ }
+
+ .w-sdc-form .i-sdc-form-item {
+ margin-bottom: 15px;
+ }
+
+ .side-by-side {
+ display: flex;
+
+ .i-sdc-form-item {
+ flex-basis: 100%;
+ }
+ }
+}
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.ts
new file mode 100644
index 0000000000..64ebcaa540
--- /dev/null
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.ts
@@ -0,0 +1,67 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+import {Component} from '@angular/core';
+import {InputBEModel, ComponentMetadata} from 'app/models';
+import {TopologyTemplateService} from "../../../services/component-services/topology-template.service";
+import {WorkspaceService} from "../../workspace/workspace.service";
+import {PropertiesService} from "../../../services/properties.service";
+
+@Component({
+ selector: 'input-list',
+ templateUrl: './input-list.component.html',
+ styleUrls: ['./input-list.component.less'],
+})
+
+export class InputListComponent {
+
+ selectInputValue;
+ inputModel: Array<InputBEModel> = [];
+ isLoading: boolean;
+ propertyType: string;
+
+ private componentMetadata: ComponentMetadata;
+
+ constructor(private topologyTemplateService: TopologyTemplateService,
+ private workspaceService: WorkspaceService,
+ private propertiesService: PropertiesService
+ ) {}
+
+ ngOnInit() {
+ this.componentMetadata = this.workspaceService.metadata;
+ this.propertyType = this.propertiesService.getCheckedPropertyType();
+ this.loadInputValues(this.propertyType);
+ }
+
+ private loadInputValues(propertyType: string): void {
+ this.isLoading = true;
+ this.topologyTemplateService.getComponentInputsValues(this.componentMetadata.componentType, this.componentMetadata.uniqueId)
+ .subscribe((response) => {
+ response.inputs.forEach((input: any) => {
+ if (input.type === propertyType) {
+ this.inputModel.push(input);
+ }
+ });
+ }, () => {
+ //error ignored
+ }, () => {
+ this.isLoading = false;
+ });
+ }
+}
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.module.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.module.ts
new file mode 100644
index 0000000000..50d7b08314
--- /dev/null
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.module.ts
@@ -0,0 +1,48 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+import { CommonModule } from '@angular/common';
+import { NgModule } from '@angular/core';
+import { FormsModule } from '@angular/forms';
+import { FormElementsModule } from 'app/ng2/components/ui/form-components/form-elements.module';
+import { UiElementsModule } from 'app/ng2/components/ui/ui-elements.module';
+import { TranslateModule } from '../../../shared/translator/translate.module';
+import { InputListComponent } from './input-list.component';
+import { SdcUiComponentsModule } from 'onap-ui-angular';
+
+@NgModule({
+ declarations: [
+ InputListComponent,
+ ],
+ imports: [
+ CommonModule,
+ FormsModule,
+ FormElementsModule,
+ UiElementsModule,
+ TranslateModule,
+ SdcUiComponentsModule
+ ],
+ exports: [],
+ entryComponents: [
+ InputListComponent
+ ],
+ providers: []
+})
+
+export class InputListModule {}
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.module.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.module.ts
index 0d676ed950..ae4aa57572 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.module.ts
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.module.ts
@@ -52,7 +52,8 @@ import {HierarchyNavigationModule} from "../../components/logic/hierarchy-navigt
HierarchyNavigationModule,
UiElementsModule,
SdcUiComponentsModule,
- ModalFormsModule],
+ ModalFormsModule
+ ],
entryComponents: [PropertiesAssignmentComponent],
exports: [
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 6b3e92adfd..7da0ecdbbd 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
@@ -75,9 +75,14 @@
<span class="sprite search-icon" data-tests-id="search-button"></span>
<filter-properties-assignment *ngIf="isPropertiesTabSelected" #advanceSearch class="advance-search" [componentType]="component.componentType" (searchProperties)="searchPropertiesInstances($event)"></filter-properties-assignment>
</div>
+ <button (click)="selectInput()"
+ *ngIf="isPropertiesTabSelected && !isSelf()"
+ [disabled]="checkedPropertiesCount != 1 || isReadonly || hasChangedData"
+ class="tlv-btn blue declare-button"
+ data-tests-id="declare-button declare-input">{{btnSelectInputText}}</button>
<button class="tlv-btn blue declare-button" [disabled]="!checkedPropertiesCount || isReadonly || hasChangedData" (click)="declareProperties()" data-tests-id="declare-button declare-input">Declare Input</button>
<button class="tlv-btn blue declare-button" [disabled]="!checkedPropertiesCount || isReadonly || hasChangedData || isSelf()" (click)="declarePropertiesToPolicies()" data-tests-id="declare-button declare-policy">Declare Policy</button>
- <button class="tlv-btn blue declare-button" [disabled]="!checkedPropertiesCount || checkedChildPropertiesCount || isReadonly || hasChangedData" (click)="declareListProperties()" data-tests-id="declare-button declare-list-input">Create List Input</button>
+ <button class="tlv-btn blue declare-button" [disabled]="!checkedPropertiesCount || checkedChildPropertiesCount || isReadonly || hasChangedData" (click)="declareListProperties()" data-tests-id="declare-but($event)ton declare-list-input">Create List Input</button>
</div>
</div>
<div class="right-column">
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 8cdc761ed4..6d009a8039 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
@@ -19,34 +19,54 @@
*/
import * as _ from "lodash";
-import { Component, ViewChild, Inject, TemplateRef } from "@angular/core";
-import { PropertiesService } from "../../services/properties.service";
-import { PropertyFEModel, InstanceFePropertiesMap, InstanceBePropertiesMap, InstancePropertiesAPIMap, Component as ComponentData, FilterPropertiesAssignmentData, ModalModel, ButtonModel } from "app/models";
-import { ResourceType } from "app/utils";
-import { ComponentServiceNg2 } from "../../services/component-services/component.service";
-import { TopologyTemplateService } from "../../services/component-services/topology-template.service";
-import { ComponentInstanceServiceNg2 } from "../../services/component-instance-services/component-instance.service"
-import { InputBEModel, InputFEModel, ComponentInstance, GroupInstance, PolicyInstance, PropertyBEModel, DerivedFEProperty, SimpleFlatProperty } from "app/models";
-import { KeysPipe } from 'app/ng2/pipes/keys.pipe';
-import { WorkspaceMode, EVENTS, PROPERTY_TYPES } from "../../../utils/constants";
-import { EventListenerService } from "app/services/event-listener-service"
-import { HierarchyDisplayOptions } from "../../components/logic/hierarchy-navigtion/hierarchy-display-options";
-import { FilterPropertiesAssignmentComponent } from "../../components/logic/filter-properties-assignment/filter-properties-assignment.component";
-import { PropertyRowSelectedEvent } from "../../components/logic/properties-table/properties-table.component";
-import { HierarchyNavService } from "./services/hierarchy-nav.service";
-import { PropertiesUtils } from "./services/properties.utils";
-import { ComponentModeService } from "../../services/component-services/component-mode.service";
-import { Tabs, Tab } from "../../components/ui/tabs/tabs.component";
-import { InputsUtils } from "./services/inputs.utils";
-import { InstanceFeDetails } from "../../../models/instance-fe-details";
-import { SdcUiServices, SdcUiCommon } from "onap-ui-angular";
-import { UnsavedChangesComponent } from "app/ng2/components/ui/forms/unsaved-changes/unsaved-changes.component";
+import {Component, Inject, ViewChild} from "@angular/core";
+import {PropertiesService} from "../../services/properties.service";
+import {
+ ButtonModel,
+ Component as ComponentData,
+ ComponentInstance,
+ DerivedFEProperty,
+ FilterPropertiesAssignmentData,
+ GroupInstance,
+ InputBEModel,
+ InputFEModel,
+ InstanceBePropertiesMap,
+ InstanceFePropertiesMap,
+ InstancePropertiesAPIMap,
+ ModalModel,
+ PolicyInstance,
+ PropertyBEModel,
+ PropertyFEModel,
+ PropertyInputDetail,
+ SimpleFlatProperty
+} from "app/models";
+import {ResourceType} from "app/utils";
+import {ComponentServiceNg2} from "../../services/component-services/component.service";
+import {TopologyTemplateService} from "../../services/component-services/topology-template.service";
+import {ComponentInstanceServiceNg2} from "../../services/component-instance-services/component-instance.service"
+import {KeysPipe} from 'app/ng2/pipes/keys.pipe';
+import {EVENTS, PROPERTY_TYPES, WorkspaceMode} from "../../../utils/constants";
+import {EventListenerService} from "app/services/event-listener-service"
+import {HierarchyDisplayOptions} from "../../components/logic/hierarchy-navigtion/hierarchy-display-options";
+import {FilterPropertiesAssignmentComponent} from "../../components/logic/filter-properties-assignment/filter-properties-assignment.component";
+import {PropertyRowSelectedEvent} from "../../components/logic/properties-table/properties-table.component";
+import {HierarchyNavService} from "./services/hierarchy-nav.service";
+import {PropertiesUtils} from "./services/properties.utils";
+import {ComponentModeService} from "../../services/component-services/component-mode.service";
+import {Tab, Tabs} from "../../components/ui/tabs/tabs.component";
+import {InputsUtils} from "./services/inputs.utils";
+import {InstanceFeDetails} from "../../../models/instance-fe-details";
+import {SdcUiCommon, SdcUiServices} from "onap-ui-angular";
+import {UnsavedChangesComponent} from "app/ng2/components/ui/forms/unsaved-changes/unsaved-changes.component";
import {PropertyCreatorComponent} from "./property-creator/property-creator.component";
import {ModalService} from "../../services/modal.service";
-import { DeclareListComponent } from "./declare-list/declare-list.component";
-import { CapabilitiesGroup, Capability } from "../../../models/capability";
-import { ToscaPresentationData } from "../../../models/tosca-presentation";
-import { Observable } from "rxjs";
+import {DeclareListComponent} from "./declare-list/declare-list.component";
+import {InputListComponent} from "./input-list/input-list.component";
+import {CapabilitiesGroup, Capability} from "../../../models/capability";
+import {ToscaPresentationData} from "../../../models/tosca-presentation";
+import {Observable} from "rxjs";
+import {ToscaGetFunctionType} from "../../../models/tosca-get-function-type.enum";
+import {TranslateService} from "../../shared/translator/translate.service";
const SERVICE_SELF_TITLE = "SELF";
@Component({
@@ -62,61 +82,65 @@ export class PropertiesAssignmentComponent {
propertiesNavigationData = [];
instancesNavigationData = [];
- instanceFePropertiesMap:InstanceFePropertiesMap;
+ instanceFePropertiesMap: InstanceFePropertiesMap;
inputs: Array<InputFEModel> = [];
policies: Array<PolicyInstance> = [];
- instances: Array<ComponentInstance|GroupInstance|PolicyInstance> = [];
+ instances: Array<ComponentInstance | GroupInstance | PolicyInstance> = [];
searchQuery: string;
propertyStructureHeader: string;
selectedFlatProperty: SimpleFlatProperty = new SimpleFlatProperty();
- selectedInstanceData: ComponentInstance|GroupInstance|PolicyInstance = null;
+ selectedInstanceData: ComponentInstance | GroupInstance | PolicyInstance = null;
checkedPropertiesCount: number = 0;
checkedChildPropertiesCount: number = 0;
- hierarchyPropertiesDisplayOptions:HierarchyDisplayOptions = new HierarchyDisplayOptions('path', 'name', 'childrens');
- hierarchyInstancesDisplayOptions:HierarchyDisplayOptions = new HierarchyDisplayOptions('uniqueId', 'name', 'archived', null, 'iconClass');
+ hierarchyPropertiesDisplayOptions: HierarchyDisplayOptions = new HierarchyDisplayOptions('path', 'name', 'childrens');
+ hierarchyInstancesDisplayOptions: HierarchyDisplayOptions = new HierarchyDisplayOptions('uniqueId', 'name', 'archived', null, 'iconClass');
displayClearSearch = false;
- searchPropertyName:string;
- currentMainTab:Tab;
- isInputsTabSelected:boolean;
- isPropertiesTabSelected:boolean;
- isPoliciesTabSelected:boolean;
- isReadonly:boolean;
- resourceIsReadonly:boolean;
- loadingInstances:boolean = false;
- loadingInputs:boolean = false;
- loadingPolicies:boolean = false;
- loadingProperties:boolean = false;
- changedData:Array<PropertyFEModel|InputFEModel>;
- hasChangedData:boolean;
- isValidChangedData:boolean;
- savingChangedData:boolean;
- stateChangeStartUnregister:Function;
+ searchPropertyName: string;
+ currentMainTab: Tab;
+ isInputsTabSelected: boolean;
+ isPropertiesTabSelected: boolean;
+ isInputValueSelected: boolean = false;
+ isPoliciesTabSelected: boolean;
+ isReadonly: boolean;
+ resourceIsReadonly: boolean;
+ loadingInstances: boolean = false;
+ loadingInputs: boolean = false;
+ loadingPolicies: boolean = false;
+ loadingProperties: boolean = false;
+ changedData: Array<PropertyFEModel | InputFEModel>;
+ hasChangedData: boolean;
+ isValidChangedData: boolean;
+ savingChangedData: boolean;
+ stateChangeStartUnregister: Function;
serviceBePropertiesMap: InstanceBePropertiesMap;
serviceBeCapabilitiesPropertiesMap: InstanceBePropertiesMap;
selectedInstance_FlattenCapabilitiesList: Capability[];
+ propertyType: string;
+ btnSelectInputText: string;
@ViewChild('hierarchyNavTabs') hierarchyNavTabs: Tabs;
@ViewChild('propertyInputTabs') propertyInputTabs: Tabs;
@ViewChild('advanceSearch') advanceSearch: FilterPropertiesAssignmentComponent;
-
+
constructor(private propertiesService: PropertiesService,
private hierarchyNavService: HierarchyNavService,
- private propertiesUtils:PropertiesUtils,
- private inputsUtils:InputsUtils,
- private componentServiceNg2:ComponentServiceNg2,
- private componentInstanceServiceNg2:ComponentInstanceServiceNg2,
+ private propertiesUtils: PropertiesUtils,
+ private inputsUtils: InputsUtils,
+ private componentServiceNg2: ComponentServiceNg2,
+ private componentInstanceServiceNg2: ComponentInstanceServiceNg2,
@Inject("$stateParams") _stateParams,
- @Inject("$scope") private $scope:ng.IScope,
- @Inject("$state") private $state:ng.ui.IStateService,
- @Inject("Notification") private Notification:any,
- private componentModeService:ComponentModeService,
- private EventListenerService:EventListenerService,
+ @Inject("$scope") private $scope: ng.IScope,
+ @Inject("$state") private $state: ng.ui.IStateService,
+ @Inject("Notification") private Notification: any,
+ private componentModeService: ComponentModeService,
+ private EventListenerService: EventListenerService,
private ModalServiceSdcUI: SdcUiServices.ModalService,
private ModalService: ModalService,
- private keysPipe:KeysPipe,
- private topologyTemplateService: TopologyTemplateService) {
+ private keysPipe: KeysPipe,
+ private topologyTemplateService: TopologyTemplateService,
+ private translateService: TranslateService) {
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
@@ -124,7 +148,6 @@ export class PropertiesAssignmentComponent {
this.component = _stateParams.component;
this.EventListenerService.registerObserverCallback(EVENTS.ON_LIFECYCLE_CHANGE, this.onCheckout);
this.updateViewMode();
-
this.changedData = [];
this.updateHasChangedData();
this.isValidChangedData = true;
@@ -132,52 +155,60 @@ export class PropertiesAssignmentComponent {
ngOnInit() {
console.log("==>" + this.constructor.name + ": ngOnInit");
+ this.btnSelectInputText = this.translateService.translate('SELECT_INPUT_LABEL');
this.loadingInputs = true;
this.loadingPolicies = true;
this.loadingInstances = true;
this.loadingProperties = true;
this.topologyTemplateService
- .getComponentInputsWithProperties(this.component.componentType, this.component.uniqueId)
- .subscribe(response => {
- _.forEach(response.inputs, (input: InputBEModel) => {
- const newInput: InputFEModel = new InputFEModel(input);
- this.inputsUtils.resetInputDefaultValue(newInput, input.defaultValue);
- this.inputs.push(newInput); //only push items that were declared via SDC
- });
- this.loadingInputs = false;
+ .getComponentInputsWithProperties(this.component.componentType, this.component.uniqueId)
+ .subscribe(response => {
+ _.forEach(response.inputs, (input: InputBEModel) => {
+ const newInput: InputFEModel = new InputFEModel(input);
+ this.inputsUtils.resetInputDefaultValue(newInput, input.defaultValue);
+ this.inputs.push(newInput); //only push items that were declared via SDC
+ });
+ this.loadingInputs = false;
- }, error => {}); //ignore error
+ }, error => {
+ }); //ignore error
this.componentServiceNg2
- .getComponentResourcePropertiesData(this.component)
- .subscribe(response => {
- this.loadingPolicies = false;
- this.instances = [];
- this.instances.push(...response.componentInstances);
- this.instances.push(...response.groupInstances);
- this.instances.push(...response.policies);
-
- _.forEach(response.policies, (policy: any) => {
- const newPolicy: InputFEModel = new InputFEModel(policy);
- this.inputsUtils.resetInputDefaultValue(newPolicy, policy.defaultValue);
- this.policies.push(policy);
- });
-
- // add the service self instance to the top of the list.
- const serviceInstance = new ComponentInstance();
- serviceInstance.name = SERVICE_SELF_TITLE;
- serviceInstance.uniqueId = this.component.uniqueId;
- this.instances.unshift(serviceInstance);
+ .getComponentResourcePropertiesData(this.component)
+ .subscribe(response => {
+ this.loadingPolicies = false;
+ this.instances = [];
+ this.instances.push(...response.componentInstances);
+ this.instances.push(...response.groupInstances);
+ this.instances.push(...response.policies);
+
+ _.forEach(response.policies, (policy: any) => {
+ const newPolicy: InputFEModel = new InputFEModel(policy);
+ this.inputsUtils.resetInputDefaultValue(newPolicy, policy.defaultValue);
+ this.policies.push(policy);
+ });
- _.forEach(this.instances, (instance) => {
- this.instancesNavigationData.push(instance);
- this.componentInstanceNamesMap[instance.uniqueId] = <InstanceFeDetails>{name: instance.name, iconClass:instance.iconClass, originArchived:instance.originArchived};
- });
- this.loadingInstances = false;
- if (this.instancesNavigationData[0] == undefined) {
- this.loadingProperties = false;
- }
- this.selectFirstInstanceByDefault();
- }, error => { this.loadingInstances = false; }); //ignore error
+ // add the service self instance to the top of the list.
+ const serviceInstance = new ComponentInstance();
+ serviceInstance.name = SERVICE_SELF_TITLE;
+ serviceInstance.uniqueId = this.component.uniqueId;
+ this.instances.unshift(serviceInstance);
+
+ _.forEach(this.instances, (instance) => {
+ this.instancesNavigationData.push(instance);
+ this.componentInstanceNamesMap[instance.uniqueId] = <InstanceFeDetails>{
+ name: instance.name,
+ iconClass: instance.iconClass,
+ originArchived: instance.originArchived
+ };
+ });
+ this.loadingInstances = false;
+ if (this.instancesNavigationData[0] == undefined) {
+ this.loadingProperties = false;
+ }
+ this.selectFirstInstanceByDefault();
+ }, error => {
+ this.loadingInstances = false;
+ }); //ignore error
this.stateChangeStartUnregister = this.$scope.$on('$stateChangeStart', (event, toState, toParams) => {
// stop if has changed properties
@@ -185,7 +216,8 @@ export class PropertiesAssignmentComponent {
event.preventDefault();
this.showUnsavedChangesAlert().then(() => {
this.$state.go(toState, toParams);
- }, () => {});
+ }, () => {
+ });
}
});
};
@@ -205,33 +237,33 @@ export class PropertiesAssignmentComponent {
this.isReadonly = this.componentModeService.getComponentMode(this.component) === WorkspaceMode.VIEW;
}
- onCheckout = (component:ComponentData) => {
+ onCheckout = (component: ComponentData) => {
this.component = component;
this.updateViewMode();
}
- isSelf = ():boolean => {
+ isSelf = (): boolean => {
return this.selectedInstanceData && this.selectedInstanceData.uniqueId == this.component.uniqueId;
}
- getServiceProperties(){
- this.loadingProperties = false;
+ getServiceProperties() {
+ this.loadingProperties = true;
this.topologyTemplateService
- .getServiceProperties(this.component.uniqueId)
- .subscribe((response) => {
- this.serviceBePropertiesMap = new InstanceBePropertiesMap();
- this.serviceBePropertiesMap[this.component.uniqueId] = response;
- this.processInstancePropertiesResponse(this.serviceBePropertiesMap, false);
- this.loadingProperties = false;
- }, (error) => {
- this.loadingProperties = false;
- });
+ .getServiceProperties(this.component.uniqueId)
+ .subscribe((response) => {
+ this.serviceBePropertiesMap = new InstanceBePropertiesMap();
+ this.serviceBePropertiesMap[this.component.uniqueId] = response;
+ this.processInstancePropertiesResponse(this.serviceBePropertiesMap, false);
+ this.loadingProperties = false;
+ }, (error) => {
+ this.loadingProperties = false;
+ });
}
- onInstanceSelectedUpdate = (instance: ComponentInstance|GroupInstance|PolicyInstance) => {
+ onInstanceSelectedUpdate = (instance: ComponentInstance | GroupInstance | PolicyInstance) => {
// stop if has changed properties
if (this.hasChangedData) {
- this.showUnsavedChangesAlert().then((resolve)=> {
+ this.showUnsavedChangesAlert().then((resolve) => {
this.changeSelectedInstance(instance)
}, (reject) => {
});
@@ -240,52 +272,62 @@ export class PropertiesAssignmentComponent {
this.changeSelectedInstance(instance);
};
- changeSelectedInstance = (instance: ComponentInstance|GroupInstance|PolicyInstance) => {
+ changeSelectedInstance = (instance: ComponentInstance | GroupInstance | PolicyInstance) => {
this.selectedInstanceData = instance;
this.loadingProperties = true;
if (instance instanceof ComponentInstance) {
let instanceBePropertiesMap: InstanceBePropertiesMap = new InstanceBePropertiesMap();
if (this.isInput(instance.originType)) {
this.componentInstanceServiceNg2
- .getComponentInstanceInputs(this.component, instance)
- .subscribe(response => {
- instanceBePropertiesMap[instance.uniqueId] = response;
- this.processInstancePropertiesResponse(instanceBePropertiesMap, true);
- this.loadingProperties = false;
- }, error => {
- }); //ignore error
+ .getComponentInstanceInputs(this.component, instance)
+ .subscribe(response => {
+ instanceBePropertiesMap[instance.uniqueId] = response;
+ this.processInstancePropertiesResponse(instanceBePropertiesMap, true);
+ }, () => {
+ //ignore error
+ }, () => {
+ this.loadingProperties = false;
+ });
} else if (this.isSelf()) {
this.getServiceProperties();
} else {
this.componentInstanceServiceNg2
- .getComponentInstanceProperties(this.component, instance.uniqueId)
- .subscribe(response => {
- instanceBePropertiesMap[instance.uniqueId] = response;
- this.processInstancePropertiesResponse(instanceBePropertiesMap, false);
- this.loadingProperties = false;
- }, error => {
- }); //ignore error
+ .getComponentInstanceProperties(this.component, instance.uniqueId)
+ .subscribe(response => {
+ instanceBePropertiesMap[instance.uniqueId] = response;
+ this.processInstancePropertiesResponse(instanceBePropertiesMap, false);
+ }, () => {
+ //ignore error
+ }, () => {
+ this.loadingProperties = false;
+ });
}
-
+ this.loadingProperties = false;
this.resourceIsReadonly = (instance.componentName === "vnfConfiguration");
} else if (instance instanceof GroupInstance) {
let instanceBePropertiesMap: InstanceBePropertiesMap = new InstanceBePropertiesMap();
this.componentInstanceServiceNg2
- .getComponentGroupInstanceProperties(this.component, this.selectedInstanceData.uniqueId)
- .subscribe((response) => {
- instanceBePropertiesMap[instance.uniqueId] = response;
- this.processInstancePropertiesResponse(instanceBePropertiesMap, false);
- this.loadingProperties = false;
- });
+ .getComponentGroupInstanceProperties(this.component, this.selectedInstanceData.uniqueId)
+ .subscribe((response) => {
+ instanceBePropertiesMap[instance.uniqueId] = response;
+ this.processInstancePropertiesResponse(instanceBePropertiesMap, false);
+ }, () => {
+ //ignore error
+ }, () => {
+ this.loadingProperties = false;
+ });
} else if (instance instanceof PolicyInstance) {
let instanceBePropertiesMap: InstanceBePropertiesMap = new InstanceBePropertiesMap();
this.componentInstanceServiceNg2
- .getComponentPolicyInstanceProperties(this.component.componentType, this.component.uniqueId, this.selectedInstanceData.uniqueId)
- .subscribe((response) => {
- instanceBePropertiesMap[instance.uniqueId] = response;
- this.processInstancePropertiesResponse(instanceBePropertiesMap, false);
- this.loadingProperties = false;
- });
+ .getComponentPolicyInstanceProperties(this.component.componentType, this.component.uniqueId, this.selectedInstanceData.uniqueId)
+ .subscribe((response) => {
+ instanceBePropertiesMap[instance.uniqueId] = response;
+ this.processInstancePropertiesResponse(instanceBePropertiesMap, false);
+ }, () => {
+ //ignore error
+ }, () => {
+ this.loadingProperties = false;
+ });
} else {
this.loadingProperties = false;
}
@@ -316,7 +358,7 @@ export class PropertiesAssignmentComponent {
this.selectedInstance_FlattenCapabilitiesList,
(result, cap: Capability) => {
isCapabilityOwnedByInstance = cap.ownerId === currentUniqueId ||
- selectedComponentInstanceData.isServiceProxy() || selectedComponentInstanceData.isServiceSubstitution() &&
+ selectedComponentInstanceData.isServiceProxy() || selectedComponentInstanceData.isServiceSubstitution() &&
cap.ownerId === selectedComponentInstanceData.sourceModelUid;
if (cap.properties && isCapabilityOwnedByInstance) {
_.forEach(cap.properties, prop => {
@@ -344,7 +386,7 @@ export class PropertiesAssignmentComponent {
};
/*** VALUE CHANGE EVENTS ***/
- dataChanged = (item:PropertyFEModel|InputFEModel) => {
+ dataChanged = (item: PropertyFEModel | InputFEModel) => {
let itemHasChanged;
if (this.isPropertiesTabSelected && item instanceof PropertyFEModel) {
itemHasChanged = item.hasValueObjChanged();
@@ -384,14 +426,14 @@ export class PropertiesAssignmentComponent {
onPropertySelectedUpdate = ($event) => {
console.log("==>" + this.constructor.name + ": onPropertySelectedUpdate");
this.selectedFlatProperty = $event;
- let parentProperty:PropertyFEModel = this.propertiesService.getParentPropertyFEModelFromPath(this.instanceFePropertiesMap[this.selectedFlatProperty.instanceName], this.selectedFlatProperty.path);
+ let parentProperty: PropertyFEModel = this.propertiesService.getParentPropertyFEModelFromPath(this.instanceFePropertiesMap[this.selectedFlatProperty.instanceName], this.selectedFlatProperty.path);
parentProperty.expandedChildPropertyId = this.selectedFlatProperty.path;
};
/**
* When user select row in table, this will prepare the hirarchy object for the tree.
*/
- selectPropertyRow = (propertyRowSelectedEvent:PropertyRowSelectedEvent) => {
+ selectPropertyRow = (propertyRowSelectedEvent: PropertyRowSelectedEvent) => {
console.log("==>" + this.constructor.name + ": selectPropertyRow " + propertyRowSelectedEvent.propertyModel.name);
let property = propertyRowSelectedEvent.propertyModel;
let instanceName = propertyRowSelectedEvent.instanceName;
@@ -399,13 +441,13 @@ export class PropertiesAssignmentComponent {
// Build hirarchy tree for the navigation and update propertiesNavigationData with it.
if (!(this.selectedInstanceData instanceof ComponentInstance) || this.selectedInstanceData.originType !== ResourceType.VF) {
- let simpleFlatProperty:Array<SimpleFlatProperty>;
+ let simpleFlatProperty: Array<SimpleFlatProperty>;
if (property instanceof PropertyFEModel) {
simpleFlatProperty = this.hierarchyNavService.getSimplePropertiesTree(property, instanceName);
} else if (property instanceof DerivedFEProperty) {
// Need to find parent PropertyFEModel
- let parentPropertyFEModel:PropertyFEModel = _.find(this.instanceFePropertiesMap[instanceName], (tmpFeProperty):boolean => {
- return property.propertiesName.indexOf(tmpFeProperty.name)===0;
+ let parentPropertyFEModel: PropertyFEModel = _.find(this.instanceFePropertiesMap[instanceName], (tmpFeProperty): boolean => {
+ return property.propertiesName.indexOf(tmpFeProperty.name) === 0;
});
simpleFlatProperty = this.hierarchyNavService.getSimplePropertiesTree(parentPropertyFEModel, instanceName);
}
@@ -422,7 +464,7 @@ export class PropertiesAssignmentComponent {
selectInstanceRow = ($event) => {//get instance name
- this.selectedInstanceData = _.find(this.instancesNavigationData, (instance:ComponentInstance) => {
+ this.selectedInstanceData = _.find(this.instancesNavigationData, (instance: ComponentInstance) => {
return instance.name == $event;
});
this.hierarchyNavTabs.triggerTabChange('Composition');
@@ -434,7 +476,7 @@ export class PropertiesAssignmentComponent {
this.propertyInputTabs.triggerTabChange(this.currentMainTab.title);
this.showUnsavedChangesAlert().then((proceed) => {
this.propertyInputTabs.selectTab(this.propertyInputTabs.tabs.find((tab) => tab.title === event.title));
- }, ()=> {
+ }, () => {
});
return;
}
@@ -448,6 +490,92 @@ export class PropertiesAssignmentComponent {
this.searchQuery = '';
};
+ /**Select Properties value from defined input values**/
+ selectInput = (): void => {
+ let instancesIds = this.keysPipe.transform(this.instanceFePropertiesMap, []);
+ angular.forEach(instancesIds, (instanceId: string): void => {
+ let selectedInstanceData: any = this.instances.find(instance => instance.uniqueId == instanceId
+ && instance instanceof ComponentInstance);
+ if (selectedInstanceData) {
+ let checkedProperties: PropertyBEModel[] = this.propertiesService.getCheckedProperties(this.instanceFePropertiesMap[instanceId]);
+ angular.forEach(checkedProperties, (property: PropertyBEModel) => {
+ this.propertiesService.setCheckedPropertyType(property.type);
+ if (property.toscaGetFunctionType != null) {
+ this.loadingProperties = true;
+ property.getInputValues = null;
+ property.value = null;
+ property.toscaGetFunctionType = null;
+ this.updateInstancePropertiesWithInput(checkedProperties, selectedInstanceData);
+ } else {
+ let modalTitle = 'Select value from Input';
+ const modal = this.ModalService.createCustomModal(new ModalModel(
+ 'sm',
+ modalTitle,
+ null,
+ [
+ new ButtonModel('Save', 'blue',
+ () => {
+ this.loadingProperties = true;
+ let selectInputValue: InputFEModel = modal.instance.dynamicContent.instance.selectInputValue;
+ property.getInputValues = [];
+ const propertyInputDetail = new PropertyInputDetail();
+ propertyInputDetail.inputId = selectInputValue.uniqueId;
+ propertyInputDetail.inputName = selectInputValue.name;
+ propertyInputDetail.inputType = selectInputValue.type;
+ property.getInputValues.push(propertyInputDetail);
+ property.value = '{"get_input":"' + selectInputValue.name + '"}';
+ property.toscaGetFunctionType = ToscaGetFunctionType.GET_INPUT;
+ this.updateInstancePropertiesWithInput(checkedProperties, selectedInstanceData);
+ modal.instance.close();
+ }
+ ),
+ new ButtonModel('Cancel', 'outline grey', () => {
+ modal.instance.close();
+ }),
+ ],
+ null /* type */
+ )); //modal
+ this.ModalService.addDynamicContentToModal(modal, InputListComponent);
+ modal.instance.open();
+ }
+ });
+ }
+ });
+ };
+
+ updateInstancePropertiesWithInput(checkedProperties: PropertyBEModel[], selectedInstanceData: any) {
+ this.componentInstanceServiceNg2.updateInstanceProperties(this.component.componentType, this.component.uniqueId,
+ this.selectedInstanceData.uniqueId, checkedProperties)
+ .subscribe(() => {
+ this.changeSelectedInstance(selectedInstanceData);
+ }, (error) => {
+ this.Notification.error({
+ message: 'Failed to select/deselect get_input call: ' + error,
+ title: 'Failure'
+ });
+ }, () => {
+ this.loadingProperties = false;
+ this.btnSelectInputText = this.translateService.translate('SELECT_INPUT_LABEL');
+ });
+ }
+
+ selectInputBtnLabel = () => {
+ let instancesIds = this.keysPipe.transform(this.instanceFePropertiesMap, []);
+ angular.forEach(instancesIds, (instanceId: string): void => {
+ let checkedProperties: PropertyBEModel[] = this.propertiesService.getCheckedProperties(this.instanceFePropertiesMap[instanceId]);
+ angular.forEach(checkedProperties, (property: PropertyBEModel) => {
+ if(this.checkedPropertiesCount == 1) {
+ if (property.toscaGetFunctionType == null) {
+ this.btnSelectInputText = this.translateService.translate('SELECT_INPUT_LABEL');
+ } else {
+ this.btnSelectInputText = this.translateService.translate('DESELECT_INPUT_LABEL');
+ }
+ } else {
+ this.btnSelectInputText = this.translateService.translate('SELECT_INPUT_LABEL');
+ }
+ });
+ });
+ }
/*** DECLARE PROPERTIES/INPUTS ***/
@@ -735,6 +863,7 @@ export class PropertiesAssignmentComponent {
};
} else {
if (this.isSelf()) {
+ console.log("changedProperties", changedProperties);
request = this.topologyTemplateService.updateServiceProperties(this.component.uniqueId, _.map(changedProperties, cp => {
delete cp.constraints;
return cp;
@@ -932,6 +1061,7 @@ export class PropertiesAssignmentComponent {
updateCheckedPropertyCount = (increment: boolean): void => {
this.checkedPropertiesCount += (increment) ? 1 : -1;
console.log("CheckedProperties count is now.... " + this.checkedPropertiesCount);
+ this.selectInputBtnLabel();
};
updateCheckedChildPropertyCount = (increment: boolean): void => {
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts
index bd7ccd1bfd..544eb8173d 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/services/properties.utils.ts
@@ -53,6 +53,9 @@ export class PropertiesUtils {
newFEProp.updateExpandedChildPropertyId(newFEProp.name); //display only the first level of children
this.dataTypeService.checkForCustomBehavior(newFEProp);
+ if (newFEProp.isToscaGetFunction()) {
+ return;
+ }
//if this prop (or any children) are declared, set isDeclared and disable checkbox on parents/children
if (newFEProp.getInputValues && newFEProp.getInputValues.length) {
newFEProp.getInputValues.forEach(propInputDetail => {
diff --git a/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts b/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts
index 0249912862..992149976e 100644
--- a/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts
+++ b/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts
@@ -123,6 +123,10 @@ export class TopologyTemplateService {
return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INPUTS]);
}
+ getComponentInputsValues(componentType: string, componentId: string): Observable<ComponentGenericResponse> {
+ return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_INPUTS]);
+ }
+
getComponentInputsWithProperties(componentType: string, componentId: string): Observable<ComponentGenericResponse> {
return this.getComponentDataByFieldsName(componentType, componentId,
[COMPONENT_FIELDS.COMPONENT_INPUTS, COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_INSTANCES_PROPERTIES, COMPONENT_FIELDS.COMPONENT_PROPERTIES]);
@@ -208,7 +212,7 @@ export class TopologyTemplateService {
return this.http.get<InstanceBePropertiesMap>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/filteredproperties/' + filterData.propertyName, {params: params});
}
- createServiceProperty(componentId: string, propertyModel: PropertyBEModel): Observable<PropertyBEModel> {
+ createServiceProperty(componentId: string, propertyModel: PropertyBEModel): Observable<PropertyBEModel> {
const serverObject = {};
serverObject[propertyModel.name] = propertyModel;
return this.http.post<PropertyBEModel>(this.baseUrl + 'services/' + componentId + '/properties', serverObject)
diff --git a/catalog-ui/src/app/ng2/services/properties.service.ts b/catalog-ui/src/app/ng2/services/properties.service.ts
index c86d207915..f6b77320df 100644
--- a/catalog-ui/src/app/ng2/services/properties.service.ts
+++ b/catalog-ui/src/app/ng2/services/properties.service.ts
@@ -25,6 +25,8 @@ import { PropertyFEModel, PropertyBEModel, PropertyDeclareAPIModel, DerivedFEPro
@Injectable()
export class PropertiesService {
+ checkedPropertyType: string;
+
constructor() {
}
@@ -81,5 +83,13 @@ export class PropertiesService {
return selectedProps;
}
+ setCheckedPropertyType(type: string){
+ this.checkedPropertyType = type;
+ }
+
+ getCheckedPropertyType(){
+ return this.checkedPropertyType;
+ }
+
}