Skip to content
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

[Improvement] use go-elem for HTML pages #2115

Open
1 of 2 tasks
kradalby opened this issue Sep 9, 2024 · 8 comments
Open
1 of 2 tasks

[Improvement] use go-elem for HTML pages #2115

kradalby opened this issue Sep 9, 2024 · 8 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers no-stale-bot
Milestone

Comments

@kradalby
Copy link
Collaborator

kradalby commented Sep 9, 2024

Use case

We currently have a couple of HTML files/template strings in the code using gotemplate and handcrafted HTML, its not a lot, and its fine, but a nice QoL improvement would be to make them nice, typed and generated.

Description

I have had quite a good experience with go-elem for this for some other projects, ergonomics are pretty good for writing HTML as functions, at least if we consider that it is Go and not something like Elm, Roc or Scala which might allow a bit nicer funcs.

Contribution

  • I can write the design doc for this feature
  • I can contribute this feature

How can it be implemented?

I will eventually do this, but if someone is up for converting the HTML to go-elem, that would be a great PR/starter issue, make things neat and reusable.

@kradalby kradalby added enhancement New feature or request good first issue Good for newcomers no-stale-bot labels Sep 9, 2024
@amha-mersha
Copy link
Contributor

Hello @kradalby , I really would like to take this and work on it.

@kradalby
Copy link
Collaborator Author

kradalby commented Sep 9, 2024

@amha-mersha sounds good, I think we will not merge anything until after 0.23.0 goes in, but I think a good approach would be to make a PR converting something small, like https://github.com/juanfont/headscale/blob/main/hscontrol/handlers.go#L141-L168 would be a good start!

@amha-mersha
Copy link
Contributor

Sure @kradalby , do you need to assign it to me or do I just do it and make a PR

@kradalby
Copy link
Collaborator Author

kradalby commented Sep 9, 2024

I assigned it so people know, but other than that you can make a PR.

@amha-mersha
Copy link
Contributor

Thank you @kradalby for assigning me my first open-source contribution, I have finished it and made a PR. Are there other things I can work on.

@kradalby
Copy link
Collaborator Author

You can also start on https://github.com/juanfont/headscale/blob/main/hscontrol/templates/windows.html, and where it is called in the code. the more you can make functions to reuse the better

@kradalby kradalby added this to the Next milestone Sep 11, 2024
@kradalby
Copy link
Collaborator Author

There is also styles and templates for OIDC here that needs to be rewritten:

headscale/hscontrol/oidc.go

Lines 161 to 166 in 10a72e8

//go:embed assets/oidc_callback_template.html
var oidcCallbackTemplateContent string
var oidcCallbackTemplate = template.Must(
template.New("oidccallback").Parse(oidcCallbackTemplateContent),
)

This contains other styling than the current one, we should unify this so it all looks the same and can have the style reused.

@jirutka
Copy link

jirutka commented Nov 4, 2024

I would greatly appreciate it if these were simple HTML templates that can be read from the filesystem so admins can easily customize them to their organization’s visual style, add additional information etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers no-stale-bot
Projects
None yet
Development

No branches or pull requests

4 participants
@kradalby @jirutka @amha-mersha and others