Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ func New(ctx context.Context, logger logr.Logger, cfg Config) (*Daemon, error) {
Runners: runnerService,
GithubApp: githubAppService,
EngineService: engineService,
Configs: configService,
HostnameService: hostnameService,
Tokens: tokensService,
Authorizer: authorizer,
Expand Down
3 changes: 2 additions & 1 deletion internal/http/html/components/layout.templ
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@ templ BareLayout(props BareLayoutProps) {
<script src={ AssetPath(ctx, "/static/js/htmx.2.0.4.min.js") }></script>
<script src={ AssetPath(ctx, "/static/js/htmx-sse.2.2.2.js") }></script>
<script src={ AssetPath(ctx, "/static/js/htmx-ext-ws.2.0.2.js") }></script>
<script src="https://unpkg.com/[email protected]/dist/idiomorph-ext.min.js" integrity="sha384-szktAZju9fwY15dZ6D2FKFN4eZoltuXiHStNDJWK9+FARrxJtquql828JzikODob" crossorigin="anonymous"></script>
<script defer src={ AssetPath(ctx, "/static/js/alpine.3.14.8.min.js") }></script>
<link rel="stylesheet" href={ AssetPath(ctx, "/static/css/output.css") }/>
</head>
<body class="min-h-screen grid grid-rows-[auto_1fr_auto] grid-cols-[200px_3fr]">
<body hx-ext="morph" class="min-h-screen grid grid-rows-[auto_1fr_auto] grid-cols-[200px_3fr]">
<header class="col-span-2 border-b-1 border-base-content/30">
@navbar(props.Organization)
</header>
Expand Down
22 changes: 11 additions & 11 deletions internal/http/html/components/layout_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions internal/http/html/components/paths/run_paths.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 31 additions & 24 deletions internal/http/html/components/table.templ
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,36 @@ type TablePopulator[T any] interface {
Row(T) templ.Component
}

templ UnpaginatedTable[T any](populator TablePopulator[T], resources []T, id string) {
<div id={ id }>
<div class="border-t border-b border-base-content/20">
<table class="table overflow-x-auto">
<thead>
templ UnpaginatedTable[T any](populator TablePopulator[T], resources []T) {
<div class="border-t border-b border-base-content/20">
<table class="table overflow-x-auto">
<thead>
<tr>
@populator.Header()
</tr>
</thead>
<tbody>
for _, item := range resources {
@populator.Row(item)
}
if len(resources) == 0 {
<tr>
@populator.Header()
<td id="no-items-found" colspan="100%">
No items found
</td>
</tr>
</thead>
<tbody>
for _, item := range resources {
@populator.Row(item)
}
if len(resources) == 0 {
<tr>
<td id="no-items-found" colspan="100%">
No items found
</td>
</tr>
}
</tbody>
</table>
</div>
{ children... }
}
</tbody>
</table>
</div>
{ children... }
}

templ Table[T any](populator TablePopulator[T], page *resource.Page[T], id string) {
templ Table[T any](populator TablePopulator[T], page *resource.Page[T]) {
{{
info := pageInfo[T]{Page: page}
}}
@UnpaginatedTable(populator, page.Items, id) {
@UnpaginatedTable(populator, page.Items) {
<div class="flex p-4 gap-2 justify-between items-center">
@info.pageSizeSelector()
@info.summary()
Expand All @@ -54,6 +52,15 @@ templ Table[T any](populator TablePopulator[T], page *resource.Page[T], id strin
}
}

// PollingTable renders a table that polls for updates every X seconds.
templ PollingTable[T any](populator TablePopulator[T], page *resource.Page[T]) {
<div id="polling-table" hx-get={ CurrentPath(ctx) } hx-trigger="every 10s" hx-swap="morph:innerHTML" hx-sync="this:abort">
@templ.Fragment("polling-table") {
@Table(populator, page)
}
</div>
}

type pageInfo[T any] struct {
*resource.Page[T]
}
Expand Down
Loading
Loading