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: add operate log #2623

Merged
merged 1 commit into from
Mar 19, 2025
Merged

feat: add operate log #2623

merged 1 commit into from
Mar 19, 2025

Conversation

shaohuzhang1
Copy link
Contributor

feat: add operate log

Copy link

f2c-ci-robot bot commented Mar 19, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

f2c-ci-robot bot commented Mar 19, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@XiaJunjie2020 XiaJunjie2020 merged commit bcd41d0 into main Mar 19, 2025
1 of 2 checks passed
@XiaJunjie2020 XiaJunjie2020 deleted the pr@main@feat_log branch March 19, 2025 09:03
@@ -211,7 +211,7 @@ function changeFilterHandle(val: string) {
function changeDayHandle(val: number | string) {
if (val !== 'other') {
daterange.value.start_time = beforeDay(val)
daterange.value.end_time = nowDate
daterange.value.end_time = ''
getList()
}
}
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 provided code is mostly correct, but there's one small issue that could be improved:

function changeDayHandle(val: number | string) {
  if (val !== 'other') {
    daterange.value.start_time = beforeDay(val);
    // Avoid an error when using `beforeDay` on 'other'
    daterange.value.end_time = typeof val === 'number' ? '' : nowDate;
    getList();
  }
}

Explanation of changes:

  1. Added a type check (typeof) to ensure that the value used in nowDate is a number before performing arithmetic with it, which prevents any errors. If val is not a number ('unknown'), the end time will remain unchanged instead of being set to undefined (undefined), which can lead to unintended behavior.

If you have more specific requirements or optimizations needed for this function, please clarify!

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.

2 participants