Skip to content

Sortable agent context menu (requires amidaware/tacticalrmm#2564) - #62

Open
christian-wr wants to merge 4 commits into
amidaware:developfrom
christian-wr:feature/agent-menu-layout
Open

christian-wr wants to merge 4 commits into
amidaware:developfrom
christian-wr:feature/agent-menu-layout

Conversation

@christian-wr

Copy link
Copy Markdown

Summary

Frontend for the sortable agent context menu. Requires amidaware/tacticalrmm#2564, which adds the layout fields and the dashinfo keys.

  • Global Settings → Agent Menu:
    • drag & drop the top-level entries (vuedraggable, already a dependency)
    • hide entries with a checkbox
    • a switch "Allow users to customize the agent menu"
    • "Reset to default"
  • Preferences → Agent Menu, shown only while customization is allowed:
    • the same editor for the user's own layout
    • "Use company default"
  • Both the agent table right-click menu and the Summary tab "Actions" dropdown use the layout.

What changes

  • src/core/agentmenu/items.ts: registry of the 19 top-level entries in today's order. "Close" always stays last and is not part of it.
  • src/core/agentmenu/resolve.ts: pure functions.
    • The saved order wins.
    • Ids that no longer exist are ignored.
    • Entries missing from a saved layout, for example ones added in a later release, are inserted right after their default predecessor.
    • Hidden ids are dropped.
  • AgentActionMenu.vue: the existing items render inside <template v-for="id in menuIds">, each behind v-if="id === '…'". Their markup, sub-menus and existing conditions (Reporting integrations, :disable for URL actions and favourites) are unchanged. Most of the diff is re-indentation; git diff -w shows the real change.
  • Global Settings: the tab binds to the existing settings object and uses the shared Save button. That way a Save on another tab can never overwrite the menu layout with stale data.
  • Preferences: an untouched user keeps {}, so later company changes still reach them. The editor shows the company layout until the user changes something.
  • Vuex: agentMenuLayout, agentMenuAllowUser, agentMenuUserLayout, agentMenuCompanyLayout, all filled from getDashInfo.

Tests

  • eslint and prettier are clean, and quasar build passes. vue-tsc reports the same 39 errors as develop, none in changed code.
  • The resolver was unit-tested with Node's built-in test runner (7 cases: empty layout, saved order, new item placement, unknown and duplicate ids, hidden, round trip). The repo has no frontend test framework, so the tests are not committed. Happy to add them if you want one.
  • 19 automated browser checks (Playwright, headless Chromium) against a production build and the backend PR:
    • default order
    • company reorder and hide, in both menus
    • a General-tab Save keeps the layout
    • user override
    • lock: company layout shown, user layout kept, Preferences tab hidden
    • unlock: the user's layout returns
    • "Use company default" followed by an edit
    • company reset
    • no error toasts or console errors

With no own layout, the Preferences editor now shows the company layout instead of the effective one, so 'Use company default' and 'Reset to default' followed by an edit start from the company layout. Requires agent_menu_company_layout from dashinfo.
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.

1 participant