fix: admin/plugins: misaligned spinner on buttons

Massimo Melina committed Sep 11, 2023 at 23:33 UTC 678aec5cf0e974309291dcb66c0b701052168176
2 files changed +7 -5
admin/src/InstalledPlugins.ts
+6 -4
@@ -16,6 +16,7 @@ export default function InstalledPlugins({ updates }: { updates?: true }) {
16 const { list, updateEntry, error, initializing } = useApiList(updates ? 'get_plugin_updates' : 'get_plugins')
17 if (error)
18 return showError(error)
19 + const size = 'small'
20 return h(DataTable, {
21 rows: list.length ? list : [], // workaround for DataGrid bug causing 'no rows' message to be not displayed after 'loading' was also used
22 initializing,
@@ -48,6 +49,7 @@ export default function InstalledPlugins({ updates }: { updates?: true }) {
49 icon: Upgrade,
50 title: row.updated ? "Already updated" : "Update",
51 disabled: row.updated,
52 + size,
53 async onClick() {
54 await apiCall('update_plugin', { id }, { timeout: false }).catch(e => {
55 throw e.code !== 424 ? e
@@ -61,7 +63,7 @@ export default function InstalledPlugins({ updates }: { updates?: true }) {
63 h(IconBtn, row.started ? {
64 icon: StopCircle,
65 title: h(Box, {}, `Stop ${id}`, h('br'), `Started ` + new Date(row.started as string).toLocaleString()),
64 - size: 'small',
66 + size,
67 color: 'success',
68 async onClick() {
69 await apiCall('stop_plugin', { id })
@@ -70,13 +72,13 @@ export default function InstalledPlugins({ updates }: { updates?: true }) {
72 } : {
73 icon: PlayCircle,
74 title: `Start ${id}`,
73 - size: 'small',
75 + size,
76 onClick: () => startPlugin(id),
77 }),
78 h(IconBtn, {
79 icon: Settings,
80 title: "Options",
79 - size: 'small',
81 + size,
82 disabled: !row.started && "Start plugin to access options"
83 || !row.config && "No options available for this plugin",
84 progress: false,
@@ -100,7 +102,7 @@ export default function InstalledPlugins({ updates }: { updates?: true }) {
102 h(IconBtn, {
103 icon: Delete,
104 title: "Uninstall",
103 - size: 'small',
105 + size,
106 confirm: "Remove?",
107 async onClick() {
108 await apiCall('uninstall_plugin', { id })
admin/src/misc.ts
+1 -1
@@ -72,7 +72,7 @@ export const IconBtn = forwardRef(({ title, icon, onClick, disabled, progress, l
72 (progress || loading) && progress !== false // false is also useful to inhibit behavior with loading
73 && h(CircularProgress, {
74 ...(typeof progress === 'number' ? { value: progress*100, variant: 'determinate' } : null),
75 - style: { position:'absolute', top: 4, left: 4, width: 32, height: 32 }
75 + style: { position:'absolute', top: '10%', left: '10%', width: '80%', height: '80%' }
76 }),
77 h(icon)
78 )