-
TfStated is currently managing {{ len .States }} states.
+
TfStated is currently managing {{ len .States }} states.
Use this page to inspect the existing states.
You also have the option to upload a JSON state file in order to create a new state in TfStated. This is equivalent to using the state push
command of OpenTofu/Terraform on a brand new state.
diff --git a/pkg/webui/html/statesId.html b/pkg/webui/html/statesId.html
index 8dd159e..9139c91 100644
--- a/pkg/webui/html/statesId.html
+++ b/pkg/webui/html/statesId.html
@@ -2,23 +2,22 @@
State
The state at path
- {{ .State.Path }}
+ {{ .State.Path }}
has
- {{ len .Versions }}
+ {{ len .Versions }}
versions and is currently
-
+
{{ if eq .State.Lock nil }}
- unlocked
+ unlocked.
{{ else }}
- locked
+ locked.
{{ .State.Lock }}
{{ end }}
-
- .
+
Use this page to inspect the existing versions.
diff --git a/pkg/webui/index.go b/pkg/webui/index.go
index d88a7fa..580d5a8 100644
--- a/pkg/webui/index.go
+++ b/pkg/webui/index.go
@@ -5,9 +5,11 @@ import (
"net/http"
"git.adyxax.org/adyxax/tfstated/pkg/model"
+ "go.n16f.net/uuid"
)
type Page struct {
+ AccountId uuid.UUID
IsAdmin bool
LightMode bool
Section string
@@ -16,6 +18,7 @@ type Page struct {
func makePage(r *http.Request, page *Page) *Page {
account := r.Context().Value(model.AccountContextKey{}).(*model.Account)
+ page.AccountId = account.Id
page.IsAdmin = account.IsAdmin
settings := r.Context().Value(model.SettingsContextKey{}).(*model.Settings)
page.LightMode = settings.LightMode
diff --git a/pkg/webui/routes.go b/pkg/webui/routes.go
index 772489b..ee52fa6 100644
--- a/pkg/webui/routes.go
+++ b/pkg/webui/routes.go
@@ -13,8 +13,8 @@ func addRoutes(
requireSession := sessionsMiddleware(db)
requireLogin := loginMiddleware(db, requireSession)
requireAdmin := adminMiddleware(db, requireLogin)
- mux.Handle("GET /accounts", requireAdmin(handleAccountsGET(db)))
- mux.Handle("GET /accounts/{id}", requireAdmin(handleAccountsIdGET(db)))
+ mux.Handle("GET /accounts", requireLogin(handleAccountsGET(db)))
+ mux.Handle("GET /accounts/{id}", requireLogin(handleAccountsIdGET(db)))
mux.Handle("POST /accounts", requireAdmin(handleAccountsPOST(db)))
mux.Handle("GET /healthz", handleHealthz())
mux.Handle("GET /login", requireSession(handleLoginGET()))
diff --git a/pkg/webui/static/main.css b/pkg/webui/static/main.css
index 6956316..4658d65 100644
--- a/pkg/webui/static/main.css
+++ b/pkg/webui/static/main.css
@@ -82,8 +82,13 @@ textarea {
text-overflow: ellipsis;
}
input:not([type=image i], [type=range i], [type=checkbox i], [type=radio i]) {
- overflow: clip !important;
- overflow-clip-margin: 0 !important;
+ overflow: clip !important;
+ overflow-clip-margin: 0 !important;
+}
+button:disabled, button:disabled:hover {
+ background-color: var(--bg-2);
+ border: 1px solid var(--fg-1);
+ color:var(--dim) !important;
}
html {
@@ -248,12 +253,11 @@ fieldset {
padding: 8px;
}
button, .button {
- background-color: var(--bg-2);
- border: 1px solid var(--orange);
- color: var(--orange);
align-items: center;
+ background-color: var(--bg-2);
border: 1px solid var(--fg-1);
border-radius: 8px;
+ color: var(--orange);
display: inline-flex;
font-size: 16px;
gap: 8px;
@@ -329,6 +333,10 @@ footer p {
footer a {
color: var(--green);
}
+strong {
+ color: var(--orange);
+ font-weight: bolder;
+}
@media only screen and (640px <= width < 968px) { /*856*/
header {