pai icon indicating copy to clipboard operation
pai copied to clipboard

UI bug: dashboard has several Main menu.

Open qinchen123 opened this issue 8 years ago • 7 comments

Please check the screenshot. uibug

repro steps: click -> Dashboards->home ->dashboards->home>dashboards->home

qinchen123 avatar Jul 18 '18 08:07 qinchen123

@YitongFeng Please config root_url with suffix /grafana by setting environment variable GF_SERVER_ROOT_URL of docker container.

Reference:

Gerhut avatar Jul 19 '18 08:07 Gerhut

@Gerhut 's method works, and I deployed grafana at int bed http://10.151.40.234/dashboard.html , it fix qingcha's issue, but occurs another issue: if we don't use pylon to access dashboard http://10.151.40.234:9286/dashboard.html , it can't show grafana.

@hwuu suggested that we shouldn't let services rely on pylon, for we can remove pylon anytime if needed. So we should figure out a better way to solve this issue?

YitongFeng avatar Jul 19 '18 12:07 YitongFeng

@YitongFeng , yes, grafana shouldn't rely on pylon.

fanyangCS avatar Jul 19 '18 13:07 fanyangCS

Link of Dashboards -> Home is configured in

https://github.com/grafana/grafana/blob/v4.6.3/pkg/api/index.go#L88

which comes from setting.AppSubUrl, calculated from Grafana's root_url global configuration.

https://github.com/grafana/grafana/blob/v4.6.3/pkg/setting/setting.go#L190-L204

At present, when root_url is set in either config file or environment variable, it cannot be changed during the runtime, by our request URL in the browser.

So assume that we can only view Grafana from webportal, we can unified the uri of grafana in webportal and grafana, or, either environment configs works:

Without pylon

- webportal:
    - GRAFANA_URI: `http://hostname:3000/`
- grafana:
    - GF_SERVER_ROOT_URL: `http://hostname:3000/` # Current, default

With pylon

- webportal:
    - GRAFANA_URI: `http://hostname/grafana` # Configs in this issue
- grafana:
    - GF_SERVER_ROOT_URL: `http://hostname/grafana` # Which I recommends

If we need to support both http://host/grafana/ and http://host:3000/ works at the runtime, perhaps we should write a customize Grafana plugin to mock it?

Gerhut avatar Jul 20 '18 02:07 Gerhut

There is another workaround is that disable webportal dashboard display in grafana area of webportal dashboard. It will keep the Grafana's Dashboard -> Home link to the webportal dashboard when it is opened by user in http://host/grafana/

Gerhut avatar Jul 20 '18 03:07 Gerhut

Sorry for mislead the error cause, I found that the GRAFANA_URI of environment variable in web portal is configured correctly, as http://hostname:3000/. And it works fine by port 9286.

On port 80, the configuration of GRAFANA_URI is sub-filter-ed by pylon. which replaced http://hostname:3000/ with http://hostname/grafana. Although pylon also replaced the base href in grafana page with http://hostname/grafana/, Grafana resolved "Home" link as "/", which drops subdirectory of base href, resolved into http://hostname/

So it cannot be totally fixed in web portal, any good idea? @hwuu

Gerhut avatar Jul 24 '18 08:07 Gerhut

@Gerhut Yes. This should be handled by Pylon. I will fix.

hwuu avatar Jul 25 '18 06:07 hwuu