Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implementated if tls need to be enabled or not while creating or #113

Merged
merged 1 commit into from
Mar 4, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { NameIdView } from '~/console/components/name-id-view';
import Select from '~/components/atoms/select';
import useCustomSwr from '~/root/lib/client/hooks/use-custom-swr';
import { useAppend, useMapper } from '~/components/utils';
import { Checkbox } from '~/components/atoms/checkbox';
import { IAppContext } from '../app+/$app+/_layout';

type IDialog = IDialogBase<ExtractNodeType<IRouters>>;
Expand Down Expand Up @@ -49,12 +50,14 @@ const Root = (props: IDialog) => {
displayName: props.data.displayName,
domains: [],
isNameError: false,
isTlsEnabled: props.data.spec.https?.enabled || false,
}
: {
name: '',
displayName: '',
domains: [],
isNameError: false,
isTlsEnabled: false,
},
validationSchema: Yup.object({
displayName: Yup.string().required(),
Expand All @@ -81,7 +84,7 @@ const Root = (props: IDialog) => {
spec: {
domains: val.domains,
https: {
enabled: true,
enabled: val.isTlsEnabled,
Copy link

Choose a reason for hiding this comment

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

issue (llm): I noticed the implementation for toggling TLS has been added, but I don't see any unit tests covering this new logic. It's crucial to ensure that when isTlsEnabled is both true and false, the expected behavior is correctly implemented. Could you add tests to verify that the https configuration is correctly updated based on the isTlsEnabled state?

Copy link

Choose a reason for hiding this comment

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

issue (llm): Similar to my previous comment, the update logic for TLS enabling/disabling also lacks test coverage. Ensuring that existing routers correctly update their https configuration based on the new isTlsEnabled flag is essential for maintaining functionality and avoiding regressions. Please add integration or unit tests covering this scenario.

},
},
},
Expand All @@ -103,7 +106,7 @@ const Root = (props: IDialog) => {
...props.data.spec,
domains: val.domains,
https: {
enabled: true,
enabled: val.isTlsEnabled,
},
},
},
Expand Down Expand Up @@ -198,6 +201,13 @@ const Root = (props: IDialog) => {
loading={domainLoading}
disableWhileLoading
/>
<Checkbox
Copy link

Choose a reason for hiding this comment

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

suggestion (llm): It's great to see the UI component for toggling TLS being added. However, it would be beneficial to include end-to-end tests that simulate user interaction with this checkbox and verify that the TLS setting is correctly applied upon router creation or update. This would ensure the feature works as expected from a user's perspective.

label="enable TLS"
checked={values.isTlsEnabled}
onChange={(val) => {
handleChange('isTlsEnabled')(dummyEvent(val));
}}
/>
</Popup.Content>
<Popup.Footer>
<Popup.Button content="Cancel" variant="basic" closable />
Expand Down
Loading