• J
    React UI: Support custom path prefixes (#6264) · 95554074
    Julius Volz 提交于
    * React UI: Support custom path prefixes
    
    The challenge was that the path prefix can be set dynamically as a flag
    on Prometheus, but the React app bundle is statically compiled in to
    expect a given path prefix. By adding a placeholder value to the React
    app's index.html and replacing it in Prometheus with the right path
    prefix during serving, this injects Prometheus's path prefix into the
    React app via a global const.
    
    Threading the path prefix into the different React components could have
    been done with React's Contexts (https://reactjs.org/docs/context.html),
    but I found the consumer side of context values to be a bit cumbersome
    (wrapping entire components in context consumers), so I ended up
    preferring direct threading of the path prefix values to components that
    needed them. Also, using contexts in tests is more verbose than just
    passing in path prefix values directly.
    
    Fixes https://github.com/prometheus/prometheus/issues/6163Signed-off-by: NJulius Volz <julius.volz@gmail.com>
    
    * Review feedback
    Signed-off-by: NJulius Volz <julius.volz@gmail.com>
    95554074
Panel.tsx 9.1 KB