fix enum field causing issues when created in modal + changed data empty button text/target

This commit is contained in:
dswbx
2024-11-18 16:42:27 +01:00
parent 95ea2c8919
commit 4fd315da98
4 changed files with 6 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
import { readFile } from "node:fs/promises"; import { readFile } from "node:fs/promises";
import { serveStatic } from "@hono/node-server/serve-static"; import { serveStatic } from "@hono/node-server/serve-static";
import type { BkndConfig } from "bknd";
import { App } from "../../App"; import { App } from "../../App";
import type { BkndConfig } from "../index";
async function getHtml() { async function getHtml() {
return readFile("index.html", "utf8"); return readFile("index.html", "utf8");

View File

@@ -179,6 +179,7 @@ export function objectDepth(object: object): number {
} }
export function objectCleanEmpty<Obj extends { [key: string]: any }>(obj: Obj): Obj { export function objectCleanEmpty<Obj extends { [key: string]: any }>(obj: Obj): Obj {
if (!obj) return obj;
return Object.entries(obj).reduce((acc, [key, value]) => { return Object.entries(obj).reduce((acc, [key, value]) => {
if (value && Array.isArray(value) && value.some((v) => typeof v === "object")) { if (value && Array.isArray(value) && value.some((v) => typeof v === "object")) {
const nested = value.map(objectCleanEmpty); const nested = value.map(objectCleanEmpty);

View File

@@ -121,7 +121,8 @@ export function DataEmpty() {
const [navigate] = useNavigate(); const [navigate] = useNavigate();
function handleButtonClick() { function handleButtonClick() {
navigate(routes.settings.path(["data", "entities"]), { absolute: true }); //navigate(routes.settings.path(["data", "entities"]), { absolute: true });
navigate(routes.data.schema.root());
} }
return ( return (
@@ -129,7 +130,7 @@ export function DataEmpty() {
Icon={IconDatabase} Icon={IconDatabase}
title="No entity selected" title="No entity selected"
description="Please select an entity from the left sidebar or create a new one to continue." description="Please select an entity from the left sidebar or create a new one to continue."
buttonText="Create Entity" buttonText="Go to schema"
buttonOnClick={handleButtonClick} buttonOnClick={handleButtonClick}
/> />
); );

View File

@@ -11,7 +11,7 @@ registries.media.add("local", {
const connection = new LibsqlConnection( const connection = new LibsqlConnection(
createClient({ createClient({
url: "file:.db/show.db" url: "file:.db/new.db"
}) })
); );