Skip to content

Commit

Permalink
feat: optimize deleting function
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Nov 13, 2024
1 parent 624ea69 commit b9037ac
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/views/database/list/DatabaseList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
tableData,
tablePagination,
tableTotal,
selectableFunction,
} = useDatabaseList();
defineOptions({ name: 'ClDatabaseList' });
Expand All @@ -23,6 +24,7 @@ defineOptions({ name: 'ClDatabaseList' });
:table-columns="tableColumns"
:table-data="tableData"
:table-total="tableTotal"
:selectable-function="selectableFunction"
>
<template #extra>
<!-- Dialogs (handled by store) -->
Expand Down
7 changes: 7 additions & 0 deletions src/views/database/list/useDatabaseList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,15 @@ const useDatabaseList = () => {

setupListComponent(ns, store, [], true);

const selectableFunction: TableSelectableFunction<Database> = (
row: Database
) => {
return !row.is_default;
};

return {
...useList<Database>(ns, store, opts),
selectableFunction,
};
};

Expand Down
3 changes: 3 additions & 0 deletions src/views/git/list/GitList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const {
tableColumns,
tableData,
tableTotal,
selectableFunction,
} = useGitList();
defineOptions({ name: 'ClGitList' });
</script>

Expand All @@ -31,6 +33,7 @@ defineOptions({ name: 'ClGitList' });
:table-columns="tableColumns"
:table-data="tableData"
:table-total="tableTotal"
:selectable-function="selectableFunction"
>
<template #extra>
<!-- Dialogs (handled by store) -->
Expand Down
5 changes: 5 additions & 0 deletions src/views/git/list/useGitList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,13 @@ const useGitList = () => {
// init
setupListComponent(ns, store, []);

const selectableFunction: TableSelectableFunction<Git> = (row: Git) => {
return !row.spiders?.length;
};

return {
...useList<Git>(ns, store, opts),
selectableFunction,
};
};

Expand Down

0 comments on commit b9037ac

Please sign in to comment.