Skip to content

Conversation

@mathieumousnier
Copy link
Contributor

Description

Ticket Reference: #MANAGER-17868

Additional Information

@github-actions github-actions bot added has conflicts Has conflicts to resolve before merging translation required container feature New feature and removed has conflicts Has conflicts to resolve before merging labels Oct 2, 2025
@mathieumousnier mathieumousnier changed the base branch from develop to project/secret-manager-b2 October 2, 2025 13:56
@github-actions github-actions bot added the has conflicts Has conflicts to resolve before merging label Oct 2, 2025
@github-actions github-actions bot removed container has conflicts Has conflicts to resolve before merging labels Oct 2, 2025
@mathieumousnier mathieumousnier marked this pull request as ready for review October 2, 2025 14:10
@mathieumousnier mathieumousnier requested a review from a team as a code owner October 2, 2025 14:10
@mathieumousnier mathieumousnier requested review from rjamet-ovh and removed request for a team October 2, 2025 14:10
@mathieumousnier mathieumousnier changed the title featokms): edit settings drawer feat(okms): edit settings drawer Oct 2, 2025
ref: #MANAGER-17868

Signed-off-by: Mathieu Mousnier <[email protected]>
ref: #MANAGER-17868

Signed-off-by: Mathieu Mousnier <[email protected]>
Comment on lines 29 to 35
<label htmlFor={field.name} slot="label" className="mb-1"></label>
<label slot="label" className="flex items-center gap-2 relative mb-1">
{t('deactivate_version_after')}
<HelpIconWithTooltip
label={t('form_tooltip_deactivate_version_after')}
/>
</label>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why htmlFor is necessary and not put it in child space ?

It's not strange to have 2 labels collapsed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. The empty label tag is some forgotten code.

Comment on lines +82 to +92
export const casRequiredToFormValue = (
casRequired: boolean,
): CasRequiredFormValue => {
return casRequired ? 'active' : 'inactive';
};

export const formValueToCasRequired = (
formValue: CasRequiredFormValue,
): boolean => {
return formValue === 'active';
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe to move in a utils file ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see you point, but these utility functions are purely related to the component and shouldn't be used if it is not while using the component.
When we are in this configuration I prefer to colocate the code.

};

return (
<div className="flex flex-col h-full">
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a section ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the drawer component already implements header, section and footer tags

Comment on lines 1 to 12
type QueryStringValue = string | number | boolean | undefined | null;

export const buildQueryString = (params: Record<string, QueryStringValue>) => {
const queryParams = new URLSearchParams();
Object.entries(params).forEach(([key, value]) => {
if (value !== undefined && value !== null) {
queryParams.set(key, String(value));
}
});
const queryString = queryParams.toString();
return queryString ? `?${queryString}` : null;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

May be a little unit test on it can be useful 👌

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done ✅

Comment on lines +9 to +18
export const addCurrentVersionToCas = (
currentVersion: number,
casRequired: boolean,
isSettingCasRequired?: boolean,
) => {
if (isSettingCasRequired || casRequired) {
return currentVersion;
}
return undefined;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

As it's a very little function. I think a unit test can be quick to do and useful if you want implement refactor on future

Comment on lines 67 to 118
describe('deactivateVersionAfter field validation', () => {
it('should return error for invalid duration format', () => {
const invalidMetadata = {
...MOCK_METADATA_VALID,
deactivateVersionAfter: 'invalid-duration',
};
const result = getSchemaParsingResult(invalidMetadata);
expect(result.success).toBe(false);
expect(result.error.issues[0].path).toEqual(['deactivateVersionAfter']);
expect(result.error.issues[0].message).toBe(
labels.secretManager.error_invalid_duration,
);
});

it('should return error for duration with invalid units', () => {
const invalidMetadata = {
...MOCK_METADATA_VALID,
deactivateVersionAfter: '30x',
};
const result = getSchemaParsingResult(invalidMetadata);
expect(result.success).toBe(false);
expect(result.error.issues[0].path).toEqual(['deactivateVersionAfter']);
expect(result.error.issues[0].message).toBe(
labels.secretManager.error_invalid_duration,
);
});

it('should return error for duration with no unit', () => {
const invalidMetadata = {
...MOCK_METADATA_VALID,
deactivateVersionAfter: '30',
};
const result = getSchemaParsingResult(invalidMetadata);
expect(result.success).toBe(false);
expect(result.error.issues[0].path).toEqual(['deactivateVersionAfter']);
expect(result.error.issues[0].message).toBe(
labels.secretManager.error_invalid_duration,
);
});

it('should return error for empty string', () => {
const invalidMetadata = {
...MOCK_METADATA_VALID,
deactivateVersionAfter: '',
};
const result = getSchemaParsingResult(invalidMetadata);
expect(result.success).toBe(false);
expect(result.error.issues[0].path).toEqual(['deactivateVersionAfter']);
expect(result.error.issues[0].message).toBe(
labels.secretManager.error_invalid_duration,
);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

May be you can reduce it with a it.each if you want

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done ✅

import { NAMESPACES } from '@ovh-ux/manager-common-translations';

export const MAX_VERSIONS_MIN_VALUE = 0;
export const MAX_VERSIONS_MAX_VALUE = 24000;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export const MAX_VERSIONS_MAX_VALUE = 24000;
export const MAX_VERSIONS_MAX_VALUE = 24_000;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done ✅

Copy link
Contributor

@tibs245 tibs245 left a comment

Choose a reason for hiding this comment

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

I think you can see If you want apply some suggestion. I think have 2 labels it's may be not the best for accessibility.

But else all is ok 👌

ref: #MANAGER-17868

Signed-off-by: Mathieu Mousnier <[email protected]>
@mathieumousnier mathieumousnier merged commit 1b03bc0 into project/secret-manager-b2 Oct 7, 2025
15 checks passed
@mathieumousnier mathieumousnier deleted the feat/MANAGER-17868 branch October 7, 2025 13:41
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.

5 participants