-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add feature to build and enable UI V2 #4974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Adds the Makefile and UI embedding components to serve the new UI based on Mantine. This can be enabled when built with the tag `builtinassets`. This is a close match to what Prometheus does to build and embed the UI. The UI is still very early, so the utility is very limited, but this will allow testing the features more easily as they become available. Signed-off-by: Joe Adams <github@joeadams.io>
Signed-off-by: Joe Adams <github@joeadams.io>
Signed-off-by: Joe Adams <github@joeadams.io>
|
CI is failing even after a re-run. |
|
The problem is that this is now happening in the build process where it was not before and it's already inside docker so it doesn't have access to run docker. I think the logical option is to remove the elm build from the regular build process. The other option would be to enable the docker in docker build. |
Signed-off-by: Joe Adams <github@joeadams.io>
Signed-off-by: Joe Adams <github@joeadams.io>
| @@ -1,4 +1,4 @@ | |||
| // Copyright 2023 Prometheus Team | |||
| // Copyright Prometheus Team | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Copyright Prometheus Team | |
| // Copyright The Prometheus Authors |
| @@ -0,0 +1,46 @@ | |||
| #!/usr/bin/env bash | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We removed this file in #4617 do we need to add it back now again?
| if enableUIV2 { | ||
| RegisterUIV2(r, logger) | ||
| } else { | ||
| RegisterUIV1(r, logger) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use Elm and React for naming these to be more clear?
| // replacedIdx := bytes.ReplaceAll(idx, []byte("CONSOLES_LINK_PLACEHOLDER"), []byte(h.consolesPath())) | ||
| // replacedIdx = bytes.ReplaceAll(replacedIdx, []byte("TITLE_PLACEHOLDER"), []byte(h.options.PageTitle)) | ||
| // replacedIdx = bytes.ReplaceAll(replacedIdx, []byte("AGENT_MODE_PLACEHOLDER"), []byte(strconv.FormatBool(h.options.IsAgent))) | ||
| // replacedIdx = bytes.ReplaceAll(replacedIdx, []byte("READY_PLACEHOLDER"), []byte(strconv.FormatBool(h.isReady()))) | ||
| // replacedIdx = bytes.ReplaceAll(replacedIdx, []byte("LOOKBACKDELTA_PLACEHOLDER"), []byte(model.Duration(h.options.LookbackDelta).String())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftovers?
| case "web": | ||
| // When running web tests. | ||
| assetsPrefix = "./ui" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used or dead code?
|
|
||
| .PHONY: build | ||
| build: common-build | ||
| build: assets-compress common-build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the project ships pre-compiled assets bundle so UI does not have to be built each time.
|
|
||
| reactAssetsRoot := "/static/mantine-ui" | ||
|
|
||
| serveReactApp := func(w http.ResponseWriter, _ *http.Request) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing cache-control headers?
Adds the Makefile and UI embedding components to serve the new UI based on Mantine. This can be enabled when built with the tag
builtinassets. This is a close match to what Prometheus does to build and embed the UI.The UI is still very early, so the utility is very limited, but this will allow testing the features more easily as they become available.