admin/plugins: start plugins just after downloading

Massimo Melina committed Apr 16, 2023 at 20:05 UTC 4935a791ff089b06eaae590d83a77a061d5ea919
1 file changed +2 -5
admin/src/OnlinePlugins.ts
+2 -5
@@ -5,13 +5,11 @@ import { Fragment, createElement as h, useState } from 'react'
5 import { DataGrid } from '@mui/x-data-grid'
6 import { IconBtn } from './misc'
7 import { Download, Search } from '@mui/icons-material'
8 -import { confirmDialog } from './dialog'
8 import { StringField } from '@hfs/mui-grid-form'
9 import { useDebounce } from 'usehooks-ts'
10 import { renderName, showError, startPlugin, UpdateButton } from './InstalledPlugins'
11 import { state, useSnapState } from './state'
12 import _ from 'lodash'
14 -import md from './md'
13
14 export default function OnlinePlugins() {
15 const [search, setSearch] = useState('')
@@ -88,9 +86,8 @@ export default function OnlinePlugins() {
86 tooltipProps: { placement:'bottom-end' }, // workaround problem with horizontal scrolling by moving the tooltip leftward
87 confirm: "WARNING - Proceed only if you trust this author and this plugin",
88 async onClick() {
91 - const { id: installedId } = await apiCall('download_plugin', { id, branch })
92 - if (await confirmDialog(md(`Plugin /${id}/ installed.\nDo you want to start it now?`)))
93 - await startPlugin(installedId)
89 + const res = await apiCall('download_plugin', { id, branch })
90 + await startPlugin(res.id)
91 }
92 })
93 )