Skip to content

UI for device HTTP Tokens#7579

Open
knolleary wants to merge 4 commits into
mainfrom
7566-device-token-ui
Open

UI for device HTTP Tokens#7579
knolleary wants to merge 4 commits into
mainfrom
7566-device-token-ui

Conversation

@knolleary

@knolleary knolleary commented Jun 22, 2026

Copy link
Copy Markdown
Member

Adds UI for managing device tokens.

This is largely a copy/paste of the existing UI for Instances. But there is quite a lot of duplication now.

  • frontend/src/pages/device/Settings/Security.vue
  • frontend/src/pages/instance/Settings/Security.vue

The Hosted/Remote instance settings files already use a common component for the selection of auth type (frontend/src/pages/admin/Template/sections/Security.vue). These are generic options that apply to both types.

The Tokens table and all associated logic is ripe for making a common component as well; the challenge being the different endpoints needed between the two instance types. All doable, just more work to get right.

There is also duplication in the token create dialogs:

  • frontend/src/pages/device/Settings/dialogs/TokenDialog.vue
  • frontend/src/pages/instance/Settings/dialogs/TokenDialog.vue
  • frontend/src/pages/account/Security/dialogs/TokenDialog.vue

All three dialogs are visually identical - the difference is purely the api endpoint used to create/update the token. Again, ripe for refactoring to make a proper shared dialog.

I'm noting this here to reflect the state of the PR. I will look at how easy any of the above refactorings would be before deciding on this PR's next steps.

@knolleary knolleary linked an issue Jun 22, 2026 that may be closed by this pull request
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.95%. Comparing base (b8f853c) to head (95f1b06).

Additional details and impacted files
@@                     Coverage Diff                      @@
##           7564-device-http-token-crud    #7579   +/-   ##
============================================================
  Coverage                        76.95%   76.95%           
============================================================
  Files                              410      410           
  Lines                            21084    21084           
  Branches                          5138     5138           
============================================================
  Hits                             16225    16225           
  Misses                            4859     4859           
Flag Coverage Δ
backend 76.95% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@knolleary knolleary marked this pull request as ready for review June 22, 2026 15:04
@knolleary

Copy link
Copy Markdown
Member Author

I'm not going to try deduplicating the code. It needs a larger refactor to make the api calls pluggable, or handled via events.

@knolleary knolleary requested review from cstns and hardillb June 22, 2026 15:10
Base automatically changed from 7564-device-http-token-crud to main June 22, 2026 15:16

@hardillb hardillb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and appears to work (inserts edit and removes tokens)

Just need to remove the commented out return that was obviously the same thing I asked about in slack

if (!this.device.agentVersion) {
return false
}
// return true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// return true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add httpToken UI to device/settings/security

2 participants