summaryrefslogtreecommitdiffstats
path: root/cds-ui/client
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2020-04-08 19:16:59 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-08 19:16:59 +0000
commit2973e9755cb2e7424eacaeb9e277cbd613605ec1 (patch)
tree102756e725c30051cd6883bde219253f3f3e2a19 /cds-ui/client
parent01d045f109c24749c9ed46f4008f496e4bf62bcb (diff)
parentd7d2b0657b18a96bc1889f8404d7b212f28922e6 (diff)
Merge "Adding delete catalog" into frankfurt
Diffstat (limited to 'cds-ui/client')
-rw-r--r--cds-ui/client/src/app/common/constants/app-constants.ts2
-rw-r--r--cds-ui/client/src/app/common/core/services/api.service.ts7
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.ts37
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.service.ts4
4 files changed, 19 insertions, 31 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 1b4720c4a..30b4ece0b 100644
--- a/cds-ui/client/src/app/common/constants/app-constants.ts
+++ b/cds-ui/client/src/app/common/constants/app-constants.ts
@@ -119,5 +119,5 @@ export const ControllerCatalogURLs = {
saveControllerCatalog: '/controllercatalog/save',
getDefinition: '/controllercatalog/model-type/by-definition',
getDerivedFrom: '/controllercatalog/model-type/by-derivedfrom',
- deleteCatalog: '/controllercatalog/model-type'
+ deleteCatalog:'/controllercatalog'
} \ No newline at end of file
diff --git a/cds-ui/client/src/app/common/core/services/api.service.ts b/cds-ui/client/src/app/common/core/services/api.service.ts
index addf51ca5..af93787fd 100644
--- a/cds-ui/client/src/app/common/core/services/api.service.ts
+++ b/cds-ui/client/src/app/common/core/services/api.service.ts
@@ -30,20 +30,21 @@ export class ApiService {
constructor(private _http: HttpClient) {
}
+
get(url: string, params?: any): Observable<any> {
return this._http.get(url,params);
}
post(url: string, body: any | null, options?:any): Observable<any> {
-
return this._http.post(url, body,options);
}
+
put() {
// to do
}
- delete() {
- // to do
+ delete(url: string, params?: any): Observable<any> {
+ return this._http.delete(url,params);
}
} \ No newline at end of file
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 efafe5e8f..7c379599f 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
@@ -82,37 +82,20 @@ export class SearchCatalogComponent implements OnInit {
}, 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"
-// }];
}
editInfo(item: ICatalog, option: string) {
- 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);
-//
-// })
- }
+ if(option == 'Delete'){
+ this.searchCatalogService.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',
diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.service.ts b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.service.ts
index 47896058a..362eab030 100644
--- a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.service.ts
+++ b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.service.ts
@@ -33,4 +33,8 @@ export class SearchCatalogService {
searchByTags(tag) {
return this.api.get(ControllerCatalogURLs.searchControllerCatalogByTags + '/' + tag);
}
+
+ deleteCatalog(modelName) {
+ return this.api.delete(ControllerCatalogURLs.deleteCatalog + '/' + modelName);
+ }
}