Monorepo for Tangled tangled.org

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

merged opened by 5jiji.com targeting master from [deleted fork]: 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))

Labels

None yet.

assignee

None yet.

Participants 3
AT URI
at://did:plc:uakrniojtddxh2juse64bgcm/sh.tangled.repo.pull/3m2z5niwb2y22
+69 -31
Diff #0
+14 -2
appview/state/router.go
··· 161 161 162 162 r.Mount("/settings", s.SettingsRouter()) 163 163 r.Mount("/strings", s.StringsRouter(mw)) 164 - r.Mount("/knots", s.KnotsRouter()) 165 - r.Mount("/spindles", s.SpindlesRouter()) 164 + 165 + 166 + r.Mount("/knots", s.Redirect("/settings/knots")) 167 + r.Mount("/spindles", s.Redirect("/settings/spindles")) 168 + 169 + r.Mount("/settings/knots", s.KnotsRouter()) 170 + r.Mount("/settings/spindles", s.SpindlesRouter()) 171 + 166 172 r.Mount("/notifications", s.NotificationsRouter(mw)) 167 173 168 174 r.Mount("/signup", s.SignupRouter()) ··· 179 185 return r 180 186 } 181 187 188 + func (s *State) Redirect(destination string) http.HandlerFunc { 189 + return func(w http.ResponseWriter, r *http.Request) { 190 + http.Redirect(w, r, destination, http.StatusFound) 191 + } 192 + } 193 + 182 194 // Core serves tangled.org/core go-import meta tags, and redirects 183 195 // to the core repository if accessed normally. 184 196 func (s *State) Core() http.HandlerFunc {
+3 -3
appview/pages/templates/knots/dashboard.html
··· 79 79 <button 80 80 class="btn text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 gap-2 group" 81 81 title="Delete knot" 82 - hx-delete="/knots/{{ .Domain }}" 82 + hx-delete="/settings/knots/{{ .Domain }}" 83 83 hx-swap="outerHTML" 84 84 hx-confirm="Are you sure you want to delete the knot '{{ .Domain }}'?" 85 85 hx-headers='{"shouldRedirect": "true"}' ··· 95 95 <button 96 96 class="btn gap-2 group" 97 97 title="Retry knot verification" 98 - hx-post="/knots/{{ .Domain }}/retry" 98 + hx-post="/settings/knots/{{ .Domain }}/retry" 99 99 hx-swap="none" 100 100 hx-headers='{"shouldRefresh": "true"}' 101 101 > ··· 113 113 <button 114 114 class="btn text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 gap-2 group" 115 115 title="Remove member" 116 - hx-post="/knots/{{ $root.Registration.Domain }}/remove" 116 + hx-post="/settings/knots/{{ $root.Registration.Domain }}/remove" 117 117 hx-swap="none" 118 118 hx-vals='{"member": "{{$member}}" }' 119 119 hx-confirm="Are you sure you want to remove {{ $memberHandle }} from this knot?"
+1 -1
appview/pages/templates/knots/fragments/addMemberModal.html
··· 20 20 21 21 {{ define "addKnotMemberPopover" }} 22 22 <form 23 - hx-post="/knots/{{ .Domain }}/add" 23 + hx-post="/settings/knots/{{ .Domain }}/add" 24 24 hx-indicator="#spinner" 25 25 hx-swap="none" 26 26 class="flex flex-col gap-2"
+3 -3
appview/pages/templates/knots/fragments/knotListing.html
··· 7 7 8 8 {{ define "knotLeftSide" }} 9 9 {{ if .Registered }} 10 - <a href="/knots/{{ .Domain }}" class="hover:no-underline flex items-center gap-2 min-w-0 max-w-[60%]"> 10 + <a href="/settings/knots/{{ .Domain }}" class="hover:no-underline flex items-center gap-2 min-w-0 max-w-[60%]"> 11 11 {{ i "hard-drive" "w-4 h-4" }} 12 12 <span class="hover:underline"> 13 13 {{ .Domain }} ··· 56 56 <button 57 57 class="btn text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 gap-2 group" 58 58 title="Delete knot" 59 - hx-delete="/knots/{{ .Domain }}" 59 + hx-delete="/settings/knots/{{ .Domain }}" 60 60 hx-swap="outerHTML" 61 61 hx-target="#knot-{{.Id}}" 62 62 hx-confirm="Are you sure you want to delete the knot '{{ .Domain }}'?" ··· 72 72 <button 73 73 class="btn gap-2 group" 74 74 title="Retry knot verification" 75 - hx-post="/knots/{{ .Domain }}/retry" 75 + hx-post="/settings/knots/{{ .Domain }}/retry" 76 76 hx-swap="none" 77 77 hx-target="#knot-{{.Id}}" 78 78 >
+1 -1
appview/pages/templates/knots/index.html
··· 50 50 <h2 class="text-sm font-bold py-2 uppercase dark:text-gray-300">register a knot</h2> 51 51 <p class="mb-2 dark:text-gray-300">Enter the hostname of your knot to get started.</p> 52 52 <form 53 - hx-post="/knots/register" 53 + hx-post="/settings/knots/register" 54 54 class="max-w-2xl mb-2 space-y-4" 55 55 hx-indicator="#register-button" 56 56 hx-swap="none"
+3 -2
appview/pages/templates/layouts/fragments/topbar.html
··· 65 65 <a href="/{{ $user }}">profile</a> 66 66 <a href="/{{ $user }}?tab=repos">repositories</a> 67 67 <a href="/{{ $user }}?tab=strings">strings</a> 68 - <a href="/knots">knots</a> 69 - <a href="/spindles">spindles</a> 68 + <a href="/settings/knots">knots</a> 69 + <a href="/settings/spindles">spindles</a> 70 70 <a href="/settings">settings</a> 71 71 <a href="#" 72 + hx-post="/logout"
+1 -1
appview/pages/templates/repo/fork.html
··· 33 33 {{ end }} 34 34 </div> 35 35 </div> 36 - <p class="text-sm text-gray-500 dark:text-gray-400">A knot hosts repository data. <a href="/knots" class="underline">Learn how to register your own knot.</a></p> 36 + <p class="text-sm text-gray-500 dark:text-gray-400">A knot hosts repository data. <a href="/settings/knots" class="underline">Learn how to register your own knot.</a></p> 37 37 </fieldset> 38 38 39 39 <div class="space-y-2">
+1 -1
appview/pages/templates/repo/new.html
··· 164 164 </div> 165 165 <p class="text-sm text-gray-500 dark:text-gray-400 mt-1"> 166 166 A knot hosts repository data and handles Git operations. 167 - You can also <a href="/knots" class="underline">register your own knot</a>. 167 + You can also <a href="/settings/knots" class="underline">register your own knot</a>. 168 168 </p> 169 169 </div> 170 170 {{ end }}
+26 -1
docs/hacking.md
··· 111 111 with `ssh` exposed on port 2222. 112 112 113 113 Once the services are running, head to 114 - http://localhost:3000/knots and hit verify. It should 114 + http://localhost:3000/settings/knots and hit verify. It should 115 115 verify the ownership of the services instantly if everything 116 116 went smoothly. 117 + 118 + 119 + 120 + 121 + 122 + 123 + 124 + 125 + 126 + 127 + 128 + 129 + 130 + 131 + 132 + 133 + 134 + 135 + 136 + ### running a spindle 137 + 138 + The above VM should already be running a spindle on 139 + `localhost:6555`. Head to http://localhost:3000/settings/spindles and 140 + hit verify. You can then configure each repository to use 141 + this spindle and run CI jobs. 117 142
+1 -1
docs/knot-hosting.md
··· 130 130 131 131 You should now have a running knot server! You can finalize 132 132 your registration by hitting the `verify` button on the 133 - [/knots](https://tangled.org/knots) page. This simply creates 133 + [/settings/knots](https://tangled.org/settings/knots) page. This simply creates 134 134 a record on your PDS to announce the existence of the knot. 135 135 136 136 ### custom paths
+7 -7
docs/migrations.md
··· 14 14 For knots: 15 15 16 16 - Upgrade to latest tag (v1.9.0 or above) 17 - - Head to the [knot dashboard](https://tangled.org/knots) and 17 + - Head to the [knot dashboard](https://tangled.org/settings/knots) and 18 18 hit the "retry" button to verify your knot 19 19 20 20 For spindles: 21 21 22 + - Upgrade to latest tag (v1.9.0 or above) 23 + - Head to the [spindle 24 + dashboard](https://tangled.org/settings/spindles) and hit the 25 + "retry" button to verify your spindle 22 26 27 + ## Upgrading from v1.7.x 23 28 24 29 25 30 ··· 33 38 34 39 35 40 36 - 37 - 38 - 39 - 40 - 41 41 [settings](https://tangled.org/settings) page. 42 42 - Restart your knot once you have replaced the environment 43 43 variable 44 - - Head to the [knot dashboard](https://tangled.org/knots) and 44 + - Head to the [knot dashboard](https://tangled.org/settings/knots) and 45 45 hit the "retry" button to verify your knot. This simply 46 46 writes a `sh.tangled.knot` record to your PDS. 47 47
+3 -3
appview/pages/templates/spindles/dashboard.html
··· 71 71 <button 72 72 class="btn text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 gap-2 group" 73 73 title="Delete spindle" 74 - hx-delete="/spindles/{{ .Instance }}" 74 + hx-delete="/settings/spindles/{{ .Instance }}" 75 75 hx-swap="outerHTML" 76 76 hx-confirm="Are you sure you want to delete the spindle '{{ .Instance }}'?" 77 77 hx-headers='{"shouldRedirect": "true"}' ··· 87 87 <button 88 88 class="btn gap-2 group" 89 89 title="Retry spindle verification" 90 - hx-post="/spindles/{{ .Instance }}/retry" 90 + hx-post="/settings/spindles/{{ .Instance }}/retry" 91 91 hx-swap="none" 92 92 hx-headers='{"shouldRefresh": "true"}' 93 93 > ··· 104 104 <button 105 105 class="btn text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 gap-2 group" 106 106 title="Remove member" 107 - hx-post="/spindles/{{ $root.Spindle.Instance }}/remove" 107 + hx-post="/settings/spindles/{{ $root.Spindle.Instance }}/remove" 108 108 hx-swap="none" 109 109 hx-vals='{"member": "{{$member}}" }' 110 110 hx-confirm="Are you sure you want to remove {{ resolve $member }} from this instance?"
+1 -1
appview/pages/templates/spindles/fragments/addMemberModal.html
··· 20 20 21 21 {{ define "addSpindleMemberPopover" }} 22 22 <form 23 - hx-post="/spindles/{{ .Instance }}/add" 23 + hx-post="/settings/spindles/{{ .Instance }}/add" 24 24 hx-indicator="#spinner" 25 25 hx-swap="none" 26 26 class="flex flex-col gap-2"
+3 -3
appview/pages/templates/spindles/fragments/spindleListing.html
··· 7 7 8 8 {{ define "spindleLeftSide" }} 9 9 {{ if .Verified }} 10 - <a href="/spindles/{{ .Instance }}" class="hover:no-underline flex items-center gap-2 min-w-0 max-w-[60%]"> 10 + <a href="/settings/spindles/{{ .Instance }}" class="hover:no-underline flex items-center gap-2 min-w-0 max-w-[60%]"> 11 11 {{ i "hard-drive" "w-4 h-4" }} 12 12 <span class="hover:underline"> 13 13 {{ .Instance }} ··· 50 50 <button 51 51 class="btn text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 gap-2 group" 52 52 title="Delete spindle" 53 - hx-delete="/spindles/{{ .Instance }}" 53 + hx-delete="/settings/spindles/{{ .Instance }}" 54 54 hx-swap="outerHTML" 55 55 hx-target="#spindle-{{.Id}}" 56 56 hx-confirm="Are you sure you want to delete the spindle '{{ .Instance }}'?" ··· 66 66 <button 67 67 class="btn gap-2 group" 68 68 title="Retry spindle verification" 69 - hx-post="/spindles/{{ .Instance }}/retry" 69 + hx-post="/settings/spindles/{{ .Instance }}/retry" 70 70 hx-swap="none" 71 71 hx-target="#spindle-{{.Id}}" 72 72 >
+1 -1
appview/pages/templates/spindles/index.html
··· 47 47 <h2 class="text-sm font-bold py-2 uppercase dark:text-gray-300">register a spindle</h2> 48 48 <p class="mb-2 dark:text-gray-300">Enter the hostname of your spindle to get started.</p> 49 49 <form 50 - hx-post="/spindles/register" 50 + hx-post="/settings/spindles/register" 51 51 class="max-w-2xl mb-2 space-y-4" 52 52 hx-indicator="#register-button" 53 53 hx-swap="none"

History

3 rounds 7 comments
sign up or login to add to the discussion
9 commits
expand
bfa487d3
appview/state: Moved /knots & /spindle to /settings
07a7776b
appview/pages, docs: Update knots links
69207de2
appview/pages, docs: Update spindle links
ff1993a3
appview/pages: Remove links from dropdown
09cebe3c
appview/state: Remove Redirects
8df0b723
appview/{pages,knots}: Update knots page to be more settings like
efee07c6
appview/{pages,spindle}: Update knots page to be more settings like
8ccee251
appview/{knots,settings,spindle}: Added icons for knots & spindle
eee39bb4
appview/{knots,pages,state}: formating
expand 3 comments

Resubmitted to format the code properly!

Generally lgtm! Can you squash the commits into single commit?

nvm I'll merge this PR and squash manually. Thank you for your contribution!

pull request successfully merged
8 commits
expand
d0c19d4c
appview/state: Moved /knots & /spindle to /settings
572cf29a
appview/pages, docs: Update knots links
1e0f64f1
appview/pages, docs: Update spindle links
4d0f3209
appview/pages: Remove links from dropdown
cc9f5e64
appview/state: Remove Redirects
3a38512d
appview/{pages,knots}: Update knots page to be more settings like
37debd08
appview/{pages,spindle}: Update knots page to be more settings like
6206b22b
appview/{knots,settings,spindle}: Added icons for knots & spindle
expand 1 comment

Hello there, finally could resubmit my patch (as i couldn't do that for some reason), so to update on what i updated:

  • Moved the knots & spindle pages to the settings page
    • I know that i currently have duplicated information, for the icons to be showed, but i have no clue on how to share that information (i still don't know go very much)
    • I tried making the knots & spindle pages fit in, but i have no idea if that's good enough or not
  • Removed the knots & spindle shortcuts from the user dropdown
    • Did not add them on the repo create page & spindle pages, as i don't really know how you'd like them to be set as

And i think that's about it! I may have forgotten a bit of what i did, as it's now been a while since i wrote all the stuff for the patch, as i couldn't resubmit, but i think i touched on all main points.

5jiji.com submitted #0
3 commits
expand
6ccadcfa
appview/state: Moved /knots & /spindle to /settings
c021c3c5
appview/pages, docs: Update knots links
6d7337ce
appview/pages, docs: Update spindle links
expand 3 comments

thanks for the contribution! some high level thoughts on this work:

  • the original intent of the issue (it is not the clearest about this unfortunately) is to move the knots and spindles pages to be new tabs under the settings page
  • the code here seems to move the routers, which is a good chunk of this work, we also want to make UI changes here to completely move the pages
  • i personally do not think the redirect is necessary, we can move the router directly under settings, without using a redirect

For the second point, does it mean that the links from the user submenu (when you click on your account in the topbar) will be removed, or will stay?

yes, we will remove the links from there. other areas of the UI can be later improved to indicate the existence of selfhosting (the new repo page can contain a link to selfhosted knots, the pipelienes page can have a link to spindles and selfhosting docs etc.)