-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat: support toggling file list columns #12099
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
Merged
ssongliu
merged 4 commits into
1Panel-dev:dev-v2
from
A-Words:feat/12084-show-hide-file-column
Mar 9, 2026
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
05199f5
feat: support toggling file list columns
A-Words 1bd1e6e
feat: use fu table column select for file list
A-Words 4a25009
chore: remove unused file column i18n keys
A-Words 77fa8ea
feat: simplify file column visibility logic and remove unused configu…
A-Words File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -424,23 +424,32 @@ | |
| <el-button plain class="close" icon="Close" @click="closeMove"></el-button> | ||
| </el-tooltip> | ||
| </el-button-group> | ||
| <div class="w-80"> | ||
| <el-input | ||
| v-model="req.search" | ||
| clearable | ||
| @clear="search()" | ||
| @keydown.enter="search()" | ||
| :placeholder="$t('file.search')" | ||
| > | ||
| <template #prepend> | ||
| <el-checkbox v-model="req.containSub"> | ||
| {{ $t('file.sub') }} | ||
| </el-checkbox> | ||
| </template> | ||
| <template #append> | ||
| <el-button icon="Search" @click="search" round /> | ||
| </template> | ||
| </el-input> | ||
| <div class="flex items-center gap-2"> | ||
| <fu-table-column-select | ||
| :columns="columns" | ||
| trigger="hover" | ||
| :title="$t('commons.table.selectColumn')" | ||
| popper-class="popper-class" | ||
| :only-icon="true" | ||
| /> | ||
| <div class="w-80"> | ||
| <el-input | ||
| v-model="req.search" | ||
| clearable | ||
| @clear="search()" | ||
| @keydown.enter="search()" | ||
| :placeholder="$t('file.search')" | ||
| > | ||
| <template #prepend> | ||
| <el-checkbox v-model="req.containSub"> | ||
| {{ $t('file.sub') }} | ||
| </el-checkbox> | ||
| </template> | ||
| <template #append> | ||
| <el-button icon="Search" @click="search" round /> | ||
| </template> | ||
| </el-input> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
@@ -456,6 +465,8 @@ | |
| @cell-mouse-leave="hideFavorite" | ||
| :heightDiff="heightDiff" | ||
| :right-buttons="rightButtons" | ||
| :columns="columns" | ||
| localKey="fileManagementColumn" | ||
| > | ||
| <el-table-column type="selection" width="30" /> | ||
| <el-table-column | ||
|
|
@@ -520,7 +531,12 @@ | |
| </div> | ||
| </template> | ||
| </el-table-column> | ||
| <el-table-column :label="$t('file.mode')" prop="mode" width="80"> | ||
| <el-table-column | ||
| v-if="isColumnVisible('mode')" | ||
| :label="$t('file.mode')" | ||
| prop="mode" | ||
| width="80" | ||
| > | ||
| <template #default="{ row }"> | ||
| <el-link underline="never" @click="openMode(row)">{{ row.mode }}</el-link> | ||
| </template> | ||
|
|
@@ -538,7 +554,13 @@ | |
| </el-link> | ||
| </template> | ||
| </el-table-column> | ||
| <el-table-column :label="$t('file.size')" prop="size" width="80" :sortable="'custom'"> | ||
| <el-table-column | ||
| v-if="isColumnVisible('size')" | ||
| :label="$t('file.size')" | ||
|
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. 多余判断 |
||
| prop="size" | ||
| width="80" | ||
| :sortable="'custom'" | ||
| > | ||
| <template #default="{ row }"> | ||
| <el-button | ||
| type="primary" | ||
|
|
@@ -560,14 +582,21 @@ | |
| </template> | ||
| </el-table-column> | ||
| <el-table-column | ||
| v-if="isColumnVisible('modTime')" | ||
| :label="$t('file.updateTime')" | ||
| prop="modTime" | ||
| width="180" | ||
| :formatter="dateFormat" | ||
| show-overflow-tooltip | ||
| :sortable="'custom'" | ||
| ></el-table-column> | ||
| <el-table-column :label="$t('file.remark')" prop="remark" width="180" show-overflow-tooltip> | ||
| <el-table-column | ||
| v-if="isColumnVisible('remark')" | ||
| :label="$t('file.remark')" | ||
| prop="remark" | ||
| width="180" | ||
| show-overflow-tooltip | ||
| > | ||
| <template #default="{ row }"> | ||
| <span>{{ row.remark ? row.remark : '-' }}</span> | ||
| </template> | ||
|
|
@@ -709,6 +738,15 @@ interface FilePaths { | |
| name: string; | ||
| } | ||
|
|
||
| type FileColumnKey = 'mode' | 'size' | 'modTime' | 'remark'; | ||
|
|
||
| interface FileColumnConfig { | ||
| label: string; | ||
| show: boolean; | ||
| fix?: boolean; | ||
| value: FileColumnKey; | ||
| } | ||
|
|
||
| const router = useRouter(); | ||
| const data = ref(); | ||
| const tableRefs = ref<Record<string, any>>({}); | ||
|
|
@@ -827,13 +865,20 @@ const setRenameRef = (key: string, el: any) => { | |
| const getCurrentRename = () => renameRefs.value[editableTabsKey.value]; | ||
|
|
||
| const pathRefs = ref<Record<string, any>>({}); | ||
| const columns = ref<FileColumnConfig[]>([ | ||
| { label: i18n.global.t('file.mode'), value: 'mode', show: true }, | ||
|
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. 可以不用赋值 |
||
| { label: i18n.global.t('file.size'), value: 'size', show: true }, | ||
| { label: i18n.global.t('file.updateTime'), value: 'modTime', show: true }, | ||
| { label: i18n.global.t('file.remark'), value: 'remark', show: true }, | ||
| ]); | ||
|
|
||
| const setPathRef = (key: string, el: any) => { | ||
| if (el) { | ||
| pathRefs.value[key] = el; | ||
| } | ||
| }; | ||
| const getCurrentPath = () => pathRefs.value[editableTabsKey.value]; | ||
| const isColumnVisible = (key: FileColumnKey) => columns.value.find((column) => column.value === key)?.show !== false; | ||
|
|
||
| const { searchableStatus, searchablePath, setSearchableInputRef, searchableInputBlur } = useMultipleSearchable(paths); | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
这个判断是多余的吧