added aws lambda adapter + improvements to handle concurrency

This commit is contained in:
dswbx
2025-03-03 15:42:42 +01:00
parent 1a72b9e84b
commit 675a39ad5c
22 changed files with 488 additions and 42 deletions

View File

@@ -47,19 +47,29 @@ export function BkndProvider({
const api = useApi();
async function reloadSchema() {
await fetchSchema(includeSecrets, true);
await fetchSchema(includeSecrets, {
force: true,
fresh: true,
});
}
async function fetchSchema(_includeSecrets: boolean = false, force?: boolean) {
async function fetchSchema(
_includeSecrets: boolean = false,
opts?: {
force?: boolean;
fresh?: boolean;
},
) {
const requesting = withSecrets ? Fetching.Secrets : Fetching.Schema;
if (fetching.current === requesting) return;
if (withSecrets && !force) return;
if (withSecrets && opts?.force !== true) return;
fetching.current = requesting;
const res = await api.system.readSchema({
config: true,
secrets: _includeSecrets,
fresh: opts?.fresh,
});
if (!res.ok) {

View File

@@ -1,4 +1,4 @@
import { IconSettings } from "@tabler/icons-react";
import { IconRefresh, IconSettings } from "@tabler/icons-react";
import { ucFirst } from "core/utils";
import { useBknd } from "ui/client/bknd";
import { Empty } from "ui/components/display/Empty";
@@ -12,11 +12,16 @@ import { AuthSettings } from "./routes/auth.settings";
import { DataSettings } from "./routes/data.settings";
import { FlowsSettings } from "./routes/flows.settings";
import { ServerSettings } from "./routes/server.settings";
import { IconButton } from "ui/components/buttons/IconButton";
function SettingsSidebar() {
const { version, schema } = useBknd();
const { version, schema, actions } = useBknd();
useBrowserTitle(["Settings"]);
async function handleRefresh() {
await actions.reload();
}
const modules = Object.keys(schema).map((key) => {
return {
title: schema[key].title ?? ucFirst(key),
@@ -26,7 +31,14 @@ function SettingsSidebar() {
return (
<AppShell.Sidebar>
<AppShell.SectionHeader right={<span className="font-mono">v{version}</span>}>
<AppShell.SectionHeader
right={
<div className="flex items-center gap-2">
<span className="font-mono leading-none">v{version}</span>
<IconButton Icon={IconRefresh} onClick={handleRefresh} />
</div>
}
>
Settings
</AppShell.SectionHeader>
<AppShell.Scrollable initialOffset={96}>