Skip to content

Commit

Permalink
add character limit for pipeline run name
Browse files Browse the repository at this point in the history
  • Loading branch information
ppadti committed Jun 5, 2024
1 parent 2b19ddb commit 2ac835b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frontend/src/concepts/k8s/NameDescriptionField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type NameDescriptionFieldProps = {
autoFocusName?: boolean;
showK8sName?: boolean;
disableK8sName?: boolean;
maxLength?: number;
};

const NameDescriptionField: React.FC<NameDescriptionFieldProps> = ({
Expand All @@ -32,6 +33,7 @@ const NameDescriptionField: React.FC<NameDescriptionFieldProps> = ({
autoFocusName,
showK8sName,
disableK8sName,
maxLength,
}) => {
const autoSelectNameRef = React.useRef<HTMLInputElement | null>(null);

Expand Down Expand Up @@ -61,7 +63,13 @@ const NameDescriptionField: React.FC<NameDescriptionFieldProps> = ({
name={nameFieldId}
value={data.name}
onChange={(e, name) => setData({ ...data, name })}
maxLength={maxLength}
/>
{maxLength && (
<HelperText>
<HelperTextItem>{`Cannot exceed ${maxLength} characters`}</HelperTextItem>
</HelperText>
)}
</FormGroup>
</StackItem>
{showK8sName && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const RunForm: React.FC<RunFormProps> = ({ data, runType, onValueChange }) => {
descriptionFieldId="run-description"
data={data.nameDesc}
setData={(nameDesc) => onValueChange('nameDesc', nameDesc)}
maxLength={255}
/>

{isSchedule && data.runType.type === RunTypeOption.SCHEDULED && (
Expand Down

0 comments on commit 2ac835b

Please sign in to comment.