diff options
Diffstat (limited to 'cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog')
7 files changed, 351 insertions, 0 deletions
diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog-routing.module.ts b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog-routing.module.ts new file mode 100644 index 000000000..1785ef86c --- /dev/null +++ b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog-routing.module.ts @@ -0,0 +1,35 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* 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. +* ============LICENSE_END========================================================= +*/ + +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { SearchCatalogComponent } from './search-catalog.component'; + +const routes: Routes = [ + { + path: '', + component: SearchCatalogComponent + } +]; +@NgModule({ +imports: [RouterModule.forChild(routes)], +exports: [RouterModule] +}) +export class SearchCatalogRoutingModule { } diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.html b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.html new file mode 100644 index 000000000..47813829d --- /dev/null +++ b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.html @@ -0,0 +1,41 @@ +<!-- /* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* 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. +* ============LICENSE_END========================================================= +*/--> +<form class="search-form" [formGroup]="myControl"> + <mat-form-field class="search-full-width"> + <input matInput type="text" [(ngModel)]="searchText" placeholder="Search Resources" formControlName="search_input"> + <button matSuffix mat-icon-button (click)="fetchCatalogByName()"> + <mat-icon>search</mat-icon> + </button> + </mat-form-field> +</form> +<div class="searchcontainer"> + <div class="flexBox"> + <div *ngFor="let option of options" style="position: relative !important;width:20% !important"> + <mat-card class="example-card"> + <mat-card-content class="card-content"> + {{option.modelName}} + </mat-card-content> + <mat-card-actions class="flexBox"> + <button matStepperNext mat-menu-item (click)="editInfo(option.blueprintModel.artifactName,option.blueprintModel.artifactVersion,3)">Info</button> + </mat-card-actions> + </mat-card> + </div> + </div> +</div>
\ No newline at end of file diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.scss b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.scss new file mode 100644 index 000000000..a24aebed0 --- /dev/null +++ b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.scss @@ -0,0 +1,78 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2019 TechMahindra
+*=================================================================================
+* 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.
+* ============LICENSE_END=========================================================
+*/
+
+.example-card {
+ // min-width: 300px;
+ max-height: 200px;
+ background-color: #ebebeb;
+ position: relative;
+ width: 250px;
+ margin: 5px;
+}
+
+.mat-grid-tile {
+ position: absolute;
+ width: 240px !important;
+}
+
+.mat-grid-list div {
+ position: relative;
+}
+
+button.mat-menu-item {
+ width: auto;
+ float: left;
+ border-radius: 4px;
+ background-color: #3f51b5;
+ margin: 5px;
+ cursor: pointer;
+ color: white;
+}
+
+.flexBox {
+ display: flex;
+ flex-flow: row;
+ flex-wrap: wrap;
+}
+
+.card-deck-container {
+ position: relative;
+ border-radius: 1px;
+ padding: 2px;
+ margin: 2px;
+ // background-color: #f5f5f5;
+}
+
+.searchcontainer {
+ // min-height: 300px;
+ overflow-x: hidden;
+ overflow-y: scroll;
+}
+
+.card-content {
+ text-align: center;
+ margin: 5px;
+}
+
+.mat-card-actions {
+ margin-left: 0px !important;
+ margin-right: 0px !important;
+ padding: 0px 0 !important;
+}
\ No newline at end of file diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.spec.ts b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.spec.ts new file mode 100644 index 000000000..661246ebb --- /dev/null +++ b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.spec.ts @@ -0,0 +1,45 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* 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. +* ============LICENSE_END========================================================= +*/ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SearchCatalogComponent } from './search-catalog.component'; + +describe('SearchCatalogComponent', () => { + let component: SearchCatalogComponent; + let fixture: ComponentFixture<SearchCatalogComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SearchCatalogComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SearchCatalogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.ts b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.ts new file mode 100644 index 000000000..b30fc3a78 --- /dev/null +++ b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.ts @@ -0,0 +1,58 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* 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. +* ============LICENSE_END========================================================= +*/ + +import { Component, OnInit, ViewChild } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { SearchCatalogService } from './search-catalog.service'; +import { MatAutocompleteTrigger } from '@angular/material'; + +@Component({ + selector: 'app-search-catalog', + templateUrl: './search-catalog.component.html', + styleUrls: ['./search-catalog.component.scss'] +}) +export class SearchCatalogComponent implements OnInit { + myControl: FormGroup; + searchText: string = ''; + options: any[] = []; + @ViewChild('catalogSelect', { read: MatAutocompleteTrigger }) catalogSelect: MatAutocompleteTrigger; + constructor(private _formBuilder: FormBuilder, private searchCatalogService: SearchCatalogService) { } + + ngOnInit() { + this.myControl = this._formBuilder.group({ + search_input: ['', Validators.required] + }); + } + fetchCatalogByName() { + this.searchCatalogService.searchByTags(this.searchText) + .subscribe(data=>{ + console.log(data); + data.forEach(element => { + this.options.push(element) + }); + this.catalogSelect.openPanel(); + }, error=>{ + window.alert('Catalog not matching the search tag' + error); + }) + } + + editInfo(artifactName: string, artifactVersion: string, option: string) { + } +} diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.module.ts b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.module.ts new file mode 100644 index 000000000..2aa1a509e --- /dev/null +++ b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.module.ts @@ -0,0 +1,58 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* 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. +* ============LICENSE_END========================================================= +*/ + +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { SearchCatalogRoutingModule } from './search-catalog-routing.module'; +import { MatToolbarModule, MatButtonModule, MatSidenavModule, MatListModule, MatGridListModule, MatCardModule, MatMenuModule, MatTableModule, MatPaginatorModule, MatSortModule, MatInputModule, MatSelectModule, MatRadioModule, MatFormFieldModule, MatStepperModule, MatAutocompleteModule} from '@angular/material'; +import { MatIconModule } from '@angular/material/icon'; +import { SharedModule } from 'src/app/common/shared/shared.module'; +import { FormsModule,ReactiveFormsModule } from '@angular/forms'; +import { SearchCatalogService } from './search-catalog.service'; + +@NgModule({ + declarations: [], + imports: [ + CommonModule, + SearchCatalogRoutingModule, + FormsModule, + ReactiveFormsModule, + SharedModule, + MatToolbarModule, + MatButtonModule, + MatSidenavModule, + MatIconModule, + MatListModule, + MatGridListModule, + MatCardModule, + MatMenuModule, + MatTableModule, + MatPaginatorModule, + MatSortModule, + MatInputModule, + MatSelectModule, + MatRadioModule, + MatFormFieldModule, + MatStepperModule, + MatAutocompleteModule + ], + providers: [ SearchCatalogService ] +}) +export class SearchCatalogModule { } diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.service.ts b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.service.ts new file mode 100644 index 000000000..47896058a --- /dev/null +++ b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.service.ts @@ -0,0 +1,36 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* 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. +* ============LICENSE_END========================================================= +*/ + +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable, observable } from 'rxjs'; +import { ControllerCatalogURLs } from 'src/app/common/constants/app-constants'; +import { ApiService } from 'src/app/common/core/services/api.service'; + +@Injectable() +export class SearchCatalogService { + + constructor(private _http: HttpClient, private api: ApiService) { + } + + searchByTags(tag) { + return this.api.get(ControllerCatalogURLs.searchControllerCatalogByTags + '/' + tag); + } +} |