back interdiff of round #1 and #0

appview/state: Move /knots & /spindles under /settings #660

merged
opened by 5jiji.com targeting master from 5jiji.com/tangled-core: master

Closes https://tangled.org/@tangled.org/core/issues/248

I hope this go code is fine, because i have no damn clue how go works, so i just tried something and it worked If there is a better solution, i would like to know it!

NB: (I've checked if it compiled and worked, by removing commit '3ebdcd: knotserver: improve the logging situation', as for some reason, that commit is uncompilable (even your spindle is complaining))

ERROR
appview/state/router.go

Failed to calculate interdiff for this file.

ERROR
appview/pages/templates/knots/dashboard.html

Failed to calculate interdiff for this file.

ERROR
appview/pages/templates/knots/fragments/addMemberModal.html

Failed to calculate interdiff for this file.

ERROR
appview/pages/templates/knots/fragments/knotListing.html

Failed to calculate interdiff for this file.

ERROR
appview/pages/templates/knots/index.html

Failed to calculate interdiff for this file.

ERROR
appview/pages/templates/repo/fork.html

Failed to calculate interdiff for this file.

ERROR
appview/pages/templates/repo/new.html

Failed to calculate interdiff for this file.

REBASED
docs/knot-hosting.md

This patch was likely rebased, as context lines do not match.

ERROR
appview/pages/templates/spindles/dashboard.html

Failed to calculate interdiff for this file.

ERROR
appview/pages/templates/spindles/fragments/addMemberModal.html

Failed to calculate interdiff for this file.

ERROR
appview/pages/templates/spindles/fragments/spindleListing.html

Failed to calculate interdiff for this file.

ERROR
appview/pages/templates/spindles/index.html

Failed to calculate interdiff for this file.

NEW
appview/knots/knots.go
···
Knotstream *eventconsumer.Consumer
}
func (k *Knots) Router() http.Handler {
r := chi.NewRouter()
···
k.Pages.Knots(w, pages.KnotsParams{
LoggedInUser: user,
Registrations: registrations,
})
}
···
Members: members,
Repos: repoMap,
IsOwner: true,
})
}
···
Knotstream *eventconsumer.Consumer
}
+
type tab = map[string]any
+
+
var (
+
knotsTabs []tab = []tab{
+
{"Name": "profile", "Icon": "user"},
+
{"Name": "keys", "Icon": "key"},
+
{"Name": "emails", "Icon": "mail"},
+
{"Name": "notifications", "Icon": "bell"},
+
{"Name": "knots", "Icon": "volleyball"},
+
{"Name": "spindles", "Icon": "spool"},
+
}
+
)
+
func (k *Knots) Router() http.Handler {
r := chi.NewRouter()
···
k.Pages.Knots(w, pages.KnotsParams{
LoggedInUser: user,
Registrations: registrations,
+
Tabs: knotsTabs,
+
Tab: "knots",
})
}
···
Members: members,
Repos: repoMap,
IsOwner: true,
+
Tabs: knotsTabs,
+
Tab: "knots",
})
}
NEW
appview/pages/pages.go
···
type KnotsParams struct {
LoggedInUser *oauth.User
Registrations []models.Registration
}
func (p *Pages) Knots(w io.Writer, params KnotsParams) error {
···
Members []string
Repos map[string][]models.Repo
IsOwner bool
}
func (p *Pages) Knot(w io.Writer, params KnotParams) error {
···
type SpindlesParams struct {
LoggedInUser *oauth.User
Spindles []models.Spindle
}
func (p *Pages) Spindles(w io.Writer, params SpindlesParams) error {
···
type SpindleListingParams struct {
models.Spindle
}
func (p *Pages) SpindleListing(w io.Writer, params SpindleListingParams) error {
···
Spindle models.Spindle
Members []string
Repos map[string][]models.Repo
}
func (p *Pages) SpindleDashboard(w io.Writer, params SpindleDashboardParams) error {
···
type KnotsParams struct {
LoggedInUser *oauth.User
Registrations []models.Registration
+
Tabs []map[string]any
+
Tab string
}
func (p *Pages) Knots(w io.Writer, params KnotsParams) error {
···
Members []string
Repos map[string][]models.Repo
IsOwner bool
+
Tabs []map[string]any
+
Tab string
}
func (p *Pages) Knot(w io.Writer, params KnotParams) error {
···
type SpindlesParams struct {
LoggedInUser *oauth.User
Spindles []models.Spindle
+
Tabs []map[string]any
+
Tab string
}
func (p *Pages) Spindles(w io.Writer, params SpindlesParams) error {
···
type SpindleListingParams struct {
models.Spindle
+
Tabs []map[string]any
+
Tab string
}
func (p *Pages) SpindleListing(w io.Writer, params SpindleListingParams) error {
···
Spindle models.Spindle
Members []string
Repos map[string][]models.Repo
+
Tabs []map[string]any
+
Tab string
}
func (p *Pages) SpindleDashboard(w io.Writer, params SpindleDashboardParams) error {
NEW
appview/pages/templates/layouts/fragments/topbar.html
···
<a href="/{{ $user }}">profile</a>
<a href="/{{ $user }}?tab=repos">repositories</a>
<a href="/{{ $user }}?tab=strings">strings</a>
-
<a href="/knots">knots</a>
-
<a href="/spindles">spindles</a>
<a href="/settings">settings</a>
<a href="#"
hx-post="/logout"
···
<a href="/{{ $user }}">profile</a>
<a href="/{{ $user }}?tab=repos">repositories</a>
<a href="/{{ $user }}?tab=strings">strings</a>
<a href="/settings">settings</a>
<a href="#"
hx-post="/logout"
NEW
appview/settings/settings.go
···
{"Name": "keys", "Icon": "key"},
{"Name": "emails", "Icon": "mail"},
{"Name": "notifications", "Icon": "bell"},
}
)
···
{"Name": "keys", "Icon": "key"},
{"Name": "emails", "Icon": "mail"},
{"Name": "notifications", "Icon": "bell"},
+
{"Name": "knots", "Icon": "volleyball"},
+
{"Name": "spindles", "Icon": "spool"},
}
)
NEW
appview/spindles/spindles.go
···
Logger *slog.Logger
}
func (s *Spindles) Router() http.Handler {
r := chi.NewRouter()
···
s.Pages.Spindles(w, pages.SpindlesParams{
LoggedInUser: user,
Spindles: all,
})
}
···
Spindle: spindle,
Members: members,
Repos: repoMap,
})
}
···
Logger *slog.Logger
}
+
type tab = map[string]any
+
+
var (
+
spindlesTabs []tab = []tab{
+
{"Name": "profile", "Icon": "user"},
+
{"Name": "keys", "Icon": "key"},
+
{"Name": "emails", "Icon": "mail"},
+
{"Name": "notifications", "Icon": "bell"},
+
{"Name": "knots", "Icon": "volleyball"},
+
{"Name": "spindles", "Icon": "spool"},
+
}
+
)
+
func (s *Spindles) Router() http.Handler {
r := chi.NewRouter()
···
s.Pages.Spindles(w, pages.SpindlesParams{
LoggedInUser: user,
Spindles: all,
+
Tabs: spindlesTabs,
+
Tab: "spindles",
})
}
···
Spindle: spindle,
Members: members,
Repos: repoMap,
+
Tabs: spindlesTabs,
+
Tab: "spindles",
})
}
NEW
docs/hacking.md
···
with `ssh` exposed on port 2222.
Once the services are running, head to
-
http://localhost:3000/knots and hit verify. It should
verify the ownership of the services instantly if everything
went smoothly.
···
### running a spindle
The above VM should already be running a spindle on
-
`localhost:6555`. Head to http://localhost:3000/spindles and
hit verify. You can then configure each repository to use
this spindle and run CI jobs.
···
with `ssh` exposed on port 2222.
Once the services are running, head to
+
http://localhost:3000/settings/knots and hit verify. It should
verify the ownership of the services instantly if everything
went smoothly.
···
### running a spindle
The above VM should already be running a spindle on
+
`localhost:6555`. Head to http://localhost:3000/settings/spindles and
hit verify. You can then configure each repository to use
this spindle and run CI jobs.
NEW
docs/migrations.md
···
For knots:
- Upgrade to latest tag (v1.9.0 or above)
-
- Head to the [knot dashboard](https://tangled.org/knots) and
hit the "retry" button to verify your knot
For spindles:
- Upgrade to latest tag (v1.9.0 or above)
- Head to the [spindle
-
dashboard](https://tangled.org/spindles) and hit the
"retry" button to verify your spindle
## Upgrading from v1.7.x
···
[settings](https://tangled.org/settings) page.
- Restart your knot once you have replaced the environment
variable
-
- Head to the [knot dashboard](https://tangled.org/knots) and
hit the "retry" button to verify your knot. This simply
writes a `sh.tangled.knot` record to your PDS.
···
For knots:
- Upgrade to latest tag (v1.9.0 or above)
+
- Head to the [knot dashboard](https://tangled.org/settings/knots) and
hit the "retry" button to verify your knot
For spindles:
- Upgrade to latest tag (v1.9.0 or above)
- Head to the [spindle
+
dashboard](https://tangled.org/settings/spindles) and hit the
"retry" button to verify your spindle
## Upgrading from v1.7.x
···
[settings](https://tangled.org/settings) page.
- Restart your knot once you have replaced the environment
variable
+
- Head to the [knot dashboard](https://tangled.org/settings/knots) and
hit the "retry" button to verify your knot. This simply
writes a `sh.tangled.knot` record to your PDS.