-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| <template> | ||
| <div> | ||
| <div class="flex gap-y-2 items-center gap-x-4" ref="toolRef"> | ||
| <div class="flex-shrink-0 flex items-center justify-between"> | ||
| <div class="flex sm:flex-row flex-col justify-start gap-y-2 items-center gap-x-4" ref="toolRef"> | ||
| <div class="flex-shrink-0 flex sm:w-min w-full items-center justify-start"> | ||
| <el-tooltip :content="$t('file.back')" placement="top"> | ||
| <el-button icon="Back" @click="back" circle /> | ||
| </el-tooltip> | ||
|
|
@@ -14,8 +14,11 @@ | |
| <el-tooltip :content="$t('commons.button.refresh')" placement="top"> | ||
| <el-button icon="Refresh" circle @click="search" /> | ||
| </el-tooltip> | ||
| <el-tooltip :content="isHidden ? $t('file.showHide') : $t('file.noShowHide')" placement="top"> | ||
| <el-button class="btn" circle :icon="isHidden ? Hide : View" @click="viewHideFile" /> | ||
| </el-tooltip> | ||
| </div> | ||
| <div class="flex-1 hidden sm:block" ref="pathRef"> | ||
| <div class="flex-1 sm:w-min w-full hidden sm:block" ref="pathRef"> | ||
| <div | ||
| v-show="!searchableStatus" | ||
| @click="searchableStatus = true" | ||
|
|
@@ -94,7 +97,7 @@ | |
| " | ||
| /> | ||
| </div> | ||
| <div class="flex-1 sm:hidden block"> | ||
| <div class="flex-1 sm:w-min w-full sm:hidden block"> | ||
| <div class="address-bar shadow-md rounded-md px-4 py-2 flex items-center flex-grow"> | ||
| <div class="flex items-center address-url"> | ||
| <span class="root mr-2"> | ||
|
|
@@ -197,8 +200,8 @@ | |
| </el-dropdown-menu> | ||
| </template> | ||
| </el-dropdown> | ||
| <el-button-group> | ||
| <el-button class="btn mr-2.5" @click="openRecycleBin"> | ||
| <el-button-group class="sm:!inline-block !flex flex-wrap gap-y-2"> | ||
| <el-button class="btn" @click="openRecycleBin"> | ||
| {{ $t('file.recycleBin') }} | ||
| </el-button> | ||
| <el-button class="btn" @click="toTerminal"> | ||
|
|
@@ -551,7 +554,7 @@ import { MsgWarning } from '@/utils/message'; | |
| import { useSearchable } from './hooks/searchable'; | ||
| import { ResultData } from '@/api/interface'; | ||
| import { GlobalStore } from '@/store'; | ||
| import { Download as ElDownload, Upload as ElUpload } from '@element-plus/icons-vue'; | ||
| import { Download as ElDownload, Upload as ElUpload, View, Hide } from '@element-plus/icons-vue'; | ||
|
|
||
| import i18n from '@/lang'; | ||
| import CreateFile from './create/index.vue'; | ||
|
|
@@ -654,6 +657,7 @@ const calculateBtn = ref(false); | |
| const dirNum = ref(0); | ||
| const fileNum = ref(0); | ||
| const imageFiles = ref([]); | ||
| const isHidden = ref(true); | ||
|
|
||
| const { searchableStatus, searchablePath, searchableInputRef, searchableInputBlur } = useSearchable(paths); | ||
|
|
||
|
|
@@ -701,12 +705,22 @@ const searchFile = async () => { | |
|
|
||
| const handleSearchResult = (res: ResultData<File.File>) => { | ||
| paginationConfig.total = res.data.itemTotal; | ||
| data.value = res.data.items; | ||
| if (isHidden.value) { | ||
| data.value = res.data.items.filter((item) => !item.isHidden); | ||
| } else { | ||
| data.value = res.data.items; | ||
| } | ||
| dirNum.value = data.value.filter((item) => item.isDir).length; | ||
| fileNum.value = data.value.filter((item) => !item.isDir).length; | ||
| req.path = res.data.path; | ||
| }; | ||
|
|
||
| const viewHideFile = async () => { | ||
| isHidden.value = !isHidden.value; | ||
| let searchResult = await searchFile(); | ||
| handleSearchResult(searchResult); | ||
| }; | ||
|
|
||
| const open = async (row: File.File) => { | ||
| calculateBtn.value = false; | ||
| disableBtn.value = false; | ||
|
|
@@ -1446,7 +1460,6 @@ onBeforeUnmount(() => { | |
| } | ||
|
|
||
| .copy-button { | ||
| margin-left: 10px; | ||
| .close { | ||
| width: 10px; | ||
| .close-icon { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code ReviewDifferences and Suggestions
SummaryThe 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. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,10 @@ | |
| > | ||
| <template v-if="fileType === 'image'"> | ||
| <div class="flex h-full"> | ||
| <aside class="w-[200px] overflow-y-auto p-2 sm:block hidden left-aside rounded"> | ||
| <aside | ||
| class="w-[200px] overflow-y-auto p-2 sm:block hidden left-aside rounded" | ||
| v-if="imageFiles.length > 1" | ||
| > | ||
| <template v-for="(item, index) in imageFiles" :key="index"> | ||
| <el-tooltip :content="item.path" placement="right"> | ||
| <div | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided code snippet contains several inconsistencies and potential improvements:
Optimization suggestions:
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. |
||
|
|
||
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.
IsHiddenfunction should consider the full path to determine if it's hidden across various file systems.filepath.Base(path)returns the base name of the path instead of just a relative substring.