summaryrefslogtreecommitdiffstats
path: root/cds-ui/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'cds-ui/client/src/app')
-rw-r--r--cds-ui/client/src/app/common/constants/app-constants.ts10
-rw-r--r--cds-ui/client/src/app/common/shared/components/home/home.component.html14
-rw-r--r--cds-ui/client/src/app/common/shared/components/home/home.component.scss28
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/blueprint.module.ts9
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts27
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts23
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.html16
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.scss0
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.spec.ts25
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.ts67
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.html30
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.scss38
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.ts42
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.ts5
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts67
16 files changed, 200 insertions, 203 deletions
diff --git a/cds-ui/client/src/app/common/constants/app-constants.ts b/cds-ui/client/src/app/common/constants/app-constants.ts
index bcfcc4e0c..5ebde91e3 100644
--- a/cds-ui/client/src/app/common/constants/app-constants.ts
+++ b/cds-ui/client/src/app/common/constants/app-constants.ts
@@ -93,6 +93,16 @@ export const GlobalContants = {
}
};
+export const BlueprintURLs = {
+ getAllBlueprints: '/controllerblueprint/all',
+ searchByTag: '/controllerblueprint/searchByTags/',
+ save: '/controllerblueprint/create-blueprint',
+ publish: '/controllerblueprint/publish',
+ enrich: '/controllerblueprint/enrich-blueprint',
+ download: '/controllerblueprint/download-blueprint/',
+ deploy:'/controllerblueprint/deploy-blueprint'
+}
+
export const ResourceDictionaryURLs = {
saveResourceDictionary: '/resourcedictionary/save',
searchResourceDictionaryByTags: '/resourcedictionary/search',
diff --git a/cds-ui/client/src/app/common/shared/components/home/home.component.html b/cds-ui/client/src/app/common/shared/components/home/home.component.html
index ef6880d37..f73f0e863 100644
--- a/cds-ui/client/src/app/common/shared/components/home/home.component.html
+++ b/cds-ui/client/src/app/common/shared/components/home/home.component.html
@@ -37,18 +37,18 @@ limitations under the License.
<mat-sidenav #drawer mode="side" [(opened)]="opened" (opened)="events.push('open!')" (closed)="events.push('close!')">
<mat-toolbar color="" primary>Menu</mat-toolbar>
<mat-nav-list>
- <!-- <a mat-list-item [routerLink]="['/blueprint']">Controller Blueprint</a> -->
- <nav class="ng-tns-c12-2 ng-star-inserted">
- <!-- <button class="docs-nav-content-btn" cdkaccordionitem="" expanded="true"
+ <a mat-list-item [routerLink]="['/blueprint']">Controller Blueprint</a>
+ <!-- <nav class="ng-tns-c12-2 ng-star-inserted"> -->
+ <!-- <button class="docs-nav-content-btn" cdkaccordionitem="" expanded="true"
aria-label="Form Controls, section toggle" aria-controls="panel-forms" aria-expanded="false">-->
- <label>Controller Blueprint</label>
- <!-- <mat-icon class="mat-icon notranslate material-icons mat-icon-no-color" role="img" aria-hidden="true">
+ <!-- <label>Controller Blueprint</label> -->
+ <!-- <mat-icon class="mat-icon notranslate material-icons mat-icon-no-color" role="img" aria-hidden="true">
keyboard_arrow_down</mat-icon></button> -->
- <ul>
+ <!-- <ul>
<a mat-list-item [routerLink]="['/blueprint']">Create Blueprint</a>
<a mat-list-item [routerLink]="['/']">Search Blueprint</a>
</ul>
- </nav>
+ </nav> -->
<a mat-list-item [routerLink]="['/resource-definition']">Resource Definition</a>
</mat-nav-list>
</mat-sidenav>
diff --git a/cds-ui/client/src/app/common/shared/components/home/home.component.scss b/cds-ui/client/src/app/common/shared/components/home/home.component.scss
index be21b750c..20ef5c20a 100644
--- a/cds-ui/client/src/app/common/shared/components/home/home.component.scss
+++ b/cds-ui/client/src/app/common/shared/components/home/home.component.scss
@@ -19,19 +19,21 @@ limitations under the License.
============LICENSE_END============================================
*/
-// .example-container {
-// // position: absolute;
-// top: 0;
-// bottom: 0;
-// left: 0;
-// right: 0;
-// }
-// .example-events {
-// width: 300px;
-// height: 200px;
-// overflow: auto;
-// border: 1px solid #555;
-// }
+.example-container {
+ // position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+}
+
+.example-events {
+ width: 300px;
+ height: 200px;
+ overflow: auto;
+ border: 1px solid #555;
+}
+
.mat-sidenav-container {
height: 652px;
}
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/blueprint.module.ts b/cds-ui/client/src/app/feature-modules/blueprint/blueprint.module.ts
index 4d0781aec..27803ce56 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/blueprint.module.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/blueprint.module.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018 IBM Intellectual Property. All rights reserved.
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -30,17 +30,12 @@ import { SelectTemplateModule } from './select-template/select-template.module';
import { ModifyTemplateModule } from './modify-template/modify-template.module';
import { DeployTemplateModule } from './deploy-template/deploy-template.module';
import { TestTemplateModule } from './test-template/test-template.module';
-import { SearchEditCBAComponent } from './search-edit-cba/search-edit-cba.component';
import { AppMaterialModule } from '../../../app/common/modules/app-material.module';
import { ReactiveFormsModule } from '@angular/forms';
@NgModule({
declarations: [
- BlueprintComponent,
- SearchEditCBAComponent
- ],
- exports:[
- SearchEditCBAComponent
+ BlueprintComponent
],
imports: [
CommonModule,
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
index 0a3a8d2ef..7b2eaeb17 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
@@ -35,7 +35,7 @@ import { Store } from '@ngrx/store';
import { Observable } from 'rxjs';
import { IBlueprintState } from 'src/app/common/core/store/models/blueprintState.model';
import { LoadBlueprintSuccess, SetBlueprintState } from '../../../../common/core/store/actions/blueprint.action'
-import { ApiService } from 'src/app/common/core/services/api.service';
+
import { IMetaData } from 'src/app/common/core/store/models/metadata.model';
import { EditorService } from './editor.service';
import { SortPipe } from '../../../../common/shared/pipes/sort.pipe';
@@ -130,7 +130,7 @@ export class EditorComponent implements OnInit {
artifactName: any;
artifactVersion: any;
- constructor(private store: Store<IAppState>, private apiservice: EditorService,
+ constructor(private store: Store<IAppState>, private editorService: EditorService,
private alertService: NotificationHandlerService, private loader: LoaderService
)
{
@@ -244,7 +244,8 @@ export class EditorComponent implements OnInit {
.then(blob => {
const formData = new FormData();
formData.append("file", blob);
- this.apiservice.enrich("/enrich-blueprint/", formData)
+ // this.editorService.enrich("/enrich-blueprint/", formData)
+ this.editorService.enrich(formData)
.subscribe(
(response) => {
this.zipFile.files = {};
@@ -271,7 +272,8 @@ export class EditorComponent implements OnInit {
.then(blob => {
const formData = new FormData();
formData.append("file", blob);
- this.apiservice.post("/create-blueprint/", formData)
+ // this.editorService.saveBlueprint("/create-blueprint/", formData)
+ this.editorService.saveBlueprint(formData)
.subscribe(
data => {
this.alertService.success('Success:' + JSON.stringify(data));
@@ -289,7 +291,8 @@ export class EditorComponent implements OnInit {
.then(blob => {
const formData = new FormData();
formData.append("file", blob);
- this.apiservice.deployPost("/deploy-blueprint/", formData)
+ // this.editorService.deployPost("/deploy-blueprint/", formData)
+ this.editorService.deployPost(formData)
.subscribe(data => {
this.alertService.success('Saved Successfully:' + JSON.stringify(data));
}, error=>{
@@ -305,7 +308,8 @@ export class EditorComponent implements OnInit {
.then(blob => {
const formData = new FormData();
formData.append("file", blob);
- this.apiservice.post("/publish/", formData)
+ // this.editorService.post("/publish/", formData)
+ this.editorService.publishBlueprint(formData)
.subscribe(data => {
this.alertService.success('Published:' + JSON.stringify(data))
}, error=>{
@@ -326,7 +330,8 @@ export class EditorComponent implements OnInit {
download() {
console.log(this.artifactName);
- status = this.apiservice.downloadCBA("/download-blueprint/" + this.artifactName + "/" + this.artifactVersion);
+ // status = this.editorService.downloadCBA("/download-blueprint/" + this.artifactName + "/" + this.artifactVersion);
+ status = this.editorService.downloadCBA("/"+this.artifactName + "/" + this.artifactVersion);
window.alert(status);
// .subscribe(response => {
// console.log(response);
@@ -338,14 +343,8 @@ export class EditorComponent implements OnInit {
// console.log(error);
// }
// );
-
- // this.create();
- // var zipFilename = "baseconfiguration.zip";
- // this.zipFile.generateAsync({ type: "blob" })
- // .then(blob => {
- // saveAs(blob, zipFilename);
- // });
}
+
setEditorMode() {
switch (this.fileExtension) {
case "xml":
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts
index ec2524422..025fc95d4 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts
@@ -25,19 +25,18 @@ import { HttpClient } from '@angular/common/http';
import { Observable, observable } from 'rxjs';
import { ApiService } from '../../../../common/core/services/api.service';
import { saveAs } from 'file-saver';
+import { BlueprintURLs } from '../../../../common/constants/app-constants';
@Injectable()
export class EditorService {
- // blueprintUrl = '../../constants/blueprint.json';
-
constructor(private _http: HttpClient, private api: ApiService) {
}
- enrich(uri: string, body: FormData): Observable<any> {
- return this.api.post(uri, body, { responseType: 'blob' });
+ enrich(body: FormData): Observable<any> {
+ return this.api.post(BlueprintURLs.enrich, body, { responseType: 'blob' });
}
- downloadCBA(uri: string): string {
- this.api.get(uri, { responseType: 'blob' })
+ downloadCBA(artifactDetails: string): string {
+ this.api.get(BlueprintURLs.download+artifactDetails, { responseType: 'blob' })
.subscribe(response => {
let blob = new Blob([response], { 'type': "application/octet-stream" });
saveAs(blob, "CBA.zip");
@@ -46,13 +45,17 @@ export class EditorService {
return "Download Success";
}
- post(uri: string, body: any | null, options?: any): Observable<any> {
+ saveBlueprint(body: any | null, options?: any): Observable<any> {
+
+ return this.api.post(BlueprintURLs.save, body, options);
+ }
+ publishBlueprint(body: any | null, options?: any): Observable<any> {
- return this.api.post(uri, body, options);
+ return this.api.post(BlueprintURLs.publish, body, options);
}
- deployPost(uri: string, body: any | null, options?: any): Observable<any> {
+ deployPost(body: any | null, options?: any): Observable<any> {
- return this.api.post(uri, body, { responseType: 'text' });
+ return this.api.post(BlueprintURLs.deploy, body, { responseType: 'text' });
}
} \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.html b/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.html
deleted file mode 100644
index 7371d2105..000000000
--- a/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.html
+++ /dev/null
@@ -1,16 +0,0 @@
-/* ============LICENSE_START========================================== =================================================================== Copyright (C) 2018 IBM Intellectual Property. All rights reserved. ===================================================================
-Unless otherwise specified, all software contained herein is licensed under the Apache License, Version 2.0 (the License); you may not use this software 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 #resourceSelect type="text" [(ngModel)]="searchText" placeholder="Search Resources" matInput [matAutocomplete]="auto" formControlName="search_input">
- <button matSuffix mat-icon-button (click)="fetchResourceByName()"><mat-icon>search</mat-icon></button>
- <!-- <mat-autocomplete #auto="matAutocomplete">
- <mat-option (click)="selected(option)" *ngFor="let option of options | search : searchText" [value]="option.tags">
- {{option.tags}}
- </mat-option>
- </mat-autocomplete> -->
- </mat-form-field>
-</form> \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.scss b/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.scss
deleted file mode 100644
index e69de29bb..000000000
--- a/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.scss
+++ /dev/null
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.spec.ts b/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.spec.ts
deleted file mode 100644
index 78210cf12..000000000
--- a/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.spec.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { SearchEditCBAComponent } from './search-edit-cba.component';
-
-describe('SearchEditCBAComponent', () => {
- let component: SearchEditCBAComponent;
- let fixture: ComponentFixture<SearchEditCBAComponent>;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [ SearchEditCBAComponent ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(SearchEditCBAComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.ts
deleted file mode 100644
index 4253e2172..000000000
--- a/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : CDS
-* ================================================================================
-* Copyright 2019 TechMahindra
-*
-* Modifications Copyright (C) 2019 IBM
-*=================================================================================
-* 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, EventEmitter, Output } from '@angular/core';
-import {FormBuilder, FormGroup, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
-
-import { MatAutocompleteTrigger } from '@angular/material'
-@Component({
- selector: 'app-search-edit-cba',
- templateUrl: './search-edit-cba.component.html',
- styleUrls: ['./search-edit-cba.component.scss']
-})
-export class SearchEditCBAComponent implements OnInit {
-
- myControl: FormGroup;
- @Output() resourcesData = new EventEmitter();
- options: any[] = [];
- //['One','One1', 'Two', 'Three'];
- // @ViewChild('resourceSelect') resourceSelect;
- @ViewChild('resourceSelect', { read: MatAutocompleteTrigger }) resourceSelect: MatAutocompleteTrigger;
-
- searchText: string = '';
- constructor(private _formBuilder: FormBuilder,
- ) { }
-
- ngOnInit() {
- this.myControl = this._formBuilder.group({
- search_input: ['', Validators.required]
- });
- }
- selected(value){
- 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);
- // })
- }
-
-}
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 11c2ff0b6..ca260394b 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
@@ -21,11 +21,27 @@ 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">
- <button matSuffix mat-icon-button (click)="fetchResourceByName()"><mat-icon>search</mat-icon></button>
- <mat-autocomplete #auto="matAutocomplete">
- <mat-option (click)="selected(option)" *ngFor="let option of options" [value]="option.tags">
- {{option.tags}}
- </mat-option>
- </mat-autocomplete>
+ <!-- <input #resourceSelect type="text" [(ngModel)]="searchText" placeholder="Search Resources" formControlName="search_input"> -->
+ <button matSuffix mat-icon-button (click)="fetchResourceByName()">
+ <mat-icon>search</mat-icon>
+ </button>
+ <!-- <mat-autocomplete #auto="matAutocomplete">
+ <mat-option (click)="selected(option)" *ngFor="let option of options" [value]="option.tags">
+ {{option.tags}}
+ </mat-option>
+ </mat-autocomplete> -->
</mat-form-field>
-</form> \ No newline at end of file
+</form>
+<mat-grid-list cols="8">
+ <mat-grid-tile *ngFor="let option of options">
+ <mat-card class="example-card">
+ <mat-card-content class="card-content">
+ {{option.blueprintModel.artifactName}}
+ </mat-card-content>
+ <mat-card-actions>
+ <button mat-menu-item>Edit</button>
+ <button mat-menu-item>Info</button>
+ </mat-card-actions>
+ </mat-card>
+ </mat-grid-tile>
+</mat-grid-list> \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.scss b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.scss
index 93f5c9dea..6692764ae 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.scss
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.scss
@@ -17,4 +17,40 @@ 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============================================
-*/ \ No newline at end of file
+*/
+
+.example-card {
+ min-width: 150px;
+ max-height: 150px;
+ background-color: #ebebeb;
+}
+
+button.mat-menu-item {
+ width: auto;
+ float: left;
+ // margin-top: 10px;
+ // margin-bottom: 5px;
+ border-radius: 4px;
+ // min-width: 6em;
+ background-color: #3f51b5;
+ margin: 1px;
+ // padding: 1px;
+ cursor: pointer;
+ color: white;
+}
+
+.card-deck-container {
+ position: relative;
+ border-radius: 1px;
+ padding: 2px;
+ margin: 2px;
+ // background-color: #f5f5f5;
+}
+
+.grid-container {
+ margin: 20px;
+}
+
+.card-content {
+ text-align: center;
+} \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.ts
index a14508670..1c3630649 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-from-database/search-from-database.component.ts
@@ -19,8 +19,8 @@ limitations under the License.
============LICENSE_END============================================
*/
-import { Component, OnInit, ViewChild, EventEmitter, Output } from '@angular/core';
-import { FormBuilder, FormGroup, Validators} from '@angular/forms';
+import { Component, OnInit, ViewChild, EventEmitter, Output } from '@angular/core';
+import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { SearchTemplateService } from '../search-template.service';
import { MatAutocompleteTrigger } from '@angular/material';
import { SearchPipe } from 'src/app/common/shared/pipes/search.pipe';
@@ -32,34 +32,36 @@ import { SearchPipe } from 'src/app/common/shared/pipes/search.pipe';
export class SearchFromDatabaseComponent implements OnInit {
myControl: FormGroup;
- @Output() resourcesData = new EventEmitter();
- options: any[] = [];
+ @Output() resourcesData = new EventEmitter();
+ options: any[] = [];
@ViewChild('resourceSelect', { read: MatAutocompleteTrigger }) resourceSelect: MatAutocompleteTrigger;
searchText: string = '';
constructor(private _formBuilder: FormBuilder,
- private existingModelService: SearchTemplateService) { }
-
- ngOnInit() {
+ private searchService: SearchTemplateService) { }
+
+ ngOnInit() {
this.myControl = this._formBuilder.group({
search_input: ['', Validators.required]
});
}
- selected(value){
- this.resourcesData.emit(value);
- }
+ selected(value) {
+ this.resourcesData.emit(value);
+ }
- fetchResourceByName() {
- this.existingModelService.searchByTags("/searchByTags/",this.searchText)
- .subscribe(data=>{
- console.log(data);
- data.forEach(element => {
- this.options.push(element)
- });
- this.resourceSelect.openPanel();
- }, error=>{
+ fetchResourceByName() {
+ this.searchService.searchByTags(this.searchText)
+ .subscribe(data => {
+ // console.log(data);
+ data.forEach(element => {
+ this.options.push(element)
+ });
+ // this.resourceSelect.openPanel();
+ }, error => {
window.alert('error' + error);
})
- }
+ console.log(this.options)
+ // this.options=['test','vns','capability','hello','hi','hoi','dfagfagshdgfashdf','adsfhksd'];
+ }
}
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.ts
index dd17a30d2..31a839cc3 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.ts
@@ -23,6 +23,7 @@ import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { ApiService } from '../../../../common/core/services/api.service';
+import { BlueprintURLs } from '../../../../common/constants/app-constants';
@Injectable({
providedIn: 'root'
@@ -31,7 +32,7 @@ export class SearchTemplateService {
constructor(private _http: HttpClient, private api: ApiService) { }
- searchByTags(uri: string, searchText: String): Observable<any>{
- return this.api.post(uri, searchText);
+ searchByTags(searchText: String): Observable<any>{
+ return this.api.get(BlueprintURLs.searchByTag+'/'+searchText);
}
}
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html
index b179f011d..a5f367de0 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html
@@ -27,7 +27,7 @@
class="sources-list"
(cdkDropListDropped)="drop($event)">
<div class="sources-box" *ngFor="let item of sourcesOptions;let i = index" cdkDrag>
- <mat-expansion-panel class="expansion-panel" (opened)="selected(item)">
+ <mat-expansion-panel class="expansion-panel">
<mat-expansion-panel-header>
<mat-panel-title>
{{item.name}}
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts
index 42f990a24..3e8f4f8d6 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts
@@ -48,7 +48,8 @@ export class SourcesTemplateComponent implements OnInit {
sources:ISourcesData;
sourcesOptions = [];
sourcesData = {};
- @Output() resourcesData = new EventEmitter();
+ @Output() resourcesData = new EventEmitter();
+ tempOption = [];
constructor(private store: Store<IAppState>, private apiService: ResourceEditService) {
this.rdState = this.store.select('resources');
@@ -62,12 +63,10 @@ export class SourcesTemplateComponent implements OnInit {
resourcesdata => {
var resourcesState: IResourcesState = { resources: resourcesdata.resources, isLoadSuccess: resourcesdata.isLoadSuccess, isSaveSuccess: resourcesdata.isSaveSuccess, isUpdateSuccess: resourcesdata.isUpdateSuccess };
this.resources=resourcesState.resources;
- // this.sources = resourcesState.resources.sources;
if(resourcesState.resources.definition && resourcesState.resources.definition.sources) {
this.sources = resourcesState.resources.definition.sources;
}
for (let key in this.sources) {
- // this.sourcesOptions.push(key);
let source = {
name : key,
data: this.sources[key]
@@ -88,6 +87,7 @@ export class SourcesTemplateComponent implements OnInit {
this.resources.sources = Object.assign({},originalSources);
};
+ // to remove this method
selected(sourceValue){
this.sourcesData= [];//this.sources[value];
this.apiService.getModelType(sourceValue.value)
@@ -136,14 +136,45 @@ export class SourcesTemplateComponent implements OnInit {
}
drop(event: CdkDragDrop<string[]>) {
- if (event.previousContainer === event.container) {
- moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
- } else {
- transferArrayItem(event.previousContainer.data,
- event.container.data,
- event.previousIndex,
- event.currentIndex);
- }
+ if (!this.checkIfSourceExists(event.item.element.nativeElement.innerText)) {
+ if (event.previousContainer === event.container) {
+ moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
+ } else {
+ transferArrayItem(event.previousContainer.data,
+ event.container.data,
+ event.previousIndex,
+ event.currentIndex);
+ }
+ this.tempOption.forEach((item) => {
+ if (item.name == event.item.element.nativeElement.innerText) {
+ this.apiService.getModelType(item.value)
+ .subscribe(data => {
+ console.log(data);
+ data.forEach(dataitem => {
+ if (typeof (dataitem) == "object") {
+ for (let key1 in dataitem) {
+ if (key1 == 'properties') {
+ let newPropObj = {};
+ newPropObj["name"] = event.item.element.nativeElement.innerText;
+ newPropObj['data'] = {};
+ let newSoruceObj = {};
+ for (let key2 in dataitem[key1]) {
+ newSoruceObj[key2] = '';;
+ }
+ newPropObj['data']['properties'] = newSoruceObj;
+ this.sourcesOptions.forEach(sourcesOptionsitem => {
+ if (sourcesOptionsitem.name == item.name) {
+ sourcesOptionsitem.data = newPropObj['data'];
+ }
+ });
+ }
+ }
+ }
+ });
+ });
+ }
+ });
+ }
}
getResources() {
@@ -152,11 +183,21 @@ export class SourcesTemplateComponent implements OnInit {
console.log(data);
for (let key in data[0]) {
let sourceObj = { name: key, value: data[0][key] }
- this.option.push(sourceObj);
+ this.option.push(sourceObj);
+ this.tempOption.push(sourceObj);
}
- // this.sourcesOptions = data;
}, error=>{
console.log(error);
})
}
+
+ checkIfSourceExists(sourceName) {
+ let sourceExists: boolean = false;
+ this.sourcesOptions.forEach(item => {
+ if (item.name == sourceName) {
+ sourceExists = true;
+ }
+ });
+ return sourceExists;
+}
}