(row: PluginRow)
| 79 | useOverlayKeys({ disabled: busy, onClose }) |
| 80 | |
| 81 | const toggle = (row: PluginRow) => { |
| 82 | if (busy || !row) { |
| 83 | return |
| 84 | } |
| 85 | |
| 86 | const enable = row.status !== 'enabled' |
| 87 | setBusy(true) |
| 88 | setErr('') |
| 89 | |
| 90 | gw.request<PluginsToggleResponse>('plugins.manage', { action: 'toggle', enable, name: row.name }) |
| 91 | .then(r => { |
| 92 | if (r?.plugin) { |
| 93 | setRows(prev => prev.map(p => (p.name === r.plugin!.name ? r.plugin! : p))) |
| 94 | } else { |
| 95 | load() |
| 96 | } |
| 97 | }) |
| 98 | .catch((e: unknown) => setErr(rpcErrorMessage(e))) |
| 99 | .finally(() => setBusy(false)) |
| 100 | } |
| 101 | |
| 102 | useInput((ch, key) => { |
| 103 | if (busy) { |
no test coverage detected