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
25 changes: 25 additions & 0 deletions src/components/Catalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,31 @@ export default function ({
}, [workload, values])

const handleCreateUpdateWorkload = async () => {
/** this is very temporary solution to add max character limit to workloads
*
* REMOVE THIS WHEN MIGRATING TO THE NEW UI
*/
const input = document.getElementById('root_name').parentElement as HTMLInputElement | null
if (input) {
input.style.border = ''
const oldErr = document.getElementById('root-name-error')
if (oldErr) oldErr.remove()
}

if ((data.name || '').length > 16) {
if (input) {
input.style.border = '1px solid red'
const err = document.createElement('p')
err.id = 'root-name-error'
err.textContent = `Workload name cannot be longer than 16 characters`
err.style.color = 'red'
err.style.fontSize = '12px'
input.parentNode.insertBefore(err, input.nextSibling)
}
window.scrollTo({ top: 0, behavior: 'smooth' })
return
}

const workloadBody = omit(data, ['chartProvider', 'chart', 'revision', 'values'])
const chartMetadata = omit(data?.chartMetadata, ['helmChartCatalog', 'helmChart'])
const path = workload?.path
Expand Down
4 changes: 2 additions & 2 deletions src/pages/teams/create-edit/create-edit-teams.validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export const createTeamApiResponseSchema = yup.object({
name: yup
.string()
.required('Team name is required')
.max(30, 'Team name must be at most 30 characters')
.matches(/^[^A-Z]*$/, 'Team name cannot contain capital letters'),
.max(10, 'Team name must be at most 10 characters')
.matches(/^[^A-Z_]*$/, 'Team name cannot contain capital letters or underscores'),
oidc: yup
.object({
groupMapping: yup.string().optional().default(undefined),
Expand Down