Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

What this PR does / why we need it?

Summary of your change

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Oct 28, 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-sigs/prow repository.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Oct 28, 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

}
const select = (val: any[], active: any) => {
if (active.resource_type === 'folder') {
if (!val.some((item) => item.id == active.id)) {
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 code looks mostly correct, but there are a few minor improvements and suggestions:

  1. Suggested Changes:

    • Replace the @select-all event with a more conventional name like onSelectAll. ThisChangeEvent makes it clear what this method does.
  2. Optimization Suggestions:

    • Use nextTick() before modifying data in lifecycle hooks that depend on DOM rendering to ensure all changes have been applied. In your selectAll method, you can add await nextTick() after setting multipleSelection.

Here's how the updated code could look:

<template>
  <div>
    <!-- Component template remains unchanged -->
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted, computed, nextTick } from 'vue' // Use import statement instead of require
import { useRoute } from 'vue-router'
import type { Provider } from '@/api/type/model'
import { SourceTypeEnum } from '@/enums/common'

// Existing code logic remains intact

const filteredData = computed(() => {
  return data.filter(item => !showTrash || item.is_trash !== true);
});

const multipleSelection = ref<any[]>([]);
const selectObj: any = {};
// Update onSelectAll event handler
const onSelectAll = (selection: any[]) => {
  await nextTick(); // Ensure DOM updates
  multipleSelection.value = selection;
};
// Updated select function
const select = (val: any[], active: any) => {
  if (active.resource_type === 'folder') {
    if (!val.some((item) => item.id == active.id)) {
      val.push(active);
    }
  } else {
    if (!val.includes(active.row)) { // Corrected comparison logic
      val.push(Object.assign({}, active));
      
    }

// ... Rest of the update ...

These changes should make the code cleaner and potentially enhance performance depending on the complexity of your application.

@shaohuzhang1 shaohuzhang1 merged commit 871e810 into v2 Oct 28, 2025
3 of 5 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@v2@fix_resource_auth branch October 28, 2025 03:29
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