risdenk 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_r339066608
 
 

 ##########
 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 would guess there is a better way to build a url but I'm sure this works.

----------------------------------------------------------------
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

Reply via email to