summaryrefslogtreecommitdiffstats
path: root/cds-ui
diff options
context:
space:
mode:
authorSwapnali Shadanan Pode <sp00501638@techmahindra.com>2019-11-19 12:49:14 +0530
committerSwapnali Shadanan Pode <sp00501638@techmahindra.com>2019-11-19 12:49:14 +0530
commit54fb88cc8abe54300c45f9feec6ceafebc2a9349 (patch)
treec7bb4f2e1f96f1438dc332f54d510d0146f24919 /cds-ui
parent31c2f7de56c5dd90de17ec3026510e5cc660ae67 (diff)
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 <sp00501638@techmahindra.com>
Diffstat (limited to 'cds-ui')
-rw-r--r--cds-ui/client/src/app/common/core/store/models/catalog.model.ts16
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.html16
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.ts28
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.html33
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.ts13
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.html2
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.ts25
7 files changed, 73 insertions, 60 deletions
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 @@
<mat-card-content>
<form [formGroup]="CatalogFormData" (ngSubmit)="CreateCatalog()">
<mat-form-field class="form-field">
- <input matInput placeholder="Model Name" formControlName="Model_Name">
+ <input matInput placeholder="Model Name" formControlName="modelName">
</mat-form-field>
<mat-form-field class="form-field" >
- <input matInput placeholder="User Id" formControlName="User_id">
+ <input matInput placeholder="User Id" formControlName="updatedBy">
</mat-form-field>
<mat-form-field class="form-field">
- <input matInput placeholder="Tags" formControlName="_tags">
+ <input matInput placeholder="Tags" formControlName="tags">
</mat-form-field>
<mat-form-field class="form-field">
- <mat-select matInput placeholder="Definition Type" formControlName="_type">
- <mat-option [value]="item" *ngFor="let item of definitionType">{{item.definitionType}}</mat-option>
+ <mat-select matInput placeholder="Definition Type" formControlName="definitionType">
+ <mat-option [value]="item" *ngFor="let item of definitionType">{{item}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="form-field" >
- <mat-select matInput placeholder="Derived From" formControlName="Derived_From">
- <mat-option [value]="item" *ngFor="let item of derivedFrom">{{item.derivedFrom}}</mat-option>
+ <mat-select matInput placeholder="Derived From" formControlName="derivedFrom">
+ <mat-option [value]="item" *ngFor="let item of derivedFrom">{{item}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="form-field" >
- <textarea matInput placeholder="Description" formControlName="_description"></textarea>
+ <textarea matInput placeholder="Description" formControlName="description"></textarea>
</mat-form-field>
<br>
<div >
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<ICatalogState>;
catalog: ICatalog;
constructor(private formBuilder: FormBuilder, private store: Store<IAppState>, 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 @@
<div>
<h1 mat-dialog-title>Details</h1>
<mat-dialog-content [formGroup]="CatalogFormData">
- <mat-form-field class="form-field">
- <input matInput placeholder="Model Name" formControlName="Model_Name">
- </mat-form-field>
- <mat-form-field class="form-field" >
- <input matInput placeholder="User Id" formControlName="User_id">
- </mat-form-field>
- <mat-form-field class="form-field">
- <input matInput placeholder="Tags" formControlName="_tags">
- </mat-form-field>
- <mat-form-field class="form-field">
+ <mat-form-field class="form-field">
+ <input matInput placeholder="Model Name" formControlName="modelName">
+ </mat-form-field>
+ <mat-form-field class="form-field" >
+ <input matInput placeholder="User Id" formControlName="updatedBy">
+ </mat-form-field>
+ <mat-form-field class="form-field">
+ <input matInput placeholder="Tags" formControlName="tags">
+ </mat-form-field>
+ <mat-form-field class="form-field">
<!-- <mat-select matInput placeholder="Definition Type" formControlName="_type">
<mat-option [value]="item" *ngFor="let item of definitionType">{{item.definitionType}}</mat-option>
</mat-select> -->
- <input matInput placeholder="Definition Type" formControlName="_type">
- </mat-form-field>
- <mat-form-field class="form-field" >
+ <input matInput placeholder="Definition Type" formControlName="definitionType">
+ </mat-form-field>
+ <mat-form-field class="form-field" >
<!-- <mat-select matInput placeholder="Derived From" formControlName="Derived_From">
<mat-option [value]="item" *ngFor="let item of derivedFrom">{{item.derivedFrom}}</mat-option>
</mat-select> -->
- <input matInput placeholder="Derived From" formControlName="Derived_From">
- </mat-form-field>
+ <input matInput placeholder="Derived From" formControlName="derivedFrom">
+ </mat-form-field>
+ <mat-form-field class="form-field" >
+ <textarea matInput placeholder="Definition" formControlName="definition"></textarea>
+ </mat-form-field>
<br>
</mat-dialog-content>
<mat-dialog-actions *ngIf="!isDisabled">
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 @@
*/-->
<form class="search-form" [formGroup]="myControl">
<mat-form-field class="search-full-width">
- <input matInput type="text" [(ngModel)]="searchText" placeholder="Search Catalog" formControlName="search_input">
+ <input matInput type="text" placeholder="Search Catalog" formControlName="search_input" #searchText>
<button matSuffix mat-icon-button (click)="fetchCatalogByName()">
<mat-icon>search</mat-icon>
</button>
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');
+ })
}
});
}