feat: Current directory and file numbers (#8781)

This commit is contained in:
2025-05-22 15:05:59 +08:00 committed by GitHub
parent 3d1f1a8379
commit 8e808903fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 68 additions and 22 deletions

View file

@ -22,7 +22,7 @@
</div> </div>
<div <div
class="complex-table__pagination flex items-center w-full" class="complex-table__pagination flex items-center w-full sm:flex-row flex-col text-xs sm:text-sm"
v-if="props.paginationConfig" v-if="props.paginationConfig"
:class="{ '!justify-between': slots.paginationLeft, '!justify-end': !slots.paginationLeft }" :class="{ '!justify-between': slots.paginationLeft, '!justify-end': !slots.paginationLeft }"
> >

View file

@ -1343,6 +1343,7 @@ const message = {
taskRunning: 'Running', taskRunning: 'Running',
}, },
file: { file: {
fileDirNum: '{0} directories, {1} files,',
currentDir: 'Directory', currentDir: 'Directory',
dir: 'Folder', dir: 'Folder',
fileName: 'File name', fileName: 'File name',

View file

@ -1279,6 +1279,7 @@ const message = {
errLog: 'エラーログ', errLog: 'エラーログ',
}, },
file: { file: {
fileDirNum: '{0} 個のディレクトリ{1} 個のファイル',
currentDir: '現在のディレクトリ', currentDir: '現在のディレクトリ',
dir: 'フォルダ', dir: 'フォルダ',
upload: 'アップロード', upload: 'アップロード',

View file

@ -1266,6 +1266,7 @@ const message = {
errLog: '에러 로그', errLog: '에러 로그',
}, },
file: { file: {
fileDirNum: ' {0} 디렉터리, {1} 파일,',
currentDir: '현재 디렉터리', currentDir: '현재 디렉터리',
dir: '폴더', dir: '폴더',
upload: '업로드', upload: '업로드',

View file

@ -1321,6 +1321,7 @@ const message = {
errLog: 'Log Ralat', errLog: 'Log Ralat',
}, },
file: { file: {
fileDirNum: '{0} direktori, {1} fail,',
currentDir: 'Direktori Semasa', currentDir: 'Direktori Semasa',
dir: 'Folder', dir: 'Folder',
upload: 'Muat naik', upload: 'Muat naik',

View file

@ -1305,6 +1305,7 @@ const message = {
errLog: 'Logs de erro', errLog: 'Logs de erro',
}, },
file: { file: {
fileDirNum: '{0} diretórios, {1} arquivos,',
currentDir: 'Diretório atual', currentDir: 'Diretório atual',
dir: 'Pasta', dir: 'Pasta',
upload: 'Carregar', upload: 'Carregar',

View file

@ -1309,6 +1309,7 @@ const message = {
errLog: 'Логи ошибок', errLog: 'Логи ошибок',
}, },
file: { file: {
fileDirNum: '{0} каталогов, {1} файлов,',
currentDir: 'Текущий каталог', currentDir: 'Текущий каталог',
dir: 'Папка', dir: 'Папка',
upload: 'Загрузить', upload: 'Загрузить',

View file

@ -1271,6 +1271,7 @@ const message = {
taskRunning: '運行中', taskRunning: '運行中',
}, },
file: { file: {
fileDirNum: ' {0} 個目錄{1} 個檔案',
currentDir: '當前目錄', currentDir: '當前目錄',
dir: '文件夾', dir: '文件夾',
upload: '上傳', upload: '上傳',

View file

@ -1269,6 +1269,7 @@ const message = {
taskRunning: '执行中', taskRunning: '执行中',
}, },
file: { file: {
fileDirNum: ' {0} 个目录{1} 个文件',
currentDir: '当前目录', currentDir: '当前目录',
dir: '文件夹', dir: '文件夹',
fileName: '文件名', fileName: '文件名',

View file

@ -28,7 +28,7 @@
</div> </div>
</template> </template>
<template #content> <template #content>
<div ref="dialogForm" class="px-4 py-2"> <div ref="dialogForm" class="px-4 py-2 code-action">
<div class="flex justify-start items-center gap-x-4 card-action"> <div class="flex justify-start items-center gap-x-4 card-action">
<el-text class="cursor-pointer" @click="handleReset">{{ $t('commons.button.reset') }}</el-text> <el-text class="cursor-pointer" @click="handleReset">{{ $t('commons.button.reset') }}</el-text>
<el-text class="cursor-pointer ml-0" @click="saveContent()"> <el-text class="cursor-pointer ml-0" @click="saveContent()">
@ -421,6 +421,20 @@ const config = reactive<EditorConfig>({
minimap: false, minimap: false,
}); });
monaco.editor.defineTheme('vs', {
base: 'vs',
inherit: true,
rules: [{ token: '', foreground: 'FFFFFF' }],
colors: {
'editor.background': '#FFFFFF',
'minimap.background': '#f4f4f4',
'scrollbar.shadow': '#e1e1e1',
'scrollbarSlider.background': '#e1e1e1',
'scrollbarSlider.hoverBackground': '#cccccc',
'scrollbarSlider.activeBackground': '#bfbfbf',
},
});
const selectTab = ref(); const selectTab = ref();
const fileTabs = ref([]); const fileTabs = ref([]);
const removeTab = (targetPath: TabPaneName) => { const removeTab = (targetPath: TabPaneName) => {
@ -1098,6 +1112,9 @@ defineExpose({ acceptParams });
padding-top: 0 !important; padding-top: 0 !important;
} }
} }
.code-action {
border-bottom: 1px solid var(--el-border-color-light) !important;
}
:deep(.el-tabs) { :deep(.el-tabs) {
--el-tabs-header-height: 28px; --el-tabs-header-height: 28px;
@ -1110,12 +1127,12 @@ defineExpose({ acceptParams });
line-height: 27px; line-height: 27px;
} }
.el-tabs__nav { .el-tabs__nav {
border-right: 1px solid var(--el-border-color-light); border-right: 1px solid var(--el-border-color-light) !important;
border-top: none; border-top: none !important;
border-left: none; border-left: none !important;
border-bottom: none; border-bottom: none !important;
border-radius: 0; border-radius: 0 !important;
box-sizing: border-box; box-sizing: border-box !important;
} }
.el-tabs__nav, .el-tabs__nav,
.el-tabs__nav-next, .el-tabs__nav-next,
@ -1123,10 +1140,16 @@ defineExpose({ acceptParams });
height: 28px; height: 28px;
line-height: 28px; line-height: 28px;
} }
.el-tabs__item.is-active { .el-tabs__item:hover {
color: var(--el-color-primary); color: var(--el-color-primary) !important;
.el-dropdown { .el-dropdown {
color: var(--el-color-primary); color: var(--el-color-primary) !important;
}
}
.el-tabs__item.is-active {
color: var(--el-color-primary) !important;
.el-dropdown {
color: var(--el-color-primary) !important;
} }
} }
} }

View file

@ -227,6 +227,9 @@
</el-table> </el-table>
</div> </div>
</el-popover> </el-popover>
<el-button class="btn" @click="calculateSize(req.path)" :loading="disableBtn">
{{ $t('file.calculate') }}
</el-button>
<template v-if="hostMount.length == 1"> <template v-if="hostMount.length == 1">
<el-button class="btn" @click.stop="jump(hostMount[0]?.path)"> <el-button class="btn" @click.stop="jump(hostMount[0]?.path)">
{{ hostMount[0]?.path }} ({{ $t('file.root') }}) {{ getFileSize(hostMount[0]?.free) }} {{ hostMount[0]?.path }} ({{ $t('file.root') }}) {{ getFileSize(hostMount[0]?.free) }}
@ -252,9 +255,6 @@
</template> </template>
</el-dropdown> </el-dropdown>
</template> </template>
<el-button class="btn" @click="calculateSize(req.path)" :disabled="disableBtn">
{{ $t('file.calculate') }}
</el-button>
</el-button-group> </el-button-group>
<el-badge :value="processCount" class="btn" v-if="processCount > 0"> <el-badge :value="processCount" class="btn" v-if="processCount > 0">
@ -465,14 +465,22 @@
fix fix
/> />
<template #paginationLeft> <template #paginationLeft>
<el-button type="primary" link small @click="getDirTotalSize(req.path)"> <div class="flex justify-start items-center">
<span v-if="dirTotalSize == -1"> <el-text small>
{{ $t('file.fileDirNum', [dirNum, fileNum]) }}
</el-text>
<el-text small>
{{ $t('file.currentDir') + $t('file.size') + ' ' }}
</el-text>
<el-button type="primary" link small :loading="calculateBtn">
<span v-if="dirTotalSize == -1" @click="getDirTotalSize(req.path)">
{{ $t('file.calculate') }} {{ $t('file.calculate') }}
</span> </span>
<span v-else> <span v-else>
{{ $t('file.currentDir') + $t('file.size') + ': ' + getFileSize(dirTotalSize) }} {{ getFileSize(dirTotalSize) }}
</span> </span>
</el-button> </el-button>
</div>
</template> </template>
</ComplexTable> </ComplexTable>
</template> </template>
@ -619,6 +627,9 @@ const hostMount = ref<Dashboard.DiskInfo[]>([]);
let resizeObserver: ResizeObserver; let resizeObserver: ResizeObserver;
const dirTotalSize = ref(-1); const dirTotalSize = ref(-1);
const disableBtn = ref(false); const disableBtn = ref(false);
const calculateBtn = ref(false);
const dirNum = ref(0);
const fileNum = ref(0);
const { searchableStatus, searchablePath, searchableInputRef, searchableInputBlur } = useSearchable(paths); const { searchableStatus, searchablePath, searchableInputRef, searchableInputBlur } = useSearchable(paths);
@ -667,6 +678,8 @@ const searchFile = async () => {
const handleSearchResult = (res: ResultData<File.File>) => { const handleSearchResult = (res: ResultData<File.File>) => {
paginationConfig.total = res.data.itemTotal; paginationConfig.total = res.data.itemTotal;
data.value = res.data.items; 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; req.path = res.data.path;
}; };
@ -905,8 +918,10 @@ const getDirTotalSize = async (path: string) => {
const req = { const req = {
path: path, path: path,
}; };
calculateBtn.value = true;
const res = await computeDirSize(req); const res = await computeDirSize(req);
dirTotalSize.value = res.data.size; dirTotalSize.value = res.data.size;
calculateBtn.value = false;
}; };
const calculateSize = (path: string) => { const calculateSize = (path: string) => {