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

feat: implement deployments list table in infra monitoring #6620

Open
wants to merge 15 commits into
base: feat/infra-monitoring-k8s
Choose a base branch
from

Conversation

amlannandy
Copy link
Member

@amlannandy amlannandy commented Dec 12, 2024

Summary

Implement the deployments list table in Infra Monitoring

Related Issues / PR's

N/A

Screenshots

N/A

Affected Areas and Manually Tested Areas

Infra Monitoring section


Important

Implement Kubernetes deployments list feature in Infra Monitoring with new API, component, and utilities.

  • API:
    • Add getK8sDeploymentsList in getK8sDeploymentsList.ts to fetch Kubernetes deployments.
    • Define interfaces K8sDeploymentsListPayload, K8sDeploymentsData, and K8sDeploymentsListResponse.
  • Components:
    • Add K8sDeploymentsList component in K8sDeploymentsList.tsx for displaying deployments with pagination, sorting, and filtering.
    • Implement useGetK8sDeploymentsList hook in useGetK8sDeploymentsList.ts for data fetching.
  • Utilities:
    • Add utility functions in utils.tsx for data formatting and table column definitions.
    • Update InfraMonitoringK8s.tsx to include K8sDeploymentsList component.
  • Misc:
    • Update constants.ts to include deployment-related quick filters.

This description was created by Ellipsis for 6b1f3da. It will automatically update as commits are pushed.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions github-actions bot added the enhancement New feature or request label Dec 12, 2024
@amlannandy amlannandy force-pushed the feat/infra-monitoring-k8s-nodes branch 4 times, most recently from 26a6959 to b5d57e1 Compare December 19, 2024 12:44
@amlannandy amlannandy force-pushed the feat/infra-monitoring-k8s-deployments branch from df663a6 to 0dd674b Compare December 22, 2024 13:38
@amlannandy amlannandy changed the base branch from feat/infra-monitoring-k8s-nodes to feat/infra-monitoring-k8s December 22, 2024 13:39
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@amlannandy amlannandy marked this pull request as ready for review December 23, 2024 06:19
@amlannandy amlannandy requested a review from YounixM as a code owner December 23, 2024 06:19
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to 1798c04 in 1 minute and 54 seconds

More details
  • Looked at 1222 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. frontend/src/api/infraMonitoring/getK8sDeploymentsList.ts:55
  • Draft comment:
    Consider checking the response status code to ensure it is 200 before returning a success response. This will help in correctly identifying non-200 responses as errors.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
  1. Axios automatically throws for non-200 responses. 2. Those errors are caught and handled by ErrorResponseHandler. 3. If we reach line 60, we definitely have a successful response. 4. Adding an extra status code check would be redundant. 5. The comment shows a misunderstanding of how Axios works.
    Maybe there's an edge case where we want to handle certain non-200 status codes differently? Maybe ErrorResponseHandler isn't comprehensive enough?
    The ErrorResponseHandler is a centralized error handling utility, and if special handling is needed, it should be implemented there, not in individual API calls. This maintains consistency across the codebase.
    The comment should be deleted as it suggests unnecessary code due to misunderstanding Axios behavior, and proper error handling is already in place.
2. frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.tsx:215
  • Draft comment:
    Add fetchGroupedByRowDataQuery to the dependency array of this useEffect to ensure it refetches data when the query changes.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The useEffect is already correctly set up. fetchGroupedByRowData is a refetch function from useGetK8sDeploymentsList that already has access to the latest query through its closure. The query itself is passed as part of the hook configuration. Adding fetchGroupedByRowDataQuery to the deps array would be redundant since selectedRowData (which is already in deps) drives the query changes.
    Could there be edge cases where the query changes but selectedRowData doesn't, requiring a refetch? For example, when minTime/maxTime change?
    No - in this case, the useGetK8sDeploymentsList hook will automatically refetch when its query changes, without needing the useEffect to trigger it. The useEffect is only needed to trigger the initial fetch when selectedRowData changes.
    The comment should be deleted. The current dependency array is correct, and adding fetchGroupedByRowDataQuery would be redundant since the query updates are already handled properly by the React Query hook.
3. frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.tsx:233
  • Draft comment:
    Consider resetting the current page to 1 when the sorting changes to ensure the user sees the first page of sorted results.
  • Reason this comment was not posted:
    Marked as duplicate.
4. frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.tsx:416
  • Draft comment:
    Consider resetting the current page to 1 when the group by attribute changes to ensure the user sees the first page of grouped results.
  • Reason this comment was not posted:
    Marked as duplicate.
5. frontend/src/container/InfraMonitoringK8s/K8sHeader.tsx:132
  • Draft comment:
    Avoid using inline styles in React components. Instead, use external stylesheets, CSS classes, or styled components. This is also applicable in other parts of the code where inline styles are used.
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.
6. frontend/src/container/InfraMonitoringK8s/Deployments/utils.tsx:253
  • Draft comment:
    This is duplicate functionality. Consider using this new function to replace the inline color logic in the referenced locations to reduce code duplication.

  • CPU color threshold logic (HostMetricsDetails.tsx)

  • CPU color threshold logic (utils.tsx)

  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_Z0uLpuvoOV1HpaRJ


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

return options.queryKey;
}

return [REACT_QUERY_KEY.GET_HOST_LIST, requestData];
Copy link
Contributor

Choose a reason for hiding this comment

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

The default query key REACT_QUERY_KEY.GET_HOST_LIST seems incorrect for deployments. Consider using a more specific key for deployments.

return (
<div className="pod-group">
{groupByValues.map((value) => (
<Tag key={value} color="#1D212D" className="pod-group-tag-item">
Copy link
Contributor

Choose a reason for hiding this comment

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

Use design tokens or predefined color constants instead of hardcoding color values like #1D212D for consistency in design and theming. This is also applicable in other parts of the code where colors are hardcoded.

@amlannandy amlannandy force-pushed the feat/infra-monitoring-k8s-deployments branch from 1798c04 to 0ec6a59 Compare December 24, 2024 14:13
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on 0ec6a59 in 1 minute and 19 seconds

More details
  • Looked at 834 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. frontend/src/container/InfraMonitoringK8s/Deployments/utils.tsx:94
  • Draft comment:
    Avoid using inline styles for column headers. Use external stylesheets, CSS classes, or styled components instead. This is also applicable in frontend/src/container/InfraMonitoringK8s/utils.tsx.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
2. frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.tsx:39
  • Draft comment:
    Avoid using the component/index.tsx file structure approach. It makes it difficult to debug and find components using global search tools like VS Code.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_xUol4lJIMHBLvqpt


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

containerRestarts: number;
clusterName: string;
namespaceName: string;
groupedByMeta?: any;
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider replacing any with a more specific type for groupedByMeta to ensure type safety.

return (
<div className="pod-group">
{groupByValues.map((value) => (
<Tag key={value} color="#1D212D" className="pod-group-tag-item">
Copy link
Contributor

Choose a reason for hiding this comment

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

Use design tokens or predefined color constants instead of hardcoding color values for the Tag component. This is also applicable in frontend/src/container/InfraMonitoringK8s/utils.tsx.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 6b1f3da in 33 seconds

More details
  • Looked at 415 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. frontend/src/container/InfraMonitoringK8s/Deployments/utils.tsx:99
  • Draft comment:
    Consider changing the type of clusterName and namespaceName to React.ReactNode for consistency, as other fields are typed as React.ReactNode.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of React.ReactNode for fields like deploymentName, availableReplicas, etc., in K8sDeploymentsRowData is appropriate since these fields are rendered as JSX elements. However, the clusterName and namespaceName fields are still typed as string, which might be inconsistent if they are also rendered as JSX elements.
2. frontend/src/container/InfraMonitoringK8s/Deployments/utils.tsx:378
  • Draft comment:
    Consider wrapping clusterName and namespaceName with ValidateColumnValueWrapper to handle potential null or undefined values consistently.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The formatDataForTable function uses ValidateColumnValueWrapper for several fields, which is a good practice for handling potential null or undefined values. However, the clusterName and namespaceName fields are not wrapped, which might lead to inconsistencies if they can also be null or undefined.
3. frontend/src/container/InfraMonitoringK8s/Deployments/utils.tsx:305
  • Draft comment:
    Avoid using inline styles for the progress bar. Instead, use external stylesheets, CSS classes, or styled components. This is also applicable in other parts of the code where inline styles are used.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_JycQmKxarlUvPjwr


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant