Skip to content

Conversation

@sysadmind
Copy link
Contributor

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.

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>
Signed-off-by: Joe Adams <github@joeadams.io>
Signed-off-by: Joe Adams <github@joeadams.io>
@siavashs
Copy link
Contributor

CI is failing even after a re-run.
It is not clear why the build is failing for elm, it does not seem that there are any changes to that:

cd /__w/alertmanager/alertmanager/ui/app && make script.js
make[1]: Entering directory '/__w/alertmanager/alertmanager/ui/app'
>> building elm-env docker image
/bin/sh: 3: docker: not found
make[1]: *** [Makefile:17: elm-env] Error 127
make[1]: Leaving directory '/__w/alertmanager/alertmanager/ui/app'
make: *** [Makefile:67: ui/app/script.js] Error 2

@sysadmind
Copy link
Contributor Author

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>
Signed-off-by: Joe Adams <github@joeadams.io>
@@ -1,4 +1,4 @@
// Copyright 2023 Prometheus Team
// Copyright Prometheus Team
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Copyright Prometheus Team
// Copyright The Prometheus Authors

@@ -0,0 +1,46 @@
#!/usr/bin/env bash
Copy link
Contributor

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?

Comment on lines +41 to +45
if enableUIV2 {
RegisterUIV2(r, logger)
} else {
RegisterUIV1(r, logger)
}
Copy link
Contributor

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?

Comment on lines +143 to +147
// 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()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftovers?

Comment on lines +40 to +42
case "web":
// When running web tests.
assetsPrefix = "./ui"
Copy link
Contributor

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
Copy link
Contributor

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing cache-control headers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants