Skip to content
Merged
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
11 changes: 3 additions & 8 deletions frontend/src/views/host/file-management/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
link
small
@click="getDirSize(row, $index)"
:loading="btnLoading == $index"
:loading="row.btnLoading"
>
<span v-if="row.dirSize == undefined">
{{ $t('file.calculate') }}
Expand Down Expand Up @@ -377,7 +377,6 @@ const initData = () => ({
});
let req = reactive(initData());
let loading = ref(false);
let btnLoading = ref(-1);
const paths = ref<FilePaths[]>([]);
let pathWidth = ref(0);
const history: string[] = [];
Expand Down Expand Up @@ -419,7 +418,6 @@ const dialogVscodeOpenRef = ref();
const previewRef = ref();
const processRef = ref();

// editablePath
const { searchableStatus, searchablePath, searchableInputRef, searchableInputBlur } = useSearchable(paths);

const paginationConfig = reactive({
Expand Down Expand Up @@ -453,7 +451,6 @@ const search = async () => {
});
};

/** just search, no handleSearchResult */
const searchFile = async () => {
loading.value = true;
try {
Expand Down Expand Up @@ -548,7 +545,6 @@ const jump = async (url: string) => {
const { path: oldUrl, pageSize: oldPageSize } = req;
Object.assign(req, initData(), { path: url, containSub: false, search: '', pageSize: oldPageSize });
let searchResult = await searchFile();
// check search result,the file is exists?
if (!searchResult.data.path) {
req.path = oldUrl;
globalStore.setLastFilePath(req.path);
Expand All @@ -566,7 +562,6 @@ const jump = async (url: string) => {

const backForwardJump = async (url: string) => {
const oldPageSize = req.pageSize;
// reset search params before exec jump
Object.assign(req, initData());
req.path = url;
req.containSub = false;
Expand Down Expand Up @@ -624,15 +619,15 @@ const getDirSize = async (row: any, index: number) => {
const req = {
path: row.path,
};
btnLoading.value = index;
data.value[index].btnLoading = true;
await computeDirSize(req)
.then(async (res) => {
let newData = [...data.value];
newData[index].dirSize = res.data.size;
data.value = newData;
})
.finally(() => {
btnLoading.value = -1;
data.value[index].btnLoading = false;
});
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears there aren't any significant changes to the given code as of my knowledge cutoff on March 5, 2021. The proposed optimizations would be based more on coding practices rather than technical details which can evolve with ongoing improvements in programming tools and methodologies.

Expand Down
Loading