Skip to content

Commit cce1389

Browse files
committed
improvement(tables): align Expiration feature messages
1 parent fa8c005 commit cce1389

8 files changed

Lines changed: 16 additions & 25 deletions

File tree

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/new-column-dropdown/new-column-dropdown.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
chipContentIconClass,
66
chipContentLabelClass,
77
chipVariants,
8+
cn,
89
DropdownMenu,
910
DropdownMenuContent,
1011
DropdownMenuItem,
@@ -50,9 +51,7 @@ function ColumnTypeMenuItem({ option, onSelect }: ColumnTypeMenuItemProps) {
5051
const item = (
5152
<DropdownMenuItem
5253
aria-disabled={option.disabledReason ? true : undefined}
53-
className={
54-
option.disabledReason ? 'cursor-not-allowed opacity-50 focus:bg-transparent' : undefined
55-
}
54+
className={cn(option.disabledReason && 'cursor-not-allowed opacity-50 focus:bg-transparent')}
5655
onSelect={(event) => {
5756
if (option.disabledReason) {
5857
event.preventDefault()

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells/inline-editors.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,8 @@ describe('dateEditorRawValue', () => {
120120

121121
act(() => root.render(createElement(InlineEditor, props)))
122122

123-
expect(container.querySelector('input')).toMatchObject({
124-
disabled: true,
125-
placeholder: 'Loading timezone...',
126-
})
123+
expect(container.querySelector('input')).toBeNull()
124+
expect(container.querySelector('[role="status"]')?.textContent).toBe('Loading timezone…')
127125

128126
mockUseTimezoneState.mockReturnValue({
129127
timezone: 'America/Los_Angeles',

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells/inline-editors.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,9 @@ function InlineDateEditor(props: InlineEditorProps) {
8181

8282
if (ttlTimezoneUnavailable) {
8383
return (
84-
<input
85-
type='text'
86-
value=''
87-
disabled
88-
placeholder={
89-
timezoneState.status === 'error' ? 'Timezone unavailable' : 'Loading timezone...'
90-
}
91-
className='w-full min-w-0 border-none bg-transparent p-0 text-[var(--text-muted)] text-small outline-none'
92-
/>
84+
<span role='status' className='w-full min-w-0 truncate text-[var(--text-muted)] text-small'>
85+
{timezoneState.status === 'error' ? 'Timezone unavailable' : 'Loading timezone…'}
86+
</span>
9387
)
9488
}
9589

apps/sim/lib/core/config/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ export const env = createEnv({
590590
SESSION_POLICIES_ENABLED: z.boolean().optional(), // Enable org session policies on self-hosted (bypasses hosted requirements)
591591
FORKING_ENABLED: z.boolean().optional(), // Enable workspace forking on self-hosted (bypasses hosted requirements)
592592
TABLES_V2_API: z.boolean().optional(), // Enable the v2 tables HTTP API (public /api/v2/tables + internal /api/table/[tableId]/query predicate-grammar route)
593-
TABLE_ROW_TTL: z.boolean().optional(), // Enable table row expiration through TTL columns
593+
TABLE_ROW_TTL: z.boolean().optional(),
594594
CREDENTIAL_GROUPS: z.boolean().optional(), // Enable enterprise Credential Groups globally
595595

596596
// Organizations - for self-hosted deployments

apps/sim/lib/table/columns/ttl-limit.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,20 @@ describe('TTL column mutation limit', () => {
6767
})
6868

6969
it('rejects adding a TTL column before locking when the feature is disabled', async () => {
70-
mockAssertTableRowTtlEnabled.mockRejectedValue(new Error('TTL columns are not enabled'))
70+
mockAssertTableRowTtlEnabled.mockRejectedValue(new Error('Expiration columns are not enabled'))
7171

7272
await expect(
7373
addTableColumn('table-1', { name: 'expiry', type: 'ttl' }, 'request-1')
74-
).rejects.toThrow('TTL columns are not enabled')
74+
).rejects.toThrow('Expiration columns are not enabled')
7575
expect(mockWithLockedTable).not.toHaveBeenCalled()
7676
})
7777

7878
it('rejects retyping to TTL before locking when the feature is disabled', async () => {
79-
mockAssertTableRowTtlEnabled.mockRejectedValue(new Error('TTL columns are not enabled'))
79+
mockAssertTableRowTtlEnabled.mockRejectedValue(new Error('Expiration columns are not enabled'))
8080

8181
await expect(
8282
updateColumnType({ tableId: 'table-1', columnName: 'name', newType: 'ttl' }, 'request-1')
83-
).rejects.toThrow('TTL columns are not enabled')
83+
).rejects.toThrow('Expiration columns are not enabled')
8484
expect(mockWithLockedTable).not.toHaveBeenCalled()
8585
})
8686

apps/sim/lib/table/service.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ describe('createTable schema invariants', () => {
7070
})
7171

7272
it('rejects a TTL schema before persistence when the feature is disabled', async () => {
73-
mockAssertTableRowTtlEnabled.mockRejectedValue(new Error('TTL columns are not enabled'))
73+
mockAssertTableRowTtlEnabled.mockRejectedValue(new Error('Expiration columns are not enabled'))
7474

7575
await expect(
7676
create({ columns: [{ name: 'expires_at', type: 'ttl' }] } as TableSchema)
77-
).rejects.toThrow('TTL columns are not enabled')
77+
).rejects.toThrow('Expiration columns are not enabled')
7878
expect(dbChainMockFns.insert).not.toHaveBeenCalled()
7979
})
8080

apps/sim/lib/table/ttl-availability.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('table row TTL availability', () => {
2828

2929
await expect(assertTableRowTtlEnabled()).rejects.toMatchObject({
3030
code: 'validation',
31-
message: 'TTL columns are not enabled',
31+
message: 'Expiration columns are not enabled',
3232
})
3333
})
3434
})

apps/sim/lib/table/ttl-availability.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export function isTableRowTtlEnabled(): Promise<boolean> {
99
/** Rejects attempts to introduce a TTL column while the feature is disabled. */
1010
export async function assertTableRowTtlEnabled(): Promise<void> {
1111
if (await isTableRowTtlEnabled()) return
12-
throw new OrchestrationError('validation', 'TTL columns are not enabled')
12+
throw new OrchestrationError('validation', 'Expiration columns are not enabled')
1313
}

0 commit comments

Comments
 (0)