diff --git a/agent/utils/files/utils.go b/agent/utils/files/utils.go index 0181e3b4f..2c5cf3072 100644 --- a/agent/utils/files/utils.go +++ b/agent/utils/files/utils.go @@ -66,7 +66,8 @@ func GetGroup(gid uint32) string { const dotCharacter = 46 func IsHidden(path string) bool { - return path[0] == dotCharacter + base := filepath.Base(path) + return len(base) > 1 && base[0] == dotCharacter } func countLines(path string) (int, error) { diff --git a/frontend/src/api/interface/file.ts b/frontend/src/api/interface/file.ts index 7bbf9d2f5..c929e217c 100644 --- a/frontend/src/api/interface/file.ts +++ b/frontend/src/api/interface/file.ts @@ -11,6 +11,7 @@ export namespace File { size: number; isDir: boolean; isSymlink: boolean; + isHidden: boolean; linkPath: string; type: string; updateTime: string; diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index d2f921642..ca3fc6153 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1468,6 +1468,8 @@ const message = { existFileDirHelper: 'The selected file/folder has a duplicate name. Please proceed with caution!', noSuchFile: 'The file or directory was not found. Please check and try again.', setting: 'Setting', + showHide: 'Show hidden files', + noShowHide: 'Don’t show hidden files', }, ssh: { autoStart: 'Auto Start', diff --git a/frontend/src/lang/modules/ja.ts b/frontend/src/lang/modules/ja.ts index 1f19b948c..f40f02c54 100644 --- a/frontend/src/lang/modules/ja.ts +++ b/frontend/src/lang/modules/ja.ts @@ -1409,6 +1409,8 @@ const message = { existFileDirHelper: '選択したファイル/フォルダーには同じ名前のものが既に存在します。慎重に操作してください!', noSuchFile: 'ファイルまたはディレクトリが見つかりませんでした。確認して再試行してください。', setting: '設定', + showHide: '隠しファイルを表示', + noShowHide: '隠しファイルを表示しない', }, ssh: { autoStart: 'オートスタート', diff --git a/frontend/src/lang/modules/ko.ts b/frontend/src/lang/modules/ko.ts index 7265e50d5..40acfd0df 100644 --- a/frontend/src/lang/modules/ko.ts +++ b/frontend/src/lang/modules/ko.ts @@ -1395,6 +1395,8 @@ const message = { existFileDirHelper: '선택한 파일/폴더에 동일한 이름이 이미 존재합니다. 신중하게 작업하세요!', noSuchFile: '파일 또는 디렉터리를 찾을 수 없습니다. 확인 후 다시 시도하세요.', setting: '설정', + showHide: '숨김 파일 표시', + noShowHide: '숨김 파일 숨기기', }, ssh: { autoStart: '자동 시작', diff --git a/frontend/src/lang/modules/ms.ts b/frontend/src/lang/modules/ms.ts index 2dfb3aacc..51aaa3e82 100644 --- a/frontend/src/lang/modules/ms.ts +++ b/frontend/src/lang/modules/ms.ts @@ -1452,6 +1452,8 @@ const message = { existFileDirHelper: 'Fail/folder yang dipilih mempunyai nama yang sama. Sila berhati-hati!', noSuchFile: 'Fail atau direktori tidak ditemui. Sila periksa dan cuba lagi.', setting: 'tetapan', + showHide: 'Tunjukkan fail tersembunyi', + noShowHide: 'Jangan tunjukkan fail tersembunyi', }, ssh: { autoStart: 'Mula automatik', diff --git a/frontend/src/lang/modules/pt-br.ts b/frontend/src/lang/modules/pt-br.ts index d1d5d0bb8..1b3df3e5e 100644 --- a/frontend/src/lang/modules/pt-br.ts +++ b/frontend/src/lang/modules/pt-br.ts @@ -1438,6 +1438,8 @@ const message = { existFileDirHelper: 'O arquivo/pasta selecionado tem um nome duplicado. Por favor, prossiga com cautela!', noSuchFile: 'O arquivo ou diretório não foi encontrado. Por favor, verifique e tente novamente.', setting: 'configuração', + showHide: 'Mostrar arquivos ocultos', + noShowHide: 'Não mostrar arquivos ocultos', }, ssh: { autoStart: 'Início automático', diff --git a/frontend/src/lang/modules/ru.ts b/frontend/src/lang/modules/ru.ts index a5900dc15..1dda4b90e 100644 --- a/frontend/src/lang/modules/ru.ts +++ b/frontend/src/lang/modules/ru.ts @@ -1439,6 +1439,8 @@ const message = { existFileDirHelper: 'Выбранный файл/папка имеет дублирующееся имя. Пожалуйста, действуйте осторожно!', noSuchFile: 'Файл или каталог не найдены. Пожалуйста, проверьте и повторите попытку.', setting: 'настройка', + showHide: 'Показывать скрытые файлы', + noShowHide: 'Не показывать скрытые файлы', }, ssh: { autoStart: 'Автозапуск', diff --git a/frontend/src/lang/modules/zh-Hant.ts b/frontend/src/lang/modules/zh-Hant.ts index eda0d00ca..87b1f0f34 100644 --- a/frontend/src/lang/modules/zh-Hant.ts +++ b/frontend/src/lang/modules/zh-Hant.ts @@ -1394,6 +1394,8 @@ const message = { existFileDirHelper: '選擇的檔案/資料夾存在同名,請謹慎操作!', noSuchFile: '找不到該檔案或目錄,請檢查後重試。', setting: '设置', + showHide: '顯示隱藏檔案', + noShowHide: '不顯示隱藏檔案', }, ssh: { autoStart: '開機自啟', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 5cfede71b..cb69c0ca5 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1390,6 +1390,8 @@ const message = { existFileDirHelper: '选择的文件/文件夹存在同名,请谨慎操作!', noSuchFile: '未能找到该文件或目录,请检查后重试', setting: '设置', + showHide: '显示隐藏文件', + noShowHide: '不显示隐藏文件', }, ssh: { autoStart: '开机自启', diff --git a/frontend/src/views/host/file-management/index.vue b/frontend/src/views/host/file-management/index.vue index 266693bf7..3d6da4cc2 100644 --- a/frontend/src/views/host/file-management/index.vue +++ b/frontend/src/views/host/file-management/index.vue @@ -1,7 +1,7 @@ - - + + {{ $t('file.recycleBin') }} @@ -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) => { 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 { diff --git a/frontend/src/views/host/file-management/preview/index.vue b/frontend/src/views/host/file-management/preview/index.vue index 67e809e7b..9ba432bba 100644 --- a/frontend/src/views/host/file-management/preview/index.vue +++ b/frontend/src/views/host/file-management/preview/index.vue @@ -30,7 +30,10 @@ >