diff --git a/packages/merchant-backoffice-ui/dev.mjs b/packages/merchant-backoffice-ui/dev.mjs index 2f31d8e79..6cf7f0954 100755 --- a/packages/merchant-backoffice-ui/dev.mjs +++ b/packages/merchant-backoffice-ui/dev.mjs @@ -25,6 +25,7 @@ serve({ folder: './dist', port: 8080, source: './src', + insecure: true, development: true, onUpdate: async () => esbuild.build(buildConfig) }) diff --git a/packages/merchant-backoffice-ui/src/Application.tsx b/packages/merchant-backoffice-ui/src/Application.tsx index 84536396d..ed1fc69f3 100644 --- a/packages/merchant-backoffice-ui/src/Application.tsx +++ b/packages/merchant-backoffice-ui/src/Application.tsx @@ -23,7 +23,7 @@ import { TranslationProvider, useTranslationContext, } from "@gnu-taler/web-util/lib/index.browser"; -import { h, VNode } from "preact"; +import { Fragment, h, VNode } from "preact"; import { route } from "preact-router"; import { useMemo } from "preact/hooks"; import { ApplicationReadyRoutes } from "./ApplicationReadyRoutes.js"; @@ -70,24 +70,24 @@ function ApplicationStatusRoutes(): VNode { if (!triedToLog) { return ( -
+ -
+ ); } if (result.clientError && result.isUnauthorized) return ( -
+ -
+ ); if (result.clientError && result.isNotfound) return ( -
+ -
+ ); if (result.serverError) return ( -
+ -
+ ); if (result.loading) return ; if (!result.ok) return ( -
+ -
+ ); return ( diff --git a/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx b/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx index c8f22f583..b911483a7 100644 --- a/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx +++ b/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx @@ -52,6 +52,7 @@ import ReservesDetailsPage from "./paths/instance/reserves/details/index.js"; import ReservesListPage from "./paths/instance/reserves/list/index.js"; import TemplateCreatePage from "./paths/instance/templates/create/index.js"; import TemplateUsePage from "./paths/instance/templates/use/index.js"; +import TemplateQrPage from "./paths/instance/templates/qr/index.js"; import TemplateListPage from "./paths/instance/templates/list/index.js"; import TemplateUpdatePage from "./paths/instance/templates/update/index.js"; import WebhookCreatePage from "./paths/instance/webhooks/create/index.js"; @@ -94,6 +95,7 @@ export enum InstancePaths { templates_update = "/templates/:tid/update", templates_new = "/templates/new", templates_use = "/templates/:tid/use", + templates_qr = "/templates/:tid/qr", webhooks_list = "/webhooks", webhooks_update = "/webhooks/:tid/update", @@ -465,6 +467,9 @@ export function InstanceRoutes({ onNewOrder={(id: string) => { route(InstancePaths.templates_use.replace(":tid", id)); }} + onQR={(id: string) => { + route(InstancePaths.templates_qr.replace(":tid", id)); + }} onSelect={(id: string) => { route(InstancePaths.templates_update.replace(":tid", id)); }} @@ -505,6 +510,16 @@ export function InstanceRoutes({ route(InstancePaths.templates_list); }} /> + { + route(InstancePaths.templates_list); + }} + /> {/** * reserves pages diff --git a/packages/merchant-backoffice-ui/src/components/exception/login.tsx b/packages/merchant-backoffice-ui/src/components/exception/login.tsx index 552e76ed6..9a0411642 100644 --- a/packages/merchant-backoffice-ui/src/components/exception/login.tsx +++ b/packages/merchant-backoffice-ui/src/components/exception/login.tsx @@ -42,6 +42,14 @@ function normalizeToken(r: string | undefined): string | undefined { return r ? `secret-token:${encodeURIComponent(r)}` : undefined; } +function cleanUp(s: string): string { + let result = s; + if (result.indexOf("webui/") !== -1) { + result = result.substring(0, result.indexOf("webui/")); + } + return result; +} + export function LoginModal({ onConfirm, withMessage }: Props): VNode { const { url: backendUrl, token: baseToken } = useBackendContext(); const { admin, token: instanceToken } = useInstanceContext(); @@ -50,11 +58,11 @@ export function LoginModal({ onConfirm, withMessage }: Props): VNode { ); const [token, setToken] = useState(currentToken); - const [url, setURL] = useState(backendUrl); + const [url, setURL] = useState(cleanUp(backendUrl)); const { i18n } = useTranslationContext(); return ( -
+