Skip to content

feat(pci-instances): format default instance name value#22148

Open
Tsiorifamonjena wants to merge 1 commit intofix/handle-instance-creation-multi-fixesfrom
feat/TAPC-4541
Open

feat(pci-instances): format default instance name value#22148
Tsiorifamonjena wants to merge 1 commit intofix/handle-instance-creation-multi-fixesfrom
feat/TAPC-4541

Conversation

@Tsiorifamonjena
Copy link
Contributor

Description

Ticket Reference: #TAPC-4541

Additional Information

@Tsiorifamonjena Tsiorifamonjena marked this pull request as ready for review February 6, 2026 16:50
@Tsiorifamonjena Tsiorifamonjena requested a review from a team as a code owner February 6, 2026 16:50
@github-actions github-actions bot added the feature New feature label Feb 6, 2026
const formMethods = useReactHookForm({
resolver: zodResolver(instanceCreationSchema),
defaultValues: {
name: nameDefaultValue,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove default value of name ?
What happen when the form loads for the first time ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because the default name will be handle on the Name component mounting now. The default value is build from flavor name. We cannot build it from there
When the form loads for the first time, if for any reason the api fail, fields will be empty and the button creation will be disabled


useEffect(() => {
if (ovhInstanceName) setValue('name', ovhInstanceName);
}, [ovhInstanceName, setValue]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I change the name and select a new model, the name reset, I think it might be the cause

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the buisness rules predicted it. (TAPC-4541: When user select an another flavor, prefilled name is updated.) I can reconfirmed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I thought it was a bug !

ref: #TAPC-4541

Signed-off-by: tsiorifamonjena <tsiorifamonjena.tianjanahary.ext@corp.ovh.com>
@@ -3,6 +3,8 @@ import { instanceNameRegex } from '@/constants';
describe('Instance creation', () => {
test('Should accept only strings and special characters like "-", "_" and "." with a maximum length of 255', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update the special characters list in the test description too ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants