From 54fb88cc8abe54300c45f9feec6ceafebc2a9349 Mon Sep 17 00:00:00 2001 From: Swapnali Shadanan Pode Date: Tue, 19 Nov 2019 12:49:14 +0530 Subject: Adding changes for catalog edit and create Adding changes for catalog edit and create Change-Id: Ib9567e2e483b3abf56f61a77d5c82d4234ee97dc Issue-ID: CCSDK-810 Signed-off-by: Swapnali Shadanan Pode --- .../app/common/core/store/models/catalog.model.ts | 16 ++++++----- .../create-catalog/create-catalog.component.html | 16 +++++------ .../create-catalog/create-catalog.component.ts | 28 ++++++++++-------- .../catalog-data-dialog.component.html | 33 ++++++++++++---------- .../catalog-data-dialog.component.ts | 13 +++++---- .../search-catalog/search-catalog.component.html | 2 +- .../search-catalog/search-catalog.component.ts | 25 ++++++++-------- 7 files changed, 73 insertions(+), 60 deletions(-) (limited to 'cds-ui/client/src') diff --git a/cds-ui/client/src/app/common/core/store/models/catalog.model.ts b/cds-ui/client/src/app/common/core/store/models/catalog.model.ts index 2344f3336..6a86185a6 100644 --- a/cds-ui/client/src/app/common/core/store/models/catalog.model.ts +++ b/cds-ui/client/src/app/common/core/store/models/catalog.model.ts @@ -19,11 +19,13 @@ */ export interface ICatalog { - Model_Name: string; - User_id: string; - _tags: string; - _type: string; - Derived_From: string; - _description : string; - definition: object[]; + modelName: string; + derivedFrom: string; + definitionType : string; + definition: object; + description: string; + version: String; + tags: String; + creationDate: String; + updatedBy: String; } \ No newline at end of file diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.html b/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.html index 8c71edfa7..ba32a2ede 100644 --- a/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.html +++ b/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.html @@ -23,26 +23,26 @@
- + - + - + - - {{item.definitionType}} + + {{item}} - - {{item.derivedFrom}} + + {{item}} - +
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 91c6f2835..3b8294db9 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 @@ -41,21 +41,21 @@ export class CreateCatalogComponent implements OnInit { @ViewChild(JsonEditorComponent) editor: JsonEditorComponent; options = new JsonEditorOptions(); data:any; - 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'}]; + derivedFrom: any[] = ['tosca.nodes.Component','tosca.nodes.VNF','tosca.nodes.Artifact','tosca.nodes.ResourceSource','tosca.nodes.Workflow','tosca.nodes.Root']; + definitionType: any[] = ['node_type']; ccState: Observable; catalog: ICatalog; constructor(private formBuilder: FormBuilder, private store: Store, private catalogCreateService: CreateCatalogService, private alertService: NotificationHandlerService) { this.ccState = this.store.select('catalog'); this.CatalogFormData = this.formBuilder.group({ - Model_Name: ['', Validators.required], - User_id: ['', Validators.required], - _tags: ['', Validators.required], - _type: ['', Validators.required], - Derived_From: ['', Validators.required], - _description : ['', Validators.required] - }); + modelName: ['', Validators.required], + updatedBy: ['', Validators.required], + tags: ['', Validators.required], + definitionType: ['', Validators.required], + derivedFrom: ['', Validators.required], + description : ['', Validators.required] + }); } ngOnInit() { this.options.mode = 'text'; @@ -90,8 +90,14 @@ export class CreateCatalogComponent implements OnInit { // }) } CreateCatalog(){ - this.catalog = Object.assign({}, this.CatalogFormData.value); - this.catalog.definition=this.data; + this.catalog.modelName=this.CatalogFormData.controls['modelName'].value; + this.catalog.updatedBy=this.CatalogFormData.controls['updatedBy'].value + this.catalog.tags=this.CatalogFormData.controls['tags'].value + this.catalog.definitionType=this.CatalogFormData.controls['definitionType'].value + this.catalog.derivedFrom=this.CatalogFormData.controls['derivedFrom'].value + this.catalog.description=this.CatalogFormData.controls['description'].value + this.catalog.definition=this.data; + console.log(this.catalog); let catalogState = { catalog: this.catalog } diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.html b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.html index ca4a679ed..34502bc95 100644 --- a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.html +++ b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.html @@ -21,27 +21,30 @@

Details

- - - - - - - - - - + + + + + + + + + + - - - + + + - - + + + + +
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 215f311e9..b2748d871 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 @@ -62,12 +62,13 @@ export class CatalogDataDialogComponent implements OnInit{ this.ccState = this.store.select('catalog'); this.CatalogFormData = this.formBuilder.group({ - Model_Name: [{value:this.property[0], disabled: this.isDisabled}, Validators.required], - User_id: [{value:this.property[8], disabled: this.isDisabled}, Validators.required], - _tags: [{value:this.property[6], disabled: this.isDisabled}, Validators.required], - _type: [{value:this.property[2], disabled: this.isDisabled}, Validators.required], - Derived_From: [{value:this.property[1], disabled: this.isDisabled}, Validators.required], - }); + modelName: [{value:this.property[0], disabled: this.isDisabled}, Validators.required], + derivedFrom: [{value:this.property[1], disabled: this.isDisabled}, Validators.required], + definitionType: [{value:this.property[2], disabled: this.isDisabled}, Validators.required], + definition: [{value:JSON.stringify(this.property[3]), disabled: this.isDisabled}, Validators.required], + tags: [{value:this.property[6], disabled: this.isDisabled}, Validators.required], + updatedBy: [{value:this.property[8], disabled: this.isDisabled}, Validators.required], + }); } ngOnInit(){ 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 c8452e2ff..5262f1744 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 @@ -19,7 +19,7 @@ */--> - + 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 717e1088f..3fb4530e6 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 @@ -109,19 +109,20 @@ export class SearchCatalogComponent implements OnInit { if(result == undefined || result == null){ console.log("dialogbox is closed"); }else{ - this.catalog.Model_Name=result['Model_Name']; - this.catalog.User_id=result['User_id']; - this.catalog._tags=result['_tags']; - this.catalog._type=result['_type']; - this.catalog.Derived_From=result['Derived_From']; - console.log(this.catalog); - this.catalogCreateService.saveCatalog(this.catalog) - .subscribe(response=>{ + 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'); - }) + }, + error=>{ + this.alertService.error('Error saving resources'); + }) } }); } -- cgit 1.2.3-korg