smolnar82 commented on a change in pull request #169: KNOX-2056 - Adding
Service Definitions management into Admin UI
URL: https://github.com/apache/knox/pull/169#discussion_r339467500
##########
File path: gateway-admin-ui/admin-ui/app/resource/resource.service.ts
##########
@@ -129,11 +132,32 @@ export class ResourceService {
});
}
+ getServiceDefinitionResources(): Promise<Resource[]> {
+ let headers = this.addJsonHeaders(new HttpHeaders());
+ return this.http.get(this.serviceDefinitionsUrl + '?serviceOnly=true',
{headers: headers})
+ .toPromise()
+ .then(response => response['serviceDefinitions'].serviceDefinition
as Resource[])
+ .catch((err: HttpErrorResponse) => {
+ console.debug('ResourceService -->
getServiceDefinitionResources() --> error: HTTP ' + err.status + ' ' +
err.message);
+ if (err.status === 401) {
+ window.location.assign(document.location.pathname);
+ } else {
+ return this.handleError(err);
+ }
+ });
+ }
+
getResource(resType: string, res: Resource): Promise<string> {
if (res) {
+ let href = res.href;
+ if (resType === 'Service Definitions') {
+ href = this.serviceDefinitionsUrl + '/' + res.service['name']
+ '/' + res.service['role'] + '/' + res.service['version']
Review comment:
I installed a new module called `rest-url-builder` and started to use it in
the new JS files when connecting to back-end.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services