admin/monitor: toast and better icon for "disconnect"
Massimo Melina committed
Jul 11, 2023 at 15:33 UTC
53944b0d9ad6e376155b5cd1d00fc3b366f7e741
1 file changed
+7
-5
admin/src/MonitorPage.ts
+7
-5
@@ -3,12 +3,13 @@
3
import _ from "lodash"
4
import { createElement as h, useMemo, Fragment, useState } from "react"
5
import { apiCall, useApiEvents, useApiEx, useApiList } from "./api"
6
-import { PauseCircle, PlayCircle, Delete, Lock, Block, FolderZip, Upload, Download } from '@mui/icons-material'
6
+import { PauseCircle, PlayCircle, LinkOff, Lock, Block, FolderZip, Upload, Download } from '@mui/icons-material'
7
import { Alert, Box, Chip, ChipProps } from '@mui/material'
8
import { DataTable } from './DataTable'
9
import { formatBytes, IconBtn, IconProgress, iconTooltip, manipulateConfig, useBreakpoint } from "./misc"
10
import { Field, SelectField } from '@hfs/mui-grid-form'
11
import { StandardCSSProperties } from '@mui/system/styleFunctionSx/StandardCssProperties'
12
+import { toast } from "./dialog"
13
14
export default function MonitorPage() {
15
return h(Fragment, {},
@@ -113,7 +114,7 @@ function Connections() {
114
headerName: "Address",
115
flex: 1,
116
maxWidth: 400,
116
- renderCell: ({ row, value }) => (row.v === 6 ? `[${value}]` : value) + ' :' + row.port,
117
+ renderCell: ({ row, value }) => (value.includes(':') ? `[${value}]` : value) + ' :' + row.port,
118
mergeRender: { other: 'user', fontSize: 'small' },
119
},
120
{
@@ -132,7 +133,7 @@ function Connections() {
133
{
134
field: 'path',
135
headerName: "File",
135
- flex: 1,
136
+ flex: 1.5,
137
renderCell({ value, row }) {
138
if (!value) return
139
if (row.archive)
@@ -191,9 +192,10 @@ function Connections() {
192
actionsProps: { hideUnder: 'sm' },
193
actions: ({ row }) => [
194
h(IconBtn, {
194
- icon: Delete,
195
+ icon: LinkOff,
196
title: "Disconnect",
196
- onClick: () => apiCall('disconnect', _.pick(row, ['ip', 'port'])),
197
+ onClick: () => apiCall('disconnect', _.pick(row, ['ip', 'port']))
198
+ .then(() => toast("Disconnection requested")),
199
}),
200
h(IconBtn, {
201
icon: Block,