diff options
author | 2019-08-14 23:21:25 +0530 | |
---|---|---|
committer | 2019-08-14 23:21:31 +0530 | |
commit | 70ba6f90237051b5e8ed2b26d8555f1b2a358ca0 (patch) | |
tree | 31416183437279a54410d5ae1bef4a632714e724 /cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template | |
parent | 615b5e183723bba51e0b3c134c7b5b954f99cac0 (diff) |
Search Template code change
Added parameter in Search DB template and removed unused code in search
template
Change-Id: I77436e8d592876affab4b74c3883d4c03fcdf279
Issue-ID: CCSDK-1275
Signed-off-by: Ezhilarasi <ezhrajam@in.ibm.com>
Diffstat (limited to 'cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template')
2 files changed, 27 insertions, 43 deletions
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.html b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.html index 6683dba59..648271028 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.html +++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.html @@ -20,8 +20,8 @@ limitations under the License. --> <form class="search-form" [formGroup]="myControl"> <mat-form-field class="search-full-width"> - <input #resourceSelect type="text" [(ngModel)]="searchText" placeholder="Search Resources" matInput [matAutocomplete]="auto" formControlName="search_input"> - <!-- <input #resourceSelect type="text" [(ngModel)]="searchText" placeholder="Search Resources" formControlName="search_input"> --> + <!-- <input #resourceSelect type="text" [(ngModel)]="searchText" placeholder="Search Resources" matInput [matAutocomplete]="auto" formControlName="search_input"> --> + <input matInput type="text" [(ngModel)]="searchText" placeholder="Search Resources" formControlName="search_input"> <button matSuffix mat-icon-button (click)="fetchResourceByName()"> <mat-icon>search</mat-icon> </button> @@ -41,9 +41,9 @@ limitations under the License. <br>{{option.blueprintModel.updatedBy}} </mat-card-content> <mat-card-actions class="flexBox"> - <button mat-menu-item (click)="editCBA(option.blueprintModel.artifactName,edit)">Edit</button> - <button mat-menu-item (click)="editCBA(option.blueprintModel.artifactName,clone)">Clone</button> - <button mat-menu-item (click)="editCBA(option.blueprintModel.artifactName,info)">Info</button> + <button matStepperNext mat-menu-item (click)="editCBA(option.blueprintModel.artifactName,option.blueprintModel.artifactVersion,edit)">Edit</button> + <button matStepperNext mat-menu-item (click)="editCBA(option.blueprintModel.artifactName,option.blueprintModel.artifactVersion,clone)">Clone</button> + <button matStepperNext mat-menu-item (click)="editCBA(option.blueprintModel.artifactName,option.blueprintModel.artifactVersion,info)">Info</button> </mat-card-actions> </mat-card> </div> diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts index ce7d5aac2..ee6e9631e 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts @@ -28,12 +28,9 @@ import { IBlueprint } from '../../../../common/core/store/models/blueprint.model import { IBlueprintState } from '../../../../common/core/store/models/blueprintState.model'; import { IAppState } from '../../../../common/core/store/state/app.state'; import { LoadBlueprintSuccess, SET_BLUEPRINT_STATE, SetBlueprintState } from '../../../../common/core/store/actions/blueprint.action'; -import { json } from 'd3'; import { SortPipe } from '../../../../common/shared/pipes/sort.pipe'; import { LoaderService } from '../../../../common/core/services/loader.service'; import { FormGroup, FormBuilder, Validators } from '@angular/forms'; -import { MatAutocompleteTrigger } from '@angular/material'; - @Component({ selector: 'app-search-template', @@ -52,9 +49,8 @@ export class SearchTemplateComponent implements OnInit { result: string = ''; @Input() optionSelected: string; myControl: FormGroup; - @ViewChild('resourceSelect', { read: MatAutocompleteTrigger }) resourceSelect: MatAutocompleteTrigger; @Output() resourcesData = new EventEmitter(); - options: any[] = []; + options: any[] = []; searchText: string = ''; private paths = []; @@ -66,7 +62,7 @@ export class SearchTemplateComponent implements OnInit { private blueprintName: string; private entryDefinition: string; - constructor(private store: Store<IAppState>, private loader: LoaderService,private formBuilder: FormBuilder) { } + constructor(private store: Store<IAppState>, private loader: LoaderService, private formBuilder: FormBuilder) { } ngOnInit() { this.myControl = this.formBuilder.group({ @@ -78,18 +74,6 @@ export class SearchTemplateComponent implements OnInit { this.resourcesData.emit(value); } - fetchResourceByName() { - // this.exsistingModelService.searchByTags(this.searchText) - // .subscribe(data => { - // console.log(data); - // data.forEach(element => { - // this.options.push(element) - // }); - // this.resourceSelect.openPanel(); - // }, error => { - // window.alert('error' + error); - // }) - } fileChanged(e: any) { this.paths = []; this.file = e.target.files[0]; @@ -97,8 +81,8 @@ export class SearchTemplateComponent implements OnInit { this.zipFile.files = {}; this.zipFile.loadAsync(this.file) .then((zip) => { - if(zip) { - this.loader.showLoader(); + if (zip) { + this.loader.showLoader(); this.buildFileViewData(zip); } }); @@ -123,21 +107,21 @@ export class SearchTemplateComponent implements OnInit { this.paths = []; console.log(zip.files); for (var file in zip.files) { - console.log("name: " +zip.files[file].name); + console.log("name: " + zip.files[file].name); this.fileObject = { // nameForUIDisplay: this.uploadedFileName + '/' + zip.files[file].name, // name: zip.files[file].name, name: this.uploadedFileName + '/' + zip.files[file].name, data: '' }; - const value = <any>await zip.files[file].async('string'); + const value = <any>await zip.files[file].async('string'); this.fileObject.data = value; - this.paths.push(this.fileObject); + this.paths.push(this.fileObject); } - if(this.paths) { - this.paths.forEach(path =>{ - if(path.name.includes("TOSCA.meta")) { + if (this.paths) { + this.paths.forEach(path => { + if (path.name.includes("TOSCA.meta")) { this.validfile = true } }); @@ -145,7 +129,7 @@ export class SearchTemplateComponent implements OnInit { alert('Please update proper file'); } - if(this.validfile) { + if (this.validfile) { this.fetchTOSACAMetadata(); this.paths = new SortPipe().transform(this.paths, 'asc', 'name'); this.tree = this.arrangeTreeData(this.paths); @@ -173,31 +157,31 @@ export class SearchTemplateComponent implements OnInit { name: part, children: [], data: path.data, - path : path.name + path: path.name }; - if(part.trim() == this.blueprintName.trim()) { - this.activationBlueprint = path.data; - newPart.data = JSON.parse(this.activationBlueprint.toString()); + if (part.trim() == this.blueprintName.trim()) { + this.activationBlueprint = path.data; + newPart.data = JSON.parse(this.activationBlueprint.toString()); console.log('newpart', newPart); this.entryDefinition = path.name.trim(); } - if(newPart.name !== '') { - currentLevel.push(newPart); - currentLevel = newPart.children; + if (newPart.name !== '') { + currentLevel.push(newPart); + currentLevel = newPart.children; } } }); - }); + }); this.loader.hideLoader(); return tree; } fetchTOSACAMetadata() { let toscaData = {}; - this.paths.forEach(file =>{ - if(file.name.includes('TOSCA.meta')) { + this.paths.forEach(file => { + if (file.name.includes('TOSCA.meta')) { let keys = file.data.split("\n"); - keys.forEach((key)=>{ + keys.forEach((key) => { let propertyData = key.split(':'); toscaData[propertyData[0]] = propertyData[1]; }); |