mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-27 10:44:02 +08:00
feat(connections): add isClosingConnections spinner
This commit is contained in:
parent
14b1b39e2c
commit
23193c5c98
@ -89,6 +89,7 @@ export default () => {
|
||||
const [activeTab, setActiveTab] = createSignal(ActiveTab.activeConnections)
|
||||
const { activeConnections, closedConnections, paused, setPaused } =
|
||||
useConnections()
|
||||
const [isClosingConnections, setIsClosingConnections] = createSignal(false)
|
||||
|
||||
const [globalFilter, setGlobalFilter] = createSignal('')
|
||||
const [enableQuickFilter, setEnableQuickFilter] = makePersisted(
|
||||
@ -429,18 +430,30 @@ export default () => {
|
||||
|
||||
<Button
|
||||
class="btn btn-primary join-item btn-sm"
|
||||
onClick={() => {
|
||||
onClick={async () => {
|
||||
setIsClosingConnections(true)
|
||||
|
||||
if (table.getState().globalFilter) {
|
||||
table
|
||||
.getFilteredRowModel()
|
||||
.rows.forEach(({ original }) =>
|
||||
closeSingleConnectionAPI(original.id),
|
||||
)
|
||||
await Promise.allSettled(
|
||||
table
|
||||
.getFilteredRowModel()
|
||||
.rows.map(({ original }) =>
|
||||
closeSingleConnectionAPI(original.id),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
closeAllConnectionsAPI()
|
||||
await closeAllConnectionsAPI()
|
||||
}
|
||||
|
||||
setIsClosingConnections(false)
|
||||
}}
|
||||
icon={<IconX />}
|
||||
icon={
|
||||
isClosingConnections() ? (
|
||||
<div class="loading loading-spinner" />
|
||||
) : (
|
||||
<IconX />
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
<Button
|
||||
|
Loading…
Reference in New Issue
Block a user