aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui
diff options
context:
space:
mode:
authorswapnalipode <sp00501638@techmahindra.com>2020-03-02 12:57:20 +0530
committerKAPIL SINGAL <ks220y@att.com>2020-03-12 12:24:55 +0000
commit7cc92c22ac6172d6b51425d8628e431350593bca (patch)
tree795de6bb88568c56fa9eb2238780a46ff5020002 /cds-ui
parent949fed2a716fa636aec836ec46fec2c595f68d4f (diff)
Adding delete catalog
Adding delete catalog functionality in client ui Change-Id: I56bcba1c09d949b80155b3ac9368203e85eb4f99 Issue-ID: CCSDK-815 Signed-off-by: swapnalipode <sp00501638@techmahindra.com>
Diffstat (limited to 'cds-ui')
-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
-rw-r--r--cds-ui/server/src/controllers/controller-catalog.controller.ts20
-rw-r--r--cds-ui/server/src/datasources/controller-catalog.datasource-template.ts30
-rw-r--r--cds-ui/server/src/services/controller-catalog.service.ts2
7 files changed, 45 insertions, 57 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);
+ }
}
diff --git a/cds-ui/server/src/controllers/controller-catalog.controller.ts b/cds-ui/server/src/controllers/controller-catalog.controller.ts
index 20e1cded6..b55785dcc 100644
--- a/cds-ui/server/src/controllers/controller-catalog.controller.ts
+++ b/cds-ui/server/src/controllers/controller-catalog.controller.ts
@@ -60,14 +60,14 @@ export class ControllerCatalogController {
return await this.Ccservice.getDefinitionTypes(definitionType);
}
- @del('/controllercatalog/model-type/{name}', {
- responses: {
- '200': {
- content: { 'application/json': {} }
- }
- },
- })
- async delete(@param.path.string('name') name: string): Promise<JSON> {
- return await this.Ccservice.deleteCatalog(name);
- }
+ @del('/controllercatalog/{name}', {
+ responses: {
+ '200': {
+ content: { 'application/json': {} }
+ }
+ },
+ })
+ async delete(@param.path.string('name') name: string) {
+ return await this.Ccservice.delete(name);
+ }
}
diff --git a/cds-ui/server/src/datasources/controller-catalog.datasource-template.ts b/cds-ui/server/src/datasources/controller-catalog.datasource-template.ts
index e45741576..dcd732a1b 100644
--- a/cds-ui/server/src/datasources/controller-catalog.datasource-template.ts
+++ b/cds-ui/server/src/datasources/controller-catalog.datasource-template.ts
@@ -57,20 +57,20 @@ export default {
}
},
- {
- "template": {
- "method": "DEL",
- "url": processorApiConfig.http.url + "/model-type/{name}",
- "headers": {
- "accepts": "application/json",
- "content-type": "application/json",
- "authorization": processorApiConfig.http.authToken
- },
- "responsePath": "$.*"
- },
- "functions": {
- "delete": ["name"]
- }
- }
+ {
+ "template": {
+ "method": "DELETE",
+ "url": processorApiConfig.http.url + "/model-type/{name}",
+ "headers": {
+ "accepts": "application/json",
+ "content-type": "application/json",
+ "authorization": processorApiConfig.http.authToken
+ },
+ "responsePath": "$.*"
+ },
+ "functions": {
+ "delete": ["name"]
+ }
+ }
]
}; \ No newline at end of file
diff --git a/cds-ui/server/src/services/controller-catalog.service.ts b/cds-ui/server/src/services/controller-catalog.service.ts
index 9b4880543..db8d8560c 100644
--- a/cds-ui/server/src/services/controller-catalog.service.ts
+++ b/cds-ui/server/src/services/controller-catalog.service.ts
@@ -6,7 +6,7 @@ export interface ControllerCatalogService {
getByTags(tags: string): Promise<JSON>;
save(controllerCatalog: JSON): Promise<JSON>;
getDefinitionTypes(definitionType: string): Promise<JSON>;
- deleteCatalog(name: string): Promise<JSON>;
+ delete(name: string): Promise<JSON>;
}
export class ControllerCatalogServiceProvider implements Provider<ControllerCatalogService> {