diff options
author | KrupaNagabhushan <krupa.nagabhushan@est.tech> | 2023-02-10 18:41:01 +0000 |
---|---|---|
committer | Vasyl Razinkov <vasyl.razinkov@est.tech> | 2023-03-10 11:25:05 +0000 |
commit | d03be99cba81d17bfb8681c18acf212eec9549ea (patch) | |
tree | 8838525a2bdf1caba2d441741534e94f95e6ae60 /catalog-ui/src/app/ng2/pages/properties-assignment/declare-input | |
parent | 4ec39782a9f8fe7188f38fc39953f277a8284618 (diff) |
Provide input name when declaring service property as input
Issue-ID: SDC-4385
Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech>
Change-Id: I2b71e04b97ba69195380d2aa29d9d98a3bd5e981
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/properties-assignment/declare-input')
4 files changed, 141 insertions, 0 deletions
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.html b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.html new file mode 100644 index 0000000000..19b23598fa --- /dev/null +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.html @@ -0,0 +1,22 @@ +<!-- + ~ ============LICENSE_START======================================================= + ~ Copyright (C) 2023 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="declare-input"> + <input id="myText" type="text" (keyup)="setInputName($event)"/> +</div> diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.spec.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.spec.ts new file mode 100644 index 0000000000..c3fa1f506f --- /dev/null +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.spec.ts @@ -0,0 +1,43 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2023 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 { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DeclareInputComponent } from './declare-input.component'; + +describe('DeclareInputComponent', () => { + let component: DeclareInputComponent; + let fixture: ComponentFixture<DeclareInputComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DeclareInputComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DeclareInputComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.ts new file mode 100644 index 0000000000..d156383f6b --- /dev/null +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.component.ts @@ -0,0 +1,40 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2023 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, Input, OnInit} from '@angular/core'; +import {FormControl, FormGroup} from "@angular/forms"; + +@Component({ + selector: 'declare-input', + templateUrl: './declare-input.component.html' +}) +export class DeclareInputComponent implements OnInit { + inputNameForm: FormControl = new FormControl(undefined); + formGroup: FormGroup = new FormGroup({ + 'inputName': this.inputNameForm, + }); + inputName: string; + constructor() { } + ngOnInit() { + } + setInputName(event) { + this.inputName = event.target.value; + this.inputNameForm.setValue(this.inputName); + } + +} diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.module.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.module.ts new file mode 100644 index 0000000000..0dae0a2421 --- /dev/null +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-input/declare-input.module.ts @@ -0,0 +1,36 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2023 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 { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import {DeclareInputComponent} from "./declare-input.component"; + +@NgModule({ + imports: [ + CommonModule, + FormsModule + ], + declarations: [DeclareInputComponent], + exports: [DeclareInputComponent], + entryComponents: [ + DeclareInputComponent + ], +}) + +export class DeclareInputModule { } |