admin/plugins/installed: sorted list
Massimo Melina committed
Jan 8, 2024 at 11:32 UTC
f4e4b5fdbcdb0a85832af2ddaab897d714c47d06
1 file changed
+3
-2
admin/src/InstalledPlugins.ts
+3
-2
@@ -1,7 +1,7 @@
1
// This file is part of HFS - Copyright 2021-2023, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
2
3
import { apiCall, useApiList } from './api'
4
-import { createElement as h, Fragment, ReactNode } from 'react'
4
+import { createElement as h, Fragment, ReactNode, useMemo } from 'react'
5
import { Box, Link, Tooltip } from '@mui/material'
6
import { DataTable } from './DataTable'
7
import { Delete, Error as ErrorIcon, PlayCircle, Settings, StopCircle, Upgrade } from '@mui/icons-material'
@@ -16,10 +16,11 @@ import { Btn, IconBtn } from './mui'
16
17
export default function InstalledPlugins({ updates }: { updates?: true }) {
18
const { list, updateEntry, error, initializing } = useApiList(updates ? 'get_plugin_updates' : 'get_plugins')
19
+ const sorted = useMemo(() => _.sortBy(list, x => (x.started ? '0' : '1') + x.id), [list])
20
const size = 'small'
21
return h(DataTable, {
22
error: xlate(error, PLUGIN_ERRORS),
22
- rows: list.length ? list : [], // workaround for DataGrid bug causing 'no rows' message to be not displayed after 'loading' was also used
23
+ rows: sorted,
24
initializing,
25
disableColumnSelector: true,
26
disableColumnMenu: true,