mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
fix(mothership): fix hardcoded workflow color, tables drag line overflowing
This commit is contained in:
@@ -7,6 +7,7 @@ import { z } from 'zod'
|
||||
import { AuditAction, AuditResourceType, recordAudit } from '@/lib/audit/log'
|
||||
import { checkSessionOrInternalAuth } from '@/lib/auth/hybrid'
|
||||
import { generateRequestId } from '@/lib/core/utils/request'
|
||||
import { getNextWorkflowColor } from '@/lib/workflows/colors'
|
||||
import { getUserEntityPermissions, workspaceExists } from '@/lib/workspaces/permissions/utils'
|
||||
import { verifyWorkspaceMembership } from '@/app/api/workflows/utils'
|
||||
|
||||
@@ -16,7 +17,10 @@ const CreateWorkflowSchema = z.object({
|
||||
id: z.string().uuid().optional(),
|
||||
name: z.string().min(1, 'Name is required'),
|
||||
description: z.string().optional().default(''),
|
||||
color: z.string().optional().default('#3972F6'),
|
||||
color: z
|
||||
.string()
|
||||
.optional()
|
||||
.transform((c) => c || getNextWorkflowColor()),
|
||||
workspaceId: z.string().optional(),
|
||||
folderId: z.string().nullable().optional(),
|
||||
sortOrder: z.number().int().optional(),
|
||||
|
||||
@@ -1259,7 +1259,7 @@ export function Table({
|
||||
)}
|
||||
data-table-scroll
|
||||
>
|
||||
<div className='relative' style={{ width: `${tableWidth}px` }}>
|
||||
<div className='relative h-fit' style={{ width: `${tableWidth}px` }}>
|
||||
<table
|
||||
className='table-fixed border-separate border-spacing-0 text-[13px]'
|
||||
style={{ width: `${tableWidth}px` }}
|
||||
@@ -1386,9 +1386,6 @@ export function Table({
|
||||
</React.Fragment>
|
||||
)
|
||||
})}
|
||||
{userPermissions.canEdit && (
|
||||
<AddRowButton colSpan={columns.length + 2} onClick={handleAppendRow} />
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</tbody>
|
||||
@@ -1400,6 +1397,9 @@ export function Table({
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{!isLoadingTable && !isLoadingRows && userPermissions.canEdit && (
|
||||
<AddRowButton onClick={handleAppendRow} />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{editingRow && tableData && (
|
||||
@@ -2378,26 +2378,18 @@ const AddColumnButton = React.memo(function AddColumnButton({
|
||||
)
|
||||
})
|
||||
|
||||
const AddRowButton = React.memo(function AddRowButton({
|
||||
colSpan,
|
||||
onClick,
|
||||
}: {
|
||||
colSpan: number
|
||||
onClick: () => void
|
||||
}) {
|
||||
const AddRowButton = React.memo(function AddRowButton({ onClick }: { onClick: () => void }) {
|
||||
return (
|
||||
<tr>
|
||||
<td colSpan={colSpan} className='px-[8px] py-[7px]'>
|
||||
<button
|
||||
type='button'
|
||||
className='flex h-[20px] cursor-pointer items-center gap-[8px]'
|
||||
onClick={onClick}
|
||||
>
|
||||
<Plus className='h-[14px] w-[14px] shrink-0 text-[var(--text-icon)]' />
|
||||
<span className='font-medium text-[13px] text-[var(--text-body)]'>New row</span>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<div className='px-[8px] py-[7px]'>
|
||||
<button
|
||||
type='button'
|
||||
className='flex h-[20px] cursor-pointer items-center gap-[8px]'
|
||||
onClick={onClick}
|
||||
>
|
||||
<Plus className='h-[14px] w-[14px] shrink-0 text-[var(--text-icon)]' />
|
||||
<span className='font-medium text-[13px] text-[var(--text-body)]'>New row</span>
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { createLogger } from '@sim/logger'
|
||||
import { and, asc, eq, inArray, isNull, max } from 'drizzle-orm'
|
||||
import { NextResponse } from 'next/server'
|
||||
import { getSession } from '@/lib/auth'
|
||||
import { getNextWorkflowColor } from '@/lib/workflows/colors'
|
||||
import { buildDefaultWorkflowArtifacts } from '@/lib/workflows/defaults'
|
||||
import { saveWorkflowToNormalizedTables } from '@/lib/workflows/persistence/utils'
|
||||
import type { PermissionType } from '@/lib/workspaces/permissions/utils'
|
||||
@@ -346,7 +347,7 @@ export async function createWorkflowRecord(params: CreateWorkflowInput) {
|
||||
workspaceId,
|
||||
name,
|
||||
description = null,
|
||||
color = '#7F2FFF',
|
||||
color = getNextWorkflowColor(),
|
||||
folderId = null,
|
||||
} = params
|
||||
const workflowId = crypto.randomUUID()
|
||||
|
||||
Reference in New Issue
Block a user