lablup / lablup/backend.ai-webui

Deployment preset name accepts whitespace, making the preset undeletable

Open Beginner friendly
#9,671 0 comments 0 reactions 0 assignees View on GitHub
bug quick-capture
Dominant language
TypeScript
Stars
133
Forks
81
Avg merge
1d 11h
Merged PRs (30d)
344

Description

## Problem

The Deployment Preset create/edit form accepts a name containing whitespace, e.g. `" vLLM-nemotron-3-nano-B200"` (leading space), and saves it as-is.

This breaks deletion: `BAIDeleteConfirmModal` requires the user to type the preset name, and compares it with strict equality. The leading space is invisible in the confirmation prompt (HTML collapses it), so the typed text never matches and the Delete button stays disabled. The preset cannot be deleted through the UI.

## Where

- `react/src/components/AdminDeploymentPresetSettingPageContent.tsx` — the `name` `BAIFormItem` only has a `required: true` rule.
- `packages/backend.ai-ui/src/components/BAIDeleteConfirmModal.tsx:276` — the strict-equality gate where the bug surfaces (works as designed).

## Proposed fix

Disallow whitespace anywhere in the name with a `pattern` rule on the `name` field:

```
rules={[
{ required: true, message: t('adminDeploymentPreset.NameRequired') },
{ pattern: /^\S+$/, message: t('adminDeploymentPreset.NameCannotContainWhitespace') },
]}
```

- `whitespace: true` is not enough: it only rejects a value made entirely of whitespace, so `" vLLM-…"` still passes.
- The same `pattern` rule style is already used in other forms (`ResourcePresetSettingModal.tsx`, `EditableVFolderNameV2.tsx`).
- Add the new i18n message key.

## Impact

At least one existing preset (`" vLLM-nemotron-3-nano-B200"`) is stuck and cannot be deleted from the UI until renamed. Existing presets whose names already contain whitespace will fail the new rule when edited, so they must be renamed on their next save.

Captured while working on branch: main

JIRA Issue: FR-3938

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in react/src/components/AdminDeploymentPresetSettingPageContent.tsx and compare its name BAIFormItem with the pattern rules in ResourcePresetSettingModal.tsx and EditableVFolderNameV2.tsx. Review the i18n messages used by this form and the strict-equality gate in packages/backend.ai-ui/src/components/BAIDeleteConfirmModal.tsx:276. Done means whitespace-containing names are rejected with the new message while valid names continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.