From 6d65fde29c1859a7099d91ed0e8911bcb1823a38 Mon Sep 17 00:00:00 2001 From: KrupaNagabhushan Date: Tue, 12 Jan 2021 13:41:59 +0000 Subject: Allow property to take its value from defined input list Issue-ID: SDC-3547 Change-Id: Ic438e8f8943d0f1c656e386611b88b25f879e83b Signed-off-by: KrupaNagabhushan Signed-off-by: andre.schmid --- .../input-list/input-list.component.html | 31 ++++++++++ .../input-list/input-list.component.less | 43 ++++++++++++++ .../input-list/input-list.component.ts | 67 ++++++++++++++++++++++ .../input-list/input-list.module.ts | 48 ++++++++++++++++ 4 files changed, 189 insertions(+) create mode 100644 catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.html create mode 100644 catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.less create mode 100644 catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.component.ts create mode 100644 catalog-ui/src/app/ng2/pages/properties-assignment/input-list/input-list.module.ts (limited to 'catalog-ui/src/app/ng2/pages/properties-assignment/input-list') 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 @@ + + +
+ +
+
+ + +
+
+
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 = []; + 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 {} -- cgit 1.2.3-korg