Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions reposilite-frontend/src/components/access/LdapPanel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ describe('LdapPanel', () => {
document.body.innerHTML = ''
})

describe('field grids', () => {
it('lays its fields out with the shared field grid, not a hand-written grid', async () => {
await mountPanel()

const handWritten = wrapper.findAll('.medium\\:grid-cols-2')
const shared = wrapper.findAll('.expanded\\:grid-cols-2')
expect(handWritten.length, 'no field group writes its own two column grid').toBe(0)
expect(shared.length, 'the four field groups use the shared field grid').toBeGreaterThanOrEqual(4)
})
})

describe('headings', () => {
it('titles both sections with level 2 headings in the title-medium role, under the level 1 page heading', async () => {
await mountPanel()
Expand Down
17 changes: 9 additions & 8 deletions reposilite-frontend/src/components/access/LdapPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import MdAlert from '../md/MdAlert.vue'
import MdButton from '../md/MdButton.vue'
import MdCard from '../md/MdCard.vue'
import MdChipInput from '../md/MdChipInput.vue'
import MdFieldGrid from '../md/MdFieldGrid.vue'
import MdSection from '../md/MdSection.vue'
import MdStatePanel from '../md/MdStatePanel.vue'
import MdSwitch from '../md/MdSwitch.vue'
Expand Down Expand Up @@ -189,7 +190,7 @@ onMounted(load)
<p class="md-body-medium text-on-surface-variant">
The service account the server uses to search. Leave both empty to search anonymously.
</p>
<div class="grid gap-4 medium:grid-cols-2">
<MdFieldGrid>
<MdTextField
id="ldap-bind-dn"
v-model="form.bindDn"
Expand All @@ -207,7 +208,7 @@ onMounted(load)
:error="errorOf('bindPassword') !== ''"
:error-text="errorOf('bindPassword')"
/>
</div>
</MdFieldGrid>
</MdSection>

<MdSection
Expand All @@ -216,7 +217,7 @@ onMounted(load)
heading-id="ldap-users-title"
aria-labelledby="ldap-users-title"
>
<div class="grid gap-4 medium:grid-cols-2">
<MdFieldGrid>
<MdTextField
id="ldap-user-base"
v-model="form.userBaseDn"
Expand Down Expand Up @@ -260,7 +261,7 @@ onMounted(load)
type="text"
autocomplete="off"
/>
</div>
</MdFieldGrid>
<MdSwitch
id="ldap-create-users"
v-model="form.autoCreateUsers"
Expand All @@ -279,7 +280,7 @@ onMounted(load)
A team whose external reference is <code>ldap:&lt;group&gt;</code> is synced from the groups
of this directory: its members follow the group, and they cannot be removed by hand.
</p>
<div class="grid gap-4 medium:grid-cols-2">
<MdFieldGrid>
<MdTextField
id="ldap-group-base"
v-model="form.groupBaseDn"
Expand All @@ -304,7 +305,7 @@ onMounted(load)
type="text"
autocomplete="off"
/>
</div>
</MdFieldGrid>
<MdChipInput
id="ldap-admin-groups"
v-model="form.adminGroups"
Expand Down Expand Up @@ -351,7 +352,7 @@ onMounted(load)
? 'Save your changes first. The test reads the saved directory.'
: 'Connects with the saved settings. A user name and password also check that the user signs in.'"
>
<div class="grid gap-4 medium:grid-cols-2">
<MdFieldGrid>
<MdTextField
id="ldap-test-username"
v-model="testUsername"
Expand All @@ -366,7 +367,7 @@ onMounted(load)
type="password"
autocomplete="off"
/>
</div>
</MdFieldGrid>
<div class="flex flex-wrap items-center gap-3">
<MdButton
variant="outlined"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,17 @@ describe('SsoProviderDialog register card', () => {
expect(section?.querySelector('[aria-label="Copy callback URL"]'), 'the copy button sits in the card').not.toBeNull()
})
})

describe('SsoProviderDialog field grids', () => {
afterEach(() => {
wrapper?.unmount()
wrapper = undefined
})

it('lays its fields out with the shared field grid, not a hand-written grid', async () => {
await openDialog()

expect(document.querySelectorAll('.medium\\:grid-cols-2').length, 'no field group writes its own two column grid').toBe(0)
expect(document.querySelectorAll('.expanded\\:grid-cols-2').length, 'the field groups use the shared field grid').toBeGreaterThanOrEqual(1)
})
})
13 changes: 7 additions & 6 deletions reposilite-frontend/src/components/access/SsoProviderDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import MdDialog from '../md/MdDialog.vue'
import MdButton from '../md/MdButton.vue'
import MdCard from '../md/MdCard.vue'
import MdChipInput from '../md/MdChipInput.vue'
import MdFieldGrid from '../md/MdFieldGrid.vue'
import MdDisclosure from '../md/MdDisclosure.vue'
import MdIconButton from '../md/MdIconButton.vue'
import MdSwitch from '../md/MdSwitch.vue'
Expand Down Expand Up @@ -225,7 +226,7 @@ const validateDomain = (text: string, existing: string[]) => {
novalidate
@submit.prevent="save()"
>
<div class="grid gap-4 medium:grid-cols-2">
<MdFieldGrid>
<MdTextField
id="sso-id"
v-model="form.id"
Expand All @@ -247,7 +248,7 @@ const validateDomain = (text: string, existing: string[]) => {
:error-text="errorOf('label')"
required
/>
</div>
</MdFieldGrid>

<MdTextField
id="sso-issuer"
Expand Down Expand Up @@ -299,7 +300,7 @@ const validateDomain = (text: string, existing: string[]) => {
</div>
</MdCard>

<div class="grid gap-4 medium:grid-cols-2">
<MdFieldGrid>
<MdTextField
id="sso-client-id"
v-model="form.clientId"
Expand All @@ -323,7 +324,7 @@ const validateDomain = (text: string, existing: string[]) => {
:error-text="errorOf('clientSecret')"
:required="githubEndpoints"
/>
</div>
</MdFieldGrid>

<MdChipInput
id="sso-scopes"
Expand Down Expand Up @@ -385,7 +386,7 @@ const validateDomain = (text: string, existing: string[]) => {
<template #summary>
Advanced
</template>
<div class="grid gap-4 medium:grid-cols-2">
<MdFieldGrid>
<MdTextField
id="sso-claim-username"
v-model="form.usernameClaim"
Expand Down Expand Up @@ -414,7 +415,7 @@ const validateDomain = (text: string, existing: string[]) => {
type="text"
autocomplete="off"
/>
</div>
</MdFieldGrid>
<!-- A login the provider has already verified with a second factor counts as one, so the policy does not ask again. -->
<div class="mt-4 flex flex-col gap-4">
<MdChipInput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ describe('RepositoryMembersPicker credentials of the members', () => {
expect(wrapper.find('#members-login-1').exists()).toBe(false)
})

it('puts the credential fields side by side on the medium window class, not on a default breakpoint', async () => {
it('puts the credential fields side by side on the expanded window class, not on a default breakpoint', async () => {
mountWithCredentials({ modelValue: [entry('releases', { authorization: loopback })] })
await editButton('releases').trigger('click')

const form = wrapper.get('[data-test="member-credential-form"]')
expect(form.classes(), 'two columns from 600 pixels').toContain('medium:grid-cols-2')
expect(form.classes(), 'two columns from 840 pixels').toContain('expanded:grid-cols-2')
expect(form.classes().filter(name => /^(sm|md|lg|xl|2xl):/.test(name)), 'no default breakpoint prefix').toEqual([])
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import { computed, ref } from 'vue'
import MdAlert from '../md/MdAlert.vue'
import MdButton from '../md/MdButton.vue'
import MdFieldGrid from '../md/MdFieldGrid.vue'
import MdIconButton from '../md/MdIconButton.vue'
import MdSelect from '../md/MdSelect.vue'
import MdTextField from '../md/MdTextField.vue'
Expand Down Expand Up @@ -185,10 +186,9 @@ const setCredential = (index: number, field: string, value: unknown) => {
{{ openCredential === index ? 'Done' : 'Edit credential' }}
</MdButton>
</div>
<div
<MdFieldGrid
v-if="openCredential === index"
data-test="member-credential-form"
class="grid gap-4 medium:grid-cols-2"
>
<MdTextField
:id="`${idPrefix}-login-${index}`"
Expand All @@ -207,7 +207,7 @@ const setCredential = (index: number, field: string, value: unknown) => {
supporting-text="A stored password shows as ********. Type a new value to replace it."
@update:model-value="setCredential(index, 'password', $event)"
/>
</div>
</MdFieldGrid>
</div>
</li>
</ol>
Expand Down
Loading