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
34 changes: 0 additions & 34 deletions app/components/AccessNameCell.tsx

This file was deleted.

8 changes: 6 additions & 2 deletions app/pages/SiloAccessPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
} from '@oxide/api'
import { Access24Icon } from '@oxide/design-system/icons/react'

import { AccessNameCell } from '~/components/AccessNameCell'
import { HL } from '~/components/HL'
import { RoleBadgeCell } from '~/components/RoleBadgeCell'
import {
Expand All @@ -36,6 +35,7 @@ import { Button } from '~/ui/lib/Button'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
import { PageHeader, PageTitle } from '~/ui/lib/PageHeader'
import { TableActions, TableEmptyBox } from '~/ui/lib/Table'
import { accessTypeLabel } from '~/util/access'
import { groupBy, isTruthy } from '~/util/array'

const EmptyState = ({ onClick }: { onClick: () => void }) => (
Expand Down Expand Up @@ -111,7 +111,11 @@ export function SiloAccessPage() {

const columns = useMemo(
() => [
colHelper.accessor('name', { header: 'Name', cell: AccessNameCell }),
colHelper.accessor('name', { header: 'Name' }),
colHelper.accessor('identityType', {
header: 'Type',
cell: (props) => accessTypeLabel(props.getValue()),
}),
colHelper.accessor('siloRole', {
header: 'Silo role',
cell: RoleBadgeCell,
Expand Down
8 changes: 6 additions & 2 deletions app/pages/project/access/ProjectAccessPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
} from '@oxide/api'
import { Access24Icon } from '@oxide/design-system/icons/react'

import { AccessNameCell } from '~/components/AccessNameCell'
import { HL } from '~/components/HL'
import { RoleBadgeCell } from '~/components/RoleBadgeCell'
import {
Expand All @@ -39,6 +38,7 @@ import { Button } from '~/ui/lib/Button'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
import { PageHeader, PageTitle } from '~/ui/lib/PageHeader'
import { TableActions, TableEmptyBox } from '~/ui/lib/Table'
import { accessTypeLabel } from '~/util/access'
import { groupBy, isTruthy } from '~/util/array'

const EmptyState = ({ onClick }: { onClick: () => void }) => (
Expand Down Expand Up @@ -127,7 +127,11 @@ export function ProjectAccessPage() {

const columns = useMemo(
() => [
colHelper.accessor('name', { header: 'Name', cell: AccessNameCell }),
colHelper.accessor('name', { header: 'Name' }),
colHelper.accessor('identityType', {
header: 'Type',
cell: (props) => accessTypeLabel(props.getValue()),
}),
colHelper.accessor('siloRole', {
header: 'Silo role',
cell: RoleBadgeCell,
Expand Down
15 changes: 15 additions & 0 deletions app/util/access.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* Copyright Oxide Computer Company
*/
import { expect, test } from 'vitest'

import { accessTypeLabel } from './access'

test('accessTypeLabel', () => {
expect(accessTypeLabel('silo_group')).toEqual('Group')
expect(accessTypeLabel('silo_user')).toEqual('User')
})
11 changes: 11 additions & 0 deletions app/util/access.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* Copyright Oxide Computer Company
*/
import type { IdentityType } from '~/api'

export const accessTypeLabel = (identityType: IdentityType) =>
identityType === 'silo_group' ? 'Group' : 'User'
8 changes: 6 additions & 2 deletions test/e2e/project-access.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,26 @@ test('Click through project access page', async ({ page }) => {
const table = page.locator('table')
await expectRowVisible(table, {
Name: 'Hannah Arendt',
Type: 'User',
'Silo role': 'admin',
'Project role': '',
})
await expectRowVisible(table, {
Name: 'Jacob Klein',
Type: 'User',
'Silo role': '',
'Project role': 'collaborator',
})
await expectRowVisible(table, {
// no space because expectRowVisible uses textContent, not accessible name
Name: 'real-estate-devsGroup',
Name: 'real-estate-devs',
Type: 'Group',
'Silo role': 'collaborator',
})
await expectRowVisible(table, {
// no space because expectRowVisible uses textContent, not accessible name
Name: 'kernel-devsGroup',
Name: 'kernel-devs',
Type: 'Group',
'Silo role': '',
'Project role': 'viewer',
})
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/silo-access.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ test('Click through silo access page', async ({ page }) => {
await expectVisible(page, ['role=heading[name*="Access & IAM"]'])
await expectRowVisible(table, {
// no space because expectRowVisible uses textContent, not accessible name
Name: 'real-estate-devsGroup',
Name: 'real-estate-devs',
Type: 'Group',
'Silo role': 'collaborator',
})
await expectRowVisible(table, {
Name: 'Hannah Arendt',
Type: 'User',
'Silo role': 'admin',
})
await expectNotVisible(page, [`role=cell[name="${user4.display_name}"]`])
Expand Down