Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions frontend/src/views/host/file-management/favorite/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@
<DrawerPro v-model="open" :header="$t('file.favorite')" @close="handleClose" size="large">
<template #content>
<ComplexTable :pagination-config="paginationConfig" :data="data" @search="search">
<el-table-column :label="$t('file.path')" show-overflow-tooltip prop="path"></el-table-column>
<el-table-column :label="$t('file.path')" show-overflow-tooltip prop="path">
<template #default="{ row }">
<el-tooltip class="box-item" effect="dark" :content="row.path" placement="top">
<span class="table-link text-ellipsis" @click="toFavorite(row)" type="primary">
<svg-icon v-if="row.isDir" className="table-icon" iconName="p-file-folder"></svg-icon>
<svg-icon v-else className="table-icon" iconName="p-file-normal"></svg-icon>
{{ row.name }}
</span>
</el-tooltip>
</template>
</el-table-column>
<fu-table-operations :buttons="buttons" :label="$t('commons.table.operate')" fix />
</ComplexTable>
</template>
Expand All @@ -13,6 +23,7 @@
import { searchFavorite, removeFavorite } from '@/api/modules/files';
import i18n from '@/lang';
import { reactive, ref } from 'vue';
import { File } from '@/api/interface/file';

const paginationConfig = reactive({
cacheSizeKey: 'favorite-page-size',
Expand All @@ -26,13 +37,22 @@ const req = reactive({
});
const open = ref(false);
const data = ref([]);
const em = defineEmits(['close']);
const em = defineEmits(['close', 'jump', 'toFavorite']);

const handleClose = () => {
open.value = false;
em('close', false);
};

const toFavorite = (row: File.Favorite) => {
open.value = false;
em('toFavorite', row);
};
const openDir = (url: string) => {
open.value = false;
em('jump', url);
};

const acceptParams = () => {
search();
};
Expand All @@ -55,12 +75,18 @@ const singleDel = async (id: number) => {
}).then(async () => {
try {
await removeFavorite(id);
search();
await search();
} catch (error) {}
});
};

const buttons = [
{
label: i18n.global.t('commons.button.open'),
click: (row: any) => {
openDir(row.path);
},
},
{
label: i18n.global.t('commons.button.delete'),
click: (row: any) => {
Expand Down
63 changes: 36 additions & 27 deletions frontend/src/views/host/file-management/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div>
<div @dragover="handleDragover" @drop="handleDrop" @dragleave="handleDragleave">
<el-tabs
type="card"
class="file-tabs"
Expand All @@ -14,7 +14,7 @@
:label="item.name == '' ? $t('file.root') : item.name"
:name="item.id"
>
<div @dragover="handleDragover" @drop="handleDrop" @dragleave="handleDragleave">
<div>
<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">
Expand Down Expand Up @@ -268,7 +268,7 @@
</el-button>
<el-popover
placement="bottom"
:width="200"
:width="250"
trigger="hover"
@before-enter="getFavorites"
>
Expand All @@ -281,30 +281,39 @@
<el-table :data="favorites">
<el-table-column prop="name">
<template #default="{ row }">
<el-tooltip
class="box-item"
effect="dark"
:content="row.path"
placement="top"
>
<span
class="table-link text-ellipsis"
@click="toFavorite(row)"
type="primary"
<div class="flex justify-between items-center group">
<el-tooltip
class="box-item"
effect="dark"
:content="row.path"
placement="top"
>
<span
class="table-link text-ellipsis"
@click="toFavorite(row)"
type="primary"
>
<svg-icon
v-if="row.isDir"
className="table-icon"
iconName="p-file-folder"
></svg-icon>
<svg-icon
v-else
className="table-icon"
iconName="p-file-normal"
></svg-icon>
{{ row.name }}
</span>
</el-tooltip>
<el-icon
class="hidden group-hover:block"
v-if="!row.isDir"
@click="jump(row.path)"
>
<svg-icon
v-if="row.isDir"
className="table-icon"
iconName="p-file-folder"
></svg-icon>
<svg-icon
v-else
className="table-icon"
iconName="p-file-normal"
></svg-icon>
{{ row.name }}
</span>
</el-tooltip>
<FolderOpened />
</el-icon>
</div>
</template>
</el-table-column>
</el-table>
Expand Down Expand Up @@ -633,7 +642,7 @@
<Detail ref="detailRef" />
<DeleteFile ref="deleteRef" @close="search" />
<RecycleBin ref="recycleBinRef" @close="search" />
<Favorite ref="favoriteRef" @close="search" />
<Favorite ref="favoriteRef" @close="search" @jump="jump" @toFavorite="toFavorite" />
<BatchRole ref="batchRoleRef" @close="search" />
<VscodeOpenDialog ref="dialogVscodeOpenRef" />
<Preview ref="previewRef" />
Expand Down
Loading