mirror of
https://github.com/sablierapp/sablier.git
synced 2025-12-21 21:33:06 +01:00
* refactor: move app/theme to pkg/theme * refactor * wip * use dockerindocker * add providertest * wip * wip * test(docker): get state now uses dind container to test against a real provider * test(docker): move to docker_test package * refactor(docker): create container_inspect.go * test(docker): add more dind test * test(docker): event test now use docker in docker * refactor: remove unused instance type props * refactor test docker * fix instance list sort * stabilize test * remove testcontainers custom config
38 lines
812 B
Go
38 lines
812 B
Go
package theme
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
|
|
"github.com/sablierapp/sablier/pkg/durations"
|
|
"github.com/sablierapp/sablier/version"
|
|
)
|
|
|
|
func (t *Themes) Render(name string, opts Options, writer io.Writer) error {
|
|
var instances []Instance
|
|
|
|
if opts.ShowDetails {
|
|
instances = opts.InstanceStates
|
|
} else {
|
|
instances = []Instance{}
|
|
}
|
|
|
|
options := templateOptions{
|
|
DisplayName: opts.DisplayName,
|
|
InstanceStates: instances,
|
|
SessionDuration: durations.Humanize(opts.SessionDuration),
|
|
RefreshFrequency: fmt.Sprintf("%d", int64(opts.RefreshFrequency.Seconds())),
|
|
Version: version.Version,
|
|
}
|
|
|
|
tpl := t.themes.Lookup(fmt.Sprintf("%s.html", name))
|
|
if tpl == nil {
|
|
return ErrThemeNotFound{
|
|
Theme: name,
|
|
AvailableThemes: t.List(),
|
|
}
|
|
}
|
|
|
|
return tpl.Execute(writer, options)
|
|
}
|