Skip to content

Conversation

@ssongliu
Copy link
Member

@ssongliu ssongliu commented Jun 5, 2025

Refs #8917
Refs #8924
Refs #8897

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Jun 5, 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.

Details

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-sigs/prow repository.

i++
}
return data, nil
}
Copy link
Member

Choose a reason for hiding this comment

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

There is an issue in the LoadSnapshotData function where the labels "app" and "system_snapshot" are removed from the list, but there's no corresponding logic to replace these with valid options if they exist. The loadPanelFile function has issues related to handling different types of items ('clamav', 'download', 'resource') differently compared to others ('apps', 'backup', 'log', 'db', 'tmp'). Additionally, the loadFile function does not handle directories correctly since it doesn't add them as children nodes when appropriate. Finally, the use of variable names can be improved for clarity.

if !req.WithLoginLog && global.IsMaster {
err = snap.snapCoreDB.Exec("DELETE FROM login_logs").Error
snap.Task.LogWithStatus(i18n.GetMsgByKey("SnapDeleteLoginLog"), err)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

There are no significant issues with the provided code snippet. The changes made to handle deletion of operation_logs and login_logs when requested depend on whether they are enabled (WithOperationLog) and if it's a master server (global.IsMaster). This structure enhances code clarity and ensures that the necessary operations are performed only under specific conditions. However, since these operations involve potentially deleting sensitive data, careful consideration should be given to how this logic is implemented in a production environment. If error handling can be moved elsewhere more efficiently without repeating, further optimizations may be beneficial, but overall, the current implementation seems well-structured.

<el-button type="primary" v-if="nowIndex === 4" :disabled="loading" @click="submitAddSnapshot">
{{ $t('commons.button.create') }}
</el-button>
<el-button @click="next" v-else>{{ $t('commons.button.next') }}</el-button>
Copy link
Member

Choose a reason for hiding this comment

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

In the provided code snippet, there is an issue with the button label that appears after the fourth step of the process (index 4). The button is intended to show "Create Snapshot", but it incorrectly has type="primary" applied when you are on the last step instead. This can be confusing for users.

To fix this problem and ensure consistency across all steps, you should change v-if="nowIndex === 4" to use :disabled instead, so that the button remains enabled throughout all steps except the final one where only the "Next" button would appear:

<el-button type="primary" v-if="nowIndex < 3" @click="submitAddSnapshot"> 

This modification ensures that the "Create Snapshot" button is disabled on the fifth step (nowIndex === 4), maintaining proper functionality and user interface.

Additionally, it's a good practice to avoid having conditional classes if they can be handled using conditional rendering directly in Vue components, rather than trying to force them into different types based on conditions.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 5, 2025

Copy link
Member

@wanghe-fit2cloud wanghe-fit2cloud left a comment

Choose a reason for hiding this comment

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

/lgtm

@wanghe-fit2cloud
Copy link
Member

/approve

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Jun 5, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wanghe-fit2cloud

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

The pull request process is described here

Details 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

@f2c-ci-robot f2c-ci-robot bot added the approved label Jun 5, 2025
@f2c-ci-robot f2c-ci-robot bot merged commit 2ae5c9f into dev-v2 Jun 5, 2025
7 checks passed
@f2c-ci-robot f2c-ci-robot bot deleted the pr@dev-v2@fix_snapshot branch June 5, 2025 08:20
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.

4 participants