Skip to content

Commit 24f4bfe

Browse files
committed
refactor: move access level description below the option group
Option containers keep only their title so the picker takes roughly half the height in the connection dialog; a single short description below the group follows the selected access level and serves as the shared aria-describedby target.
1 parent 2a43d4e commit 24f4bfe

4 files changed

Lines changed: 19 additions & 18 deletions

File tree

‎DESIGN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,4 +331,4 @@ Check each affected surface. Documentation-only changes need source, link, and i
331331

332332
### AI permission controls
333333

334-
Per-connection permission editing uses the existing local Ultimate gate and inline upgrade prompt; Community connection edits preserve saved permission decisions. Connection dialogs expose a collapsed AI permissions section shared by Data Studio and external MCP. Default to system inheritance, show effective allowed actions, and offer visible radio choices for access levels, including Custom. Each option contains a short description of its scope. Custom reveals per-action Use default / Allow / Deny controls; each inherited option names its current decision. Presets and custom editing change the same permission values and do not form separate policy layers. The system settings page edits action defaults, without a separate connection allowlist or MCP exposure switch. Separate shared AI defaults from MCP service settings using the existing settings cards. Use switches for binary system defaults, and preserve shared RadioGroup, Select, Label, Button, neutral surfaces, localized English/Chinese copy, keyboard focus, and loading/error/retry states. See [AI permissions](docs/AI_PERMISSIONS.md) for enforcement and migration behavior.
334+
Per-connection permission editing uses the existing local Ultimate gate and inline upgrade prompt; Community connection edits preserve saved permission decisions. Connection dialogs expose a collapsed AI permissions section shared by Data Studio and external MCP. Default to system inheritance, show effective allowed actions, and offer visible radio choices for access levels, including Custom. A short description below the option group reflects the selected access level. Custom reveals per-action Use default / Allow / Deny controls; each inherited option names its current decision. Presets and custom editing change the same permission values and do not form separate policy layers. The system settings page edits action defaults, without a separate connection allowlist or MCP exposure switch. Separate shared AI defaults from MCP service settings using the existing settings cards. Use switches for binary system defaults, and preserve shared RadioGroup, Select, Label, Button, neutral surfaces, localized English/Chinese copy, keyboard focus, and loading/error/retry states. See [AI permissions](docs/AI_PERMISSIONS.md) for enforcement and migration behavior.

‎docs/AI_PERMISSIONS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The host-hook API is introduced by [data-studio-agent #35](https://github.com/ge
2626

2727
## Permission controls
2828

29-
Settings separate MCP service controls from the AI defaults shared by Data Studio and external MCP clients. Access levels use the existing settings radio pattern, with a short description inside each option. Custom is an access choice that reveals individual actions; it edits the same values as the presets. Choosing Custom alone does not change permissions.
29+
Settings separate MCP service controls from the AI defaults shared by Data Studio and external MCP clients. Access levels use the existing settings radio pattern; a short description below the option group updates with the selected access level. Custom is an access choice that reveals individual actions; it edits the same values as the presets. Choosing Custom alone does not change permissions.
3030

3131
Connection dialogs default to system inheritance. Each custom action offers Use default (with the current decision), Allow, or Deny, alongside its effective decision and source. Within the connection section, saved custom combinations show their action controls automatically. Choosing a preset sets explicit decisions for every action; choosing Use system default clears them.
3232

‎src/__tests__/aiPermissions.test.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,17 @@ describe('aI permission chain', () => {
114114
expect(AI_ACTIONS.every(action => aiPreset('none')[action] === false)).toBe(true)
115115
})
116116

117-
it('describes every access level inside its own selectable container', async () => {
117+
it('describes the selected access level below the option group', async () => {
118118
const wrapper = mount(DefaultPermissionEditor)
119119
await flushPromises()
120120
;['none', 'read', 'data', 'full', 'custom'].forEach((value) => {
121121
const option = wrapper.get(`label[for="ai-default-preset-${value}"]`)
122-
expect(option.text()).toContain(`aiPermissions.${value}Help`)
123-
expect(option.get('input').attributes('aria-describedby')).toBe(`ai-default-preset-${value}-description`)
122+
expect(option.text()).not.toContain(`${value}Help`)
123+
expect(option.get('input').attributes('aria-describedby')).toBe('ai-default-preset-description')
124124
})
125+
expect(wrapper.get('#ai-default-preset-description').text()).toMatch(/aiPermissions\.\w+Help/)
126+
await wrapper.get('input[value="full"]').setValue()
127+
expect(wrapper.get('#ai-default-preset-description').text()).toContain('aiPermissions.fullHelp')
125128
})
126129

127130
it('loads saved decisions and displays effective access from the whole chain', async () => {

‎src/components/ai-permissions/AccessLevelPicker.vue‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const options = computed(() => [
2323
</script>
2424

2525
<template>
26-
<div class="space-y-3">
26+
<div class="space-y-2">
2727
<Label :id="`${id}-label`">{{ t('aiPermissions.accessLevel') }}</Label>
2828
<RadioGroup
2929
:model-value="modelValue"
@@ -36,7 +36,7 @@ const options = computed(() => [
3636
v-for="value in options"
3737
:key="value"
3838
:for="`${id}-${value}`"
39-
class="text-sm font-medium px-4 py-3 border rounded-lg flex gap-3 cursor-pointer transition-colors items-start has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring"
39+
class="text-sm font-medium px-3 py-2.5 border rounded-lg flex gap-2.5 cursor-pointer transition-colors items-center has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring"
4040
:class="[
4141
modelValue === value ? 'border-primary bg-primary/5' : 'border-input hover:bg-accent/50',
4242
disabled && 'cursor-not-allowed opacity-50',
@@ -46,26 +46,24 @@ const options = computed(() => [
4646
:id="`${id}-${value}`"
4747
:value="value"
4848
:aria-labelledby="`${id}-${value}-title`"
49-
:aria-describedby="`${id}-${value}-description`"
50-
class="mt-0.5 shrink-0"
49+
:aria-describedby="`${id}-description`"
50+
class="shrink-0"
5151
/>
52-
<span class="min-w-0 space-y-1">
53-
<span :id="`${id}-${value}-title`" class="leading-snug block">
54-
{{ t(`aiPermissions.${value === 'read' ? 'readPreset' : value}`) }}
55-
</span>
56-
<span :id="`${id}-${value}-description`" class="text-xs text-muted-foreground leading-relaxed font-normal block">
57-
{{ t(`aiPermissions.${value}Help`) }}
58-
</span>
52+
<span :id="`${id}-${value}-title`" class="leading-snug min-w-0">
53+
{{ t(`aiPermissions.${value === 'read' ? 'readPreset' : value}`) }}
5954
</span>
6055
</Label>
6156
</RadioGroup>
57+
<p :id="`${id}-description`" class="text-xs text-muted-foreground leading-relaxed">
58+
{{ t(`aiPermissions.${modelValue}Help`) }}
59+
</p>
6260
</div>
6361
</template>
6462

6563
<style scoped>
6664
.access-level-options {
6765
display: grid;
68-
grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
69-
gap: 0.75rem;
66+
grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
67+
gap: 0.5rem;
7068
}
7169
</style>

0 commit comments

Comments
 (0)