Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86dfdc687e |
@@ -16,6 +16,8 @@ jobs:
|
|||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_DB: bknd
|
POSTGRES_DB: bknd
|
||||||
|
ports:
|
||||||
|
- 5430:5432
|
||||||
options: >-
|
options: >-
|
||||||
--health-cmd pg_isready
|
--health-cmd pg_isready
|
||||||
--health-interval 10s
|
--health-interval 10s
|
||||||
|
|||||||
@@ -8,12 +8,9 @@ import { $ } from "bun";
|
|||||||
import { connectionTestSuite } from "data/connection/connection-test-suite";
|
import { connectionTestSuite } from "data/connection/connection-test-suite";
|
||||||
import { bunTestRunner } from "adapter/bun/test";
|
import { bunTestRunner } from "adapter/bun/test";
|
||||||
|
|
||||||
const isCI = !!(process.env.GITEA_ACTIONS || process.env.GITHUB_ACTIONS);
|
|
||||||
|
|
||||||
const credentials = {
|
const credentials = {
|
||||||
// Changes to "postgres" inside CI to talk directly to the Gitea service container
|
host: "localhost",
|
||||||
host: isCI ? "postgres" : "localhost",
|
port: 5430,
|
||||||
port: 5432,
|
|
||||||
user: "postgres",
|
user: "postgres",
|
||||||
password: "postgres",
|
password: "postgres",
|
||||||
database: "bknd",
|
database: "bknd",
|
||||||
@@ -42,11 +39,6 @@ async function isPostgresRunning() {
|
|||||||
|
|
||||||
describe("postgres", () => {
|
describe("postgres", () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
if (process.env.GITEA_ACTIONS || process.env.GITHUB_ACTIONS) {
|
|
||||||
console.log("Running in CI: Skipping manual docker run");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(await isPostgresRunning())) {
|
if (!(await isPostgresRunning())) {
|
||||||
await $`docker run --rm --name bknd-test-postgres -d -e POSTGRES_PASSWORD=${credentials.password} -e POSTGRES_USER=${credentials.user} -e POSTGRES_DB=${credentials.database} -p ${credentials.port}:5432 postgres:17`;
|
await $`docker run --rm --name bknd-test-postgres -d -e POSTGRES_PASSWORD=${credentials.password} -e POSTGRES_USER=${credentials.user} -e POSTGRES_DB=${credentials.database} -p ${credentials.port}:5432 postgres:17`;
|
||||||
await $waitUntil("Postgres is running", isPostgresRunning, 500, 20);
|
await $waitUntil("Postgres is running", isPostgresRunning, 500, 20);
|
||||||
|
|||||||
+12
-10
@@ -17,9 +17,9 @@ export type BkndAdminConfig = {
|
|||||||
*/
|
*/
|
||||||
basepath?: string;
|
basepath?: string;
|
||||||
/**
|
/**
|
||||||
* Sub-path for the Admin UI within the base path
|
* Sub-path for the Admin UI within the base path
|
||||||
* @default ``
|
* @default ``
|
||||||
*/
|
*/
|
||||||
admin_basepath?: string;
|
admin_basepath?: string;
|
||||||
/**
|
/**
|
||||||
* Path to return to when clicking the logo
|
* Path to return to when clicking the logo
|
||||||
@@ -77,6 +77,14 @@ export default function Admin(props: BkndAdminProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function BkndWrapper({ options, children }: { options?: BkndAdminConfig; children: ReactNode }) {
|
||||||
|
return (
|
||||||
|
<BkndProvider options={options} fallback={<Skeleton theme={options?.theme} />}>
|
||||||
|
{children}
|
||||||
|
</BkndProvider>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function AdminInner(props: BkndAdminProps) {
|
function AdminInner(props: BkndAdminProps) {
|
||||||
const { theme } = useTheme();
|
const { theme } = useTheme();
|
||||||
const config = {
|
const config = {
|
||||||
@@ -84,16 +92,10 @@ function AdminInner(props: BkndAdminProps) {
|
|||||||
...useBkndWindowContext(),
|
...useBkndWindowContext(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const BkndWrapper = ({ children }: { children: ReactNode }) => (
|
|
||||||
<BkndProvider options={config} fallback={<Skeleton theme={config?.theme} />}>
|
|
||||||
{children}
|
|
||||||
</BkndProvider>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MantineProvider {...createMantineTheme(theme as any)}>
|
<MantineProvider {...createMantineTheme(theme as any)}>
|
||||||
<Notifications position="top-right" />
|
<Notifications position="top-right" />
|
||||||
<Routes BkndWrapper={BkndWrapper} basePath={config?.basepath}>
|
<Routes BkndWrapper={BkndWrapper} options={config} basePath={config?.basepath}>
|
||||||
{props.children}
|
{props.children}
|
||||||
</Routes>
|
</Routes>
|
||||||
</MantineProvider>
|
</MantineProvider>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { FlashMessage } from "ui/modules/server/FlashMessage";
|
|||||||
import { AuthRegister } from "ui/routes/auth/auth.register";
|
import { AuthRegister } from "ui/routes/auth/auth.register";
|
||||||
import { BkndModalsProvider } from "ui/modals";
|
import { BkndModalsProvider } from "ui/modals";
|
||||||
import { useBkndWindowContext } from "bknd/client";
|
import { useBkndWindowContext } from "bknd/client";
|
||||||
|
import type { BkndAdminProps } from "ui/Admin";
|
||||||
import ToolsRoutes from "./tools";
|
import ToolsRoutes from "./tools";
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -24,10 +25,12 @@ try {
|
|||||||
|
|
||||||
export function Routes({
|
export function Routes({
|
||||||
BkndWrapper,
|
BkndWrapper,
|
||||||
|
options,
|
||||||
basePath = "",
|
basePath = "",
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
BkndWrapper: ComponentType<{ children: ReactNode }>;
|
BkndWrapper: ComponentType<{ children: ReactNode; options?: BkndAdminProps["config"] }>;
|
||||||
|
options?: BkndAdminProps["config"];
|
||||||
basePath?: string;
|
basePath?: string;
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
}) {
|
}) {
|
||||||
@@ -43,7 +46,7 @@ export function Routes({
|
|||||||
<Route path="/auth/login" component={AuthLogin} />
|
<Route path="/auth/login" component={AuthLogin} />
|
||||||
<Route path="/auth/register" component={AuthRegister} />
|
<Route path="/auth/register" component={AuthRegister} />
|
||||||
|
|
||||||
<BkndWrapper>
|
<BkndWrapper options={options}>
|
||||||
<BkndModalsProvider>
|
<BkndModalsProvider>
|
||||||
<Route path="/" nest>
|
<Route path="/" nest>
|
||||||
<Root>
|
<Root>
|
||||||
|
|||||||
Reference in New Issue
Block a user