You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by kr...@apache.org on 2019/07/26 19:09:47 UTC

[knox] branch master updated: KNOX-1955 - Admin UI should handle gateway.path change (#123)

This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new d398c63  KNOX-1955 - Admin UI should handle gateway.path change (#123)
d398c63 is described below

commit d398c633ec676f5861ab6a035030193c299d15d1
Author: Kevin Risden <ri...@users.noreply.github.com>
AuthorDate: Fri Jul 26 15:09:42 2019 -0400

    KNOX-1955 - Admin UI should handle gateway.path change (#123)
    
    Signed-off-by: Kevin Risden <kr...@apache.org>
---
 gateway-admin-ui/admin-ui/app/gateway-version.service.ts   | 6 +++---
 gateway-admin-ui/admin-ui/app/resource/resource.service.ts | 4 +---
 gateway-admin-ui/admin-ui/app/topology.service.ts          | 3 +--
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/gateway-admin-ui/admin-ui/app/gateway-version.service.ts b/gateway-admin-ui/admin-ui/app/gateway-version.service.ts
index edba4b1..895db02 100644
--- a/gateway-admin-ui/admin-ui/app/gateway-version.service.ts
+++ b/gateway-admin-ui/admin-ui/app/gateway-version.service.ts
@@ -23,8 +23,8 @@ import {GatewayVersion} from './gateway-version';
 
 @Injectable()
 export class GatewayVersionService {
-
-    private apiUrl = '/gateway/manager/api/v1/version';
+    private apiUrl = window.location.pathname.replace(new RegExp('admin-ui/.*'), 'api/v1/');
+    private versionUrl = this.apiUrl + 'version';
 
     constructor(private http: HttpClient) {
     }
@@ -32,7 +32,7 @@ export class GatewayVersionService {
     getVersion(): Promise<GatewayVersion> {
         let headers = new HttpHeaders();
         headers = this.addHeaders(headers);
-        return this.http.get(this.apiUrl, {headers: headers})
+        return this.http.get(this.versionUrl, {headers: headers})
             .toPromise()
             .then(response => {
                 return response['ServerVersion'] as GatewayVersion;
diff --git a/gateway-admin-ui/admin-ui/app/resource/resource.service.ts b/gateway-admin-ui/admin-ui/app/resource/resource.service.ts
index ba1c8e3..4e6b624 100644
--- a/gateway-admin-ui/admin-ui/app/resource/resource.service.ts
+++ b/gateway-admin-ui/admin-ui/app/resource/resource.service.ts
@@ -22,14 +22,12 @@ import {Resource} from './resource';
 import {ProviderConfig} from '../resource-detail/provider-config';
 import {Descriptor} from '../resource-detail/descriptor';
 
-
 @Injectable()
 export class ResourceService {
-
     // TODO: PJZ: Get this list dynamically?
     private static discoveryTypes: Array<string> = ['ClouderaManager', 'Ambari'];
 
-    apiUrl = '/gateway/manager/api/v1/';
+    apiUrl = window.location.pathname.replace(new RegExp('admin-ui/.*'), 'api/v1/');
     providersUrl = this.apiUrl + 'providerconfig';
     descriptorsUrl = this.apiUrl + 'descriptors';
     topologiesUrl = this.apiUrl + 'topologies';
diff --git a/gateway-admin-ui/admin-ui/app/topology.service.ts b/gateway-admin-ui/admin-ui/app/topology.service.ts
index 3583f87..a4831a6 100644
--- a/gateway-admin-ui/admin-ui/app/topology.service.ts
+++ b/gateway-admin-ui/admin-ui/app/topology.service.ts
@@ -23,8 +23,7 @@ import {Topology} from './topology';
 
 @Injectable()
 export class TopologyService {
-
-    apiUrl = '/gateway/manager/api/v1/';
+    apiUrl = window.location.pathname.replace(new RegExp('admin-ui/.*'), 'api/v1/');
     topologiesUrl = this.apiUrl + 'topologies';
     selectedTopologySource = new Subject<Topology>();
     selectedTopology$ = this.selectedTopologySource.asObservable();