-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: The file list does not display hidden files by default #8943
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
Conversation
|
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. DetailsInstructions 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. |
| margin-left: 10px; | ||
| .close { | ||
| width: 10px; | ||
| .close-icon { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
Differences and Suggestions
-
Template Changes
- Changed
class="hidden sm:block"toclass="hidden sm:w-min w-full sm:block"on both path-related divs.
- Changed
-
Dropdown Icon Positioning
- Removed unnecessary
sm:!inline-block !flex flex-wrap gap-y-2from the button group within the dropdown menu of directories listing.
- Removed unnecessary
-
Tooltip Content Localization
- Used
$t('file.showHide')and$t('file.noShowHide')for tooltip content instead of hardcoded texts. This ensures localization capabilities across different languages supported by your application.
- Used
-
View/Hide Button Logic Optimization
- Added a function
viewHideFilethat toggles theisHiddenstate and re-fetches the search results accordingly.
- Added a function
-
Styling Adjustments
- Suggested adjusting CSS classes like
.copy-button,.close,.icon-smfor better styling consistency, but these might be up-to-date or specific styles not mentioned here.
- Suggested adjusting CSS classes like
Summary
The reviewed code primarily focuses on improving template structure, localized tooltips, and optimized view/hide functionality without introducing significant new bugs. The changes ensure alignment with best practices, such as using Vue 3 Composition API hooks and ensuring accessibility through proper layout adjustments.
| > | ||
| <template v-for="(item, index) in imageFiles" :key="index"> | ||
| <el-tooltip :content="item.path" placement="right"> | ||
| <div |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The provided code snippet contains several inconsistencies and potential improvements:
-
Missing
v-binddirective: Replace=with colon (:) to properly bind attributes in Vue templates. -
Unnecessary condition inside template: The conditional statement
v-if="imageFiles.length > 1"is redundant because the outer<aside>element already includes this condition in its own attribute. -
Incorrect indentation: The nested
<el-tooltip>tag should have proper indentation relative to the parent tags. -
Potential memory leak if no files exist: Ensure that when
imageFilesbecomes empty, the component cleans up any related state or events.
Optimization suggestions:
- Consider using computed properties for filtering or transforming data if necessary.
- Use destructuring to avoid repeated property access.
- Add event listeners only when needed.
Here's the refactored version of the code with these considerations applied:
<template>
<div class="flex h-full">
<aside
:class="'w-[200px] overflow-y-auto p-2 sm:block hidden left-aside rounded'"
v-if="imageFiles.length && imageFiles.length > 1"
>
<el-tooltip v-for="(item, index) in filteredImageFiles" :key="index" :content="item.path" placement="right">
<div class="">
<!-- Tooltip content -->
</div>
</el-tooltip>
</aside>
</div>
</template>
<script>
export default {
data() {
return {
imageFiles: [] // Example data
};
},
computed: {
filteredImageFiles() {
return this.imageFiles.filter(file => file.type === 'image'); // Filter images
}
}
};
</script>This version addresses the issues and enhances readability while maintaining functionality.
| return len(base) > 1 && base[0] == dotCharacter | ||
| } | ||
|
|
||
| func countLines(path string) (int, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The
IsHiddenfunction should consider the full path to determine if it's hidden across various file systems. - Ensure that
filepath.Base(path)returns the base name of the path instead of just a relative substring.
|
wanghe-fit2cloud
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
|
/approve |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |



Refs: #5702