Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

/admin's 'The arm rests on the table now' button sets the table there and shows the new height #354

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

/admin now has a "The arm rests on the table now" button next to Save in the Table height section. It calls POST /settings/table-here from the page and puts the returned tableOffsetMm into the height field. It also shows "The table is here: N mm." underneath.

Notes

shipped merged

opened this

/admin now has a "The arm rests on the table now" button next to Save in the Table height section. It calls POST /settings/table-here from the page and puts the returned tableOffsetMm into the height field. It also shows "The table is here: N mm." underneath. If the server refuses (for example, no model loaded or the offset is out of range), the server's error text appears there instead.

The button is only rendered for the owner; a moderator's page contains neither the button nor the script that drives it. I changed the page's one script, and its Content-Security-Policy hash is computed from that script, so the policy follows the change. forge.json is untouched.

The admin-page tests pass, including the extended owner-only test in src/admin-page.test.ts that checks the button for the owner and its absence for a moderator. I did not run the full bun --cwd Software/so101 test, and the type check did not run here: bun x tsc --noEmit failed on a read-only tempdir in this sandbox. I haven't tried the button against a running app.

Closes #280

commented

/admin now has a "The arm rests on the table now" button next to Save in the Table height section. It calls POST /settings/table-here from the page and puts the returned tableOffsetMm into the height field. It also shows "The table is here: N mm." underneath. If the server refuses (for example, no model loaded or the offset is out of range), the server's error text appears there instead.

The button is only rendered for the owner; a moderator's page contains neither the button nor the script that drives it. I changed the page's one script, and its Content-Security-Policy hash is computed from that script, so the policy follows the change. forge.json is untouched.

The admin-page tests pass, including the extended owner-only test in src/admin-page.test.ts that checks the button for the owner and its absence for a moderator. I did not run the full bun --cwd Software/so101 test, and the type check did not run here: bun x tsc --noEmit failed on a read-only tempdir in this sandbox. I haven't tried the button against a running app.

Approved

The button does what the issue asks. It is owner-only, it posts to the existing admin-gated POST /settings/table-here, and it fills the height field and shows the new mm or the server error in a role=status note. The moderator page has neither the button nor the script. The terminal already has /table here, and the README already documents the endpoint. The admin-page tests pass (3/3). In the preview, /admin without a session shows no button and the POST answers 401, so I could not click it as the owner.

Two things I would do next:

  1. Add a test that the button handler writes the returned tableOffsetMm into the field and shows the server error. The test now only checks that the markup is present, so the script logic is untested.
  2. Disable the button while the request is in flight so a double tap on a phone does not send two requests. The target also needs to be at least 44px tall at 360px wide, and the note should say what the number means, for example mm above the model floor.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs