Add ROUTE_PREFIX parameter for working with reverse proxies. (#256)

* Add ROUTE_PREFIX parameter for working with reverse proxies.

* [flake8/E304] remove blank line after function decoder

* Add APPLICATION_ROOT and use route_prefix in requests.

* [black/code-styling] use double quotes instead of single.

* handle right events url depending route path

* properly handle redirects

* [flake8] remove unused module, fix styling issues

Co-authored-by: Henning Jacobs <henning@jacobs1.de>
This commit is contained in:
Khachatur Ashotyan
2020-08-23 17:27:34 +04:00
committed by GitHub
parent 3c6056dac3
commit 89c143d3aa
5 changed files with 25 additions and 10 deletions

View File

@@ -20,6 +20,7 @@ export default class App {
this.config = Config.fromParams(params)
this.config.nodeLinkUrlTemplate = config['node_link_url_template']
this.config.podLinkUrlTemplate = config['pod_link_url_template']
this.config.route_prefix = config['route_prefix']
this.filterString = (params.get('q') && decodeURIComponent(params.get('q'))) || ''
this.selectedClusters = new Set((params.get('clusters') || '').split(',').filter(x => x))
@@ -658,7 +659,7 @@ export default class App {
this.disconnect()
const that = this
// NOTE: path must be relative to work with kubectl proxy out of the box
let url = 'events'
let url = this.config.route_prefix + (this.config.route_prefix === '/' ? 'events' : '/events')
const clusterIds = Array.from(this.selectedClusters).join(',')
if (clusterIds) {
url += '?cluster_ids=' + clusterIds