Skip to content

Commit 77971bb

Browse files
committed
Add ScanStatsWidget template and related functionality
- Introduced a new template for ScanStatsWidget in `scan_stats.templ` to display scan statistics. - Generated Go code for the ScanStatsWidget in `scan_stats_templ.go`. - Updated the Engine to include a method for retrieving the composite store. - Enhanced the Extension to implement the DashboardAware interface and provide a DashboardContributor for rendering shield pages. - Updated dependencies in `go.mod` to include new versions for templ, forge, and grove drivers. - Cleaned up import statements in `engine.go`, `extension.go`, and `registry.go` for consistency.
1 parent d5388a0 commit 77971bb

101 files changed

Lines changed: 35605 additions & 18 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

audit_hook/extension.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ package audithook
88
import (
99
"context"
1010
"fmt"
11-
log "github.com/xraph/go-utils/log"
1211
"time"
1312

13+
log "github.com/xraph/go-utils/log"
14+
1415
"github.com/xraph/shield/id"
1516
"github.com/xraph/shield/plugin"
1617
)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package components
2+
3+
import (
4+
"github.com/xraph/forgeui/components/button"
5+
"github.com/xraph/forgeui/components/dialog"
6+
)
7+
8+
type ConfirmDialogProps struct {
9+
ID string
10+
Title string
11+
Description string
12+
ConfirmLabel string
13+
HxEndpoint string
14+
HxMethod string
15+
}
16+
17+
templ ConfirmDialog(props ConfirmDialogProps) {
18+
{{ confirmLabel := props.ConfirmLabel }}
19+
if confirmLabel == "" {
20+
{{ confirmLabel = "Confirm" }}
21+
}
22+
@dialog.Dialog(dialog.Props{ID: props.ID}) {
23+
@dialog.Content() {
24+
@dialog.Header() {
25+
@dialog.Title() {
26+
{ props.Title }
27+
}
28+
@dialog.Description() {
29+
{ props.Description }
30+
}
31+
}
32+
<div id={ props.ID + "-errors" } class="text-sm text-destructive"></div>
33+
@dialog.Footer() {
34+
@dialog.Close() {
35+
@button.Button(button.Props{Variant: button.VariantOutline}) {
36+
Cancel
37+
}
38+
}
39+
if props.HxMethod == "delete" {
40+
@button.Button(button.Props{
41+
Variant: button.VariantDestructive,
42+
Attributes: templ.Attributes{
43+
"hx-delete": props.HxEndpoint,
44+
"hx-target": "#" + props.ID + "-errors",
45+
"hx-swap": "innerHTML",
46+
"hx-on::after-request": "if(event.detail.successful) { document.getElementById('" + props.ID + "')?.close(); htmx.ajax('GET', window.location.pathname + window.location.search, {target:'#content'}); }",
47+
},
48+
}) {
49+
{ confirmLabel }
50+
}
51+
} else {
52+
@button.Button(button.Props{
53+
Variant: button.VariantDestructive,
54+
Attributes: templ.Attributes{
55+
"hx-post": props.HxEndpoint,
56+
"hx-target": "#" + props.ID + "-errors",
57+
"hx-swap": "innerHTML",
58+
"hx-on::after-request": "if(event.detail.successful) { document.getElementById('" + props.ID + "')?.close(); htmx.ajax('GET', window.location.pathname + window.location.search, {target:'#content'}); }",
59+
},
60+
}) {
61+
{ confirmLabel }
62+
}
63+
}
64+
}
65+
}
66+
}
67+
}

dashboard/components/confirm_dialog_templ.go

Lines changed: 318 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)