aboutsummaryrefslogtreecommitdiffstats
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.ts9
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.ts29
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.ts3
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.html3
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.ts131
5 files changed, 102 insertions, 73 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 5beb6af74..1b4720c4a 100644
--- a/cds-ui/client/src/app/common/constants/app-constants.ts
+++ b/cds-ui/client/src/app/common/constants/app-constants.ts
@@ -115,8 +115,9 @@ export const ResourceDictionaryURLs = {
}
export const ControllerCatalogURLs = {
- searchControllerCatalogByTags: '/controllercatalog/search',
- saveControllerCatalog: '/controllercatalog/save',
- getDefinition: '/controllercatalog/model-type/by-definition',
- getDerivedFrom: '/controllercatalog/model-type/by-derivedfrom'
+ searchControllerCatalogByTags: '/controllercatalog/search',
+ saveControllerCatalog: '/controllercatalog/save',
+ getDefinition: '/controllercatalog/model-type/by-definition',
+ getDerivedFrom: '/controllercatalog/model-type/by-derivedfrom',
+ deleteCatalog: '/controllercatalog/model-type'
} \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.ts b/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.ts
index 3b8294db9..ad74a9fc3 100644
--- a/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.ts
+++ b/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.ts
@@ -97,20 +97,23 @@ export class CreateCatalogComponent implements OnInit {
this.catalog.derivedFrom=this.CatalogFormData.controls['derivedFrom'].value
this.catalog.description=this.CatalogFormData.controls['description'].value
this.catalog.definition=this.data;
+ this.catalog.version="";
+ this.catalog.creationDate="";
console.log(this.catalog);
- let catalogState = {
- catalog: this.catalog
- }
- this.store.dispatch(new SetCatalogState(catalogState));
-
- this.catalogCreateService.saveCatalog(this.catalog)
- .subscribe(response=>{
- this.alertService.success("save success")
- },
- error=>{
- this.alertService.error('Error saving resources');
- })
-
+ let catalogState = {
+ catalog: this.catalog
+ }
+ this.store.dispatch(new SetCatalogState(catalogState));
+
+ this.catalogCreateService.saveCatalog(this.catalog)
+ .subscribe(response=>{
+ this.alertService.success("save success")
+ },
+ error=>{
+ console.log(error);
+ this.alertService.error('Error saving resources');
+ })
+
}
onChange($event) {
diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.ts b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.ts
index b2748d871..6f9e6534b 100644
--- a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.ts
+++ b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.ts
@@ -40,8 +40,6 @@ export class CatalogDataDialogComponent implements OnInit{
ccState: Observable<ICatalogState>;
isDisabled: boolean=true;
optionSelected:string;
- // derivedFrom: any[] = [{derivedFrom: 'tosca.nodes.Component'},{derivedFrom:'tosca.nodes.VNF'},{derivedFrom:'tosca.nodes.Artifact'},{derivedFrom:'tosca.nodes.ResourceSource'}, {derivedFrom:'tosca.nodes.Workflow'},{derivedFrom:'tosca.nodes.Root'}];
- // definitionType: any[] = [{definitionType: 'node_type'}];
property:any=[];
constructor(public dialogRef: MatDialogRef<CatalogDataDialogComponent>, @Inject(MAT_DIALOG_DATA) public item: any,private formBuilder: FormBuilder, private store: Store<IAppState> ) {
console.log(item);
@@ -79,7 +77,6 @@ export class CatalogDataDialogComponent implements OnInit{
}
onClickSave(){
- //this.catalog = Object.assign({}, this.CatalogFormData.value);
this.dialogRef.close(this.CatalogFormData.value);
}
}
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
index 5262f1744..ed963a682 100644
--- 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
@@ -20,7 +20,7 @@
<form class="search-form" [formGroup]="myControl">
<mat-form-field class="search-full-width">
<input matInput type="text" placeholder="Search Catalog" formControlName="search_input" #searchText>
- <button matSuffix mat-icon-button (click)="fetchCatalogByName()">
+ <button matSuffix mat-icon-button (click)="fetchCatalogByName(searchText.value)">
<mat-icon>search</mat-icon>
</button>
</mat-form-field>
@@ -36,6 +36,7 @@
<mat-card-actions class="flexBox">
<button class="matStepNextBtn" matStepperNext mat-menu-item (click)="editInfo(option,'Info')">Info</button>
<button class="matStepNextBtn" matStepperNext mat-menu-item (click)="editInfo(option,'Edit')">Edit</button>
+ <button class="matStepNextBtn" matStepperNext mat-menu-item (click)="editInfo(option,'Delete')">Delete</button>
</mat-card-actions>
</mat-card>
</div>
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
index 3fb4530e6..efafe5e8f 100644
--- 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
@@ -32,6 +32,7 @@ import { CreateCatalogService } from '../create-catalog/create-catalog.service';
import { NotificationHandlerService } from 'src/app/common/core/services/notification-handler.service';
import { ICatalogState } from 'src/app/common/core/store/models/catalogState.model';
import { IAppState } from 'src/app/common/core/store/state/app.state';
+import { SetCatalogState } from 'src/app/common/core/store/actions/catalog.action';
@Component({
@@ -67,63 +68,89 @@ export class SearchCatalogComponent implements OnInit {
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);
- // })
+ fetchCatalogByName(search_input) {
+ console.log(search_input);
+ this.options=[];
+ this.searchCatalogService.searchByTags(search_input)
+ .subscribe(data=>{
+ console.log(data);
+ data.forEach(element => {
+ this.options.push(element);
+ });
+ console.log(this.options);
+ //this.catalogSelect.openPanel();
+ }, error=>{
+ window.alert('Catalog not matching the search tag' + error);
+ })
- this.options=[ {
- "modelName": "tosca.nodes.Artifact",
- "derivedFrom": "tosca.nodes.Root",
- "definitionType": "node_type",
- "definition": {
- "description": "This is Deprecated Artifact Node Type.",
- "version": "1.0.0",
- "derived_from": "tosca.nodes.Root"
- },
- "description": "This is Deprecated Artifact Node Type.",
- "version": "1.0.0",
- "tags": "tosca.nodes.Artifact,tosca.nodes.Root,node_type",
- "creationDate": "2019-09-16T07:35:24.000Z",
- "updatedBy": "System"
- }];
+// this.options=[ {
+// "modelName": "tosca.nodes.Artifact",
+// "derivedFrom": "tosca.nodes.Root",
+// "definitionType": "node_type",
+// "definition": {
+// "description": "This is Deprecated Artifact Node Type.",
+// "version": "1.0.0",
+// "derived_from": "tosca.nodes.Root"
+// },
+// "description": "This is Deprecated Artifact Node Type.",
+// "version": "1.0.0",
+// "tags": "tosca.nodes.Artifact,tosca.nodes.Root,node_type",
+// "creationDate": "2019-09-16T07:35:24.000Z",
+// "updatedBy": "System"
+// }];
}
editInfo(item: ICatalog, option: string) {
- this.dialogRef = this.dialog.open(CatalogDataDialogComponent, {
- height: '500px',
- width: '700px',
- disableClose: true,
- data: {item, option}
- });
+ if(option == 'Delete'){
+// this.catalogCreateService.deleteCatalog(item.modelName)
+// .subscribe(response=>{
+// this.alertService.success("Delete Success"+ response)
+// },
+// error=>{
+// console.log(error);
+// this.alertService.error('Error while deleting catalog'+ error);
+//
+// })
+ }
+ else{
+ this.dialogRef = this.dialog.open(CatalogDataDialogComponent, {
+ height: '500px',
+ width: '700px',
+ disableClose: true,
+ data: {item, option}
+ });
- this.dialogRef.afterClosed().subscribe(result => {
- if(result == undefined || result == null){
- console.log("dialogbox is closed");
- }else{
- this.catalog.modelName=result['modelName'];
- this.catalog.derivedFrom=result['derivedFrom'];
- this.catalog.definitionType=result['definitionType'];
- this.catalog.definition=result['definition'];
- this.catalog.tags=result['tags'];
- this.catalog.updatedBy=result['updatedBy'];
- console.log(this.catalog);
- this.catalogCreateService.saveCatalog(this.catalog)
- .subscribe(response=>{
- this.alertService.success("save success"+ response)
- },
- error=>{
- this.alertService.error('Error saving resources');
- })
- }
- });
+ this.dialogRef.afterClosed().subscribe(result => {
+ if(result == undefined || result == null){
+ console.log("dialogbox is closed");
+ }else{
+ this.catalog.modelName=result['modelName'];
+ this.catalog.derivedFrom=result['derivedFrom'];
+ this.catalog.definitionType=result['definitionType'];
+ this.catalog.definition=JSON.parse(result['definition']);
+ this.catalog.tags=result['tags'];
+ this.catalog.updatedBy=result['updatedBy'];
+ this.catalog.description= "";
+ this.catalog.version= "";
+ this.catalog.creationDate="";
+ console.log(this.catalog);
+ let catalogState = {
+ catalog: this.catalog,
+ isLoadSuccess: true,
+ isUpdateSuccess:true,
+ isSaveSuccess:true
+ }
+ this.store.dispatch(new SetCatalogState(catalogState));
+ this.catalogCreateService.saveCatalog(this.catalog)
+ .subscribe(response=>{
+ this.alertService.success("save success"+ response)
+ },
+ error=>{
+ this.alertService.error('Error saving resources');
+ })
+ }
+ });
+ }
}
}