@samitouri / QOSami-HFS / commits / a8053b2b

admin/home: extended right-click to install-other-version, so that it's easier to notice

Massimo Melina committed Jan 30, 2025 at 11:41 UTC a8053b2b76e1b7768dccf984b2bb5ece7450b579
1 file changed +13 -10
admin/src/HomePage.ts
+13 -10
@@ -53,6 +53,17 @@ export default function HomePage() {
53 "make one"
54 ), " or ", SOLUTION_SEP, cfgLink("provide adequate files")
55 ]]))
56 + const rightClickToInstallFromUrl = {
57 + async onContextMenu(ev: any) {
58 + ev.preventDefault()
59 + if (!status.updatePossible)
60 + return alertDialog("Automatic update is only for binary versions", 'warning')
61 + const res = await promptDialog("Enter a link to the zip to install")
62 + if (res)
63 + await update(res)
64 + },
65 + title: status.updatePossible && "Right-click if you want to install a zip",
66 + }
67 return h(Box, { display:'flex', gap: 2, flexDirection:'column', alignItems: 'flex-start', height: '100%' },
68 username && entry('', "Welcome, "+username),
69 dontBotherWithKeys(status.alerts?.map(x => entry('warning', md(x, { html: false })))),
@@ -109,15 +120,7 @@ export default function HomePage() {
120 setCheckPlugins(true) // this only happens once, actually (until you change page)
121 return apiCall<typeof adminApis.check_update>('check_update').then(x => setUpdates(x.options), alertDialog)
122 },
112 - async onContextMenu(ev) {
113 - ev.preventDefault()
114 - if (!status.updatePossible)
115 - return alertDialog("Automatic update is only for binary versions", 'warning')
116 - const res = await promptDialog("Enter a link to the zip to install")
117 - if (res)
118 - await update(res)
119 - },
120 - title: status.updatePossible && "Right-click if you want to install a zip",
123 + ...rightClickToInstallFromUrl
124 }, "Check for updates"),
125 { k: 'auto_check_update', comp: CheckboxField, label: "Auto check updates daily" },
126 { k: 'update_to_beta', comp: CheckboxField, label: "Include beta versions" },
@@ -134,7 +137,7 @@ export default function HomePage() {
137 !otherVersions && status.updatePossible && status.previousVersionAvailable
138 && h(Btn, { icon: Restore, onClick: () => update(PREVIOUS_TAG) }, "Install previous version"),
139 !status.updatePossible ? entry('', h(Link, { href: REPO_URL + 'releases/', target: 'repo' }, "All releases"))
137 - : !otherVersions ? h(Btn, { icon: Colorize, onClick: getOtherVersions }, "Install other version")
140 + : !otherVersions ? h(Btn, { icon: Colorize, onClick: getOtherVersions, ...rightClickToInstallFromUrl }, "Install other version")
141 : h(Flex, { vert: true }, otherVersions.map((x: any) => h(Update, {
142 info: x,
143 key: x.name,