From c59041ea451d18360f38cc750e89ed2052a9555d Mon Sep 17 00:00:00 2001 From: Brandon Farmer Date: Fri, 9 Nov 2018 16:03:17 -0800 Subject: [PATCH 1/3] Handle basepath issue with missing slash --- server/mux.go | 3 ++- ui/src/utils/basepath.ts | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/server/mux.go b/server/mux.go index ceb70cac3..45b3e1280 100644 --- a/server/mux.go +++ b/server/mux.go @@ -47,8 +47,9 @@ func NewMux(opts MuxOpts, service Service) http.Handler { }) if opts.Basepath != "" { + basePath := fmt.Sprintf("%s/", opts.Basepath) // Prefix any URLs found in the React assets with any configured basepath - assets = NewDefaultURLPrefixer(opts.Basepath, assets, opts.Logger) + assets = NewDefaultURLPrefixer(basePath, assets, opts.Logger) } // Compress the assets with gzip if an accepted encoding diff --git a/ui/src/utils/basepath.ts b/ui/src/utils/basepath.ts index 211b8028c..4b3ddd6fe 100644 --- a/ui/src/utils/basepath.ts +++ b/ui/src/utils/basepath.ts @@ -6,7 +6,12 @@ export const getBasepath = () => { return '' } - return rootNode.getAttribute('data-basepath') || '' + let basepath = rootNode.getAttribute('data-basepath') || '' + if (basepath !== '') { + basepath = basepath.slice(0, basepath.length - 1) + } + + return basepath } export const stripPrefix = (pathname, basepath = getBasepath()) => { From 9ebfa9733c3d083ec81ceac6eb9fae25df1f2a37 Mon Sep 17 00:00:00 2001 From: Brandon Farmer Date: Fri, 9 Nov 2018 16:12:42 -0800 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1c229216..e9c1964da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Bug Fixes 1. [#4786](https://github.com/influxdata/chronograf/pull/4786): Get protoboards from multistore if not able to find from ProtoboardsPath +1. [#4794](https://github.com/influxdata/chronograf/pull/4794): Handle basepath issue with missing slash ## v1.7.2 [2018-11-08] From 55ba63a98f2e07f0002b2a09d810793ca34428c2 Mon Sep 17 00:00:00 2001 From: Brandon Farmer Date: Fri, 9 Nov 2018 16:19:34 -0800 Subject: [PATCH 3/3] Fix linting issues in functions contants --- ui/src/flux/constants/functions.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/src/flux/constants/functions.ts b/ui/src/flux/constants/functions.ts index 4cab02d0b..da5408fa9 100644 --- a/ui/src/flux/constants/functions.ts +++ b/ui/src/flux/constants/functions.ts @@ -871,7 +871,8 @@ export const functions: FluxToolbarFunction[] = [ ], desc: 'Collects values stored vertically (column-wise) in a table and aligns them horizontally (row-wise) into logical sets.', - example: 'pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")', + example: + 'pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")', category: 'Transformations', link: 'https://docs.influxdata.com/flux/latest/functions/transformations/pivot',