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 [activeTab, setActiveTab] = createSignal(ActiveTab.activeConnections)
|
||||||
const { activeConnections, closedConnections, paused, setPaused } =
|
const { activeConnections, closedConnections, paused, setPaused } =
|
||||||
useConnections()
|
useConnections()
|
||||||
|
const [isClosingConnections, setIsClosingConnections] = createSignal(false)
|
||||||
|
|
||||||
const [globalFilter, setGlobalFilter] = createSignal('')
|
const [globalFilter, setGlobalFilter] = createSignal('')
|
||||||
const [enableQuickFilter, setEnableQuickFilter] = makePersisted(
|
const [enableQuickFilter, setEnableQuickFilter] = makePersisted(
|
||||||
@ -429,18 +430,30 @@ export default () => {
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
class="btn btn-primary join-item btn-sm"
|
class="btn btn-primary join-item btn-sm"
|
||||||
onClick={() => {
|
onClick={async () => {
|
||||||
|
setIsClosingConnections(true)
|
||||||
|
|
||||||
if (table.getState().globalFilter) {
|
if (table.getState().globalFilter) {
|
||||||
table
|
await Promise.allSettled(
|
||||||
.getFilteredRowModel()
|
table
|
||||||
.rows.forEach(({ original }) =>
|
.getFilteredRowModel()
|
||||||
closeSingleConnectionAPI(original.id),
|
.rows.map(({ original }) =>
|
||||||
)
|
closeSingleConnectionAPI(original.id),
|
||||||
|
),
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
closeAllConnectionsAPI()
|
await closeAllConnectionsAPI()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setIsClosingConnections(false)
|
||||||
}}
|
}}
|
||||||
icon={<IconX />}
|
icon={
|
||||||
|
isClosingConnections() ? (
|
||||||
|
<div class="loading loading-spinner" />
|
||||||
|
) : (
|
||||||
|
<IconX />
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
Loading…
Reference in New Issue
Block a user