TSK-306 fix Id name and remove last & from GET query.

This commit is contained in:
Martin Rojas Miguel Angel 2018-02-19 10:51:19 +01:00 committed by Holger Hagen
parent 091ed6b95f
commit 4c9dd20f39
5 changed files with 10 additions and 9 deletions

View File

@ -4381,8 +4381,7 @@
"jsbn": { "jsbn": {
"version": "0.1.1", "version": "0.1.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"json-schema": { "json-schema": {
"version": "0.2.3", "version": "0.2.3",

View File

@ -26,22 +26,22 @@ describe('WorkbasketService ', () => {
it('should have a valid query parameter expression sortBy=key, order=asc as default', () => { it('should have a valid query parameter expression sortBy=key, order=asc as default', () => {
workbasketService.getWorkBasketsSummary(); workbasketService.getWorkBasketsSummary();
expect(httpClient.get).toHaveBeenCalledWith('http://localhost:8080/v1/workbaskets/?sortBy=key&order=asc&', jasmine.any(Object)); expect(httpClient.get).toHaveBeenCalledWith('http://localhost:8080/v1/workbaskets/?sortBy=key&order=asc', jasmine.any(Object));
}); });
it('should have a valid query parameter expression with sortBy=name and order=desc', () => { it('should have a valid query parameter expression with sortBy=name and order=desc', () => {
workbasketService.getWorkBasketsSummary('name', Direction.DESC); workbasketService.getWorkBasketsSummary('name', Direction.DESC);
expect(httpClient.get).toHaveBeenCalledWith('http://localhost:8080/v1/workbaskets/?sortBy=name&order=desc&', jasmine.any(Object)); expect(httpClient.get).toHaveBeenCalledWith('http://localhost:8080/v1/workbaskets/?sortBy=name&order=desc', jasmine.any(Object));
}); });
it('should have a valid query parameter expression with sortBy=name and order=desc and descLike=some description ',() => { it('should have a valid query parameter expression with sortBy=name and order=desc and descLike=some description ',() => {
workbasketService.getWorkBasketsSummary('name', Direction.DESC, undefined, undefined, 'some description'); workbasketService.getWorkBasketsSummary('name', Direction.DESC, undefined, undefined, 'some description');
expect(httpClient.get).toHaveBeenCalledWith('http://localhost:8080/v1/workbaskets/?sortBy=name&order=desc&descLike=some description&', jasmine.any(Object)); expect(httpClient.get).toHaveBeenCalledWith('http://localhost:8080/v1/workbaskets/?sortBy=name&order=desc&descLike=some description', jasmine.any(Object));
}); });
it('should have a valid query parameter expression with sortBy=key, order=asc, descLike=some description and type=group ',() => { it('should have a valid query parameter expression with sortBy=key, order=asc, descLike=some description and type=group ',() => {
workbasketService.getWorkBasketsSummary('name', Direction.DESC, undefined, undefined, 'some description', undefined, undefined, 'group'); workbasketService.getWorkBasketsSummary('name', Direction.DESC, undefined, undefined, 'some description', undefined, undefined, 'group');
expect(httpClient.get).toHaveBeenCalledWith('http://localhost:8080/v1/workbaskets/?sortBy=name&order=desc&descLike=some description&type=group&', jasmine.any(Object)); expect(httpClient.get).toHaveBeenCalledWith('http://localhost:8080/v1/workbaskets/?sortBy=name&order=desc&descLike=some description&type=group', jasmine.any(Object));
}); });

View File

@ -121,7 +121,9 @@ export class WorkbasketService {
query += type? `${this.TYPE}=${type}&`:''; query += type? `${this.TYPE}=${type}&`:'';
query += requiredPermission? `${this.REQUIREDPERMISSION}=${requiredPermission}&`:''; query += requiredPermission? `${this.REQUIREDPERMISSION}=${requiredPermission}&`:'';
if(query.lastIndexOf('&') === query.length-1){
query = query.slice(0, query.lastIndexOf('&'))
}
return query; return query;
} }
} }

View File

@ -19,7 +19,7 @@ export class WorkbasketListComponent implements OnInit {
sortBy: string = 'key'; sortBy: string = 'key';
sortDirection: Direction = Direction.ASC; sortDirection: Direction = Direction.ASC;
sortingFields : Map<string, string> = new Map([['name', 'Name'], ['key', 'Id'], ['description', 'Description'], ['owner', 'Owner'], ['type', 'Type']]); sortingFields : Map<string, string> = new Map([['name', 'Name'], ['key', 'Key'], ['description', 'Description'], ['owner', 'Owner'], ['type', 'Type']]);
private workBasketSummarySubscription: Subscription; private workBasketSummarySubscription: Subscription;
private workbasketServiceSubscription: Subscription; private workbasketServiceSubscription: Subscription;