mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 21:06:04 +00:00
removed admin config from server, theme is now client side, fixed module manager migrations
This commit is contained in:
@@ -20,12 +20,12 @@ import { Dropdown } from "../../components/overlay/Dropdown";
|
||||
import { useFlow } from "../../container/use-flows";
|
||||
import * as AppShell from "../../layouts/AppShell/AppShell";
|
||||
import { SectionHeader } from "../../layouts/AppShell/AppShell";
|
||||
import { useTheme } from "ui/client/use-theme";
|
||||
|
||||
export function FlowEdit({ params }) {
|
||||
const { app } = useBknd();
|
||||
const { color_scheme: theme } = app.getAdminConfig();
|
||||
const { basepath } = app.getAdminConfig();
|
||||
const prefix = `~/${basepath}/settings`.replace(/\/+/g, "/");
|
||||
const { theme } = useTheme();
|
||||
const prefix = app.getAbsolutePath("settings");
|
||||
const [location, navigate] = useLocation();
|
||||
const [execution, setExecution] = useState<Execution>();
|
||||
const [selectedNodes, setSelectedNodes] = useState<Node[]>([]);
|
||||
|
||||
@@ -17,12 +17,11 @@ const TestRoutes = lazy(() => import("./test"));
|
||||
export function Routes() {
|
||||
const { app } = useBknd();
|
||||
const { theme } = useTheme();
|
||||
const { basepath } = app.getAdminConfig();
|
||||
|
||||
return (
|
||||
<div id="bknd-admin" className={theme + " antialiased"}>
|
||||
<FlashMessage />
|
||||
<Router base={basepath}>
|
||||
<Router base={app.options.basepath}>
|
||||
<Switch>
|
||||
<Route path="/auth/login" component={AuthLogin} />
|
||||
<Route path="/" nest>
|
||||
|
||||
@@ -15,7 +15,7 @@ import { ServerSettings } from "./routes/server.settings";
|
||||
import { IconButton } from "ui/components/buttons/IconButton";
|
||||
|
||||
function SettingsSidebar() {
|
||||
const { version, schema, actions } = useBknd();
|
||||
const { version, schema, actions, app } = useBknd();
|
||||
useBrowserTitle(["Settings"]);
|
||||
|
||||
async function handleRefresh() {
|
||||
@@ -151,11 +151,10 @@ const FallbackRoutes = ({
|
||||
...settingProps
|
||||
}: SettingProps<any> & { module: string }) => {
|
||||
const { app } = useBknd();
|
||||
const basepath = app.getAdminConfig();
|
||||
const prefix = `~/${basepath}/settings`.replace(/\/+/g, "/");
|
||||
const prefix = app.getAbsolutePath("settings");
|
||||
|
||||
return (
|
||||
<Route path={`/${module}`} nest>
|
||||
<Route path={module} nest>
|
||||
<Switch>
|
||||
<Route
|
||||
path="/"
|
||||
|
||||
@@ -44,8 +44,7 @@ const uiSchema = {
|
||||
export const AuthSettings = ({ schema: _unsafe_copy, config }) => {
|
||||
const _s = useBknd();
|
||||
const _schema = cloneDeep(_unsafe_copy);
|
||||
const { basepath } = _s.app.getAdminConfig();
|
||||
const prefix = `~/${basepath}/settings`.replace(/\/+/g, "/");
|
||||
const prefix = _s.app.getAbsolutePath("settings");
|
||||
|
||||
try {
|
||||
const user_entity = config.entity_name ?? "users";
|
||||
|
||||
@@ -68,8 +68,7 @@ export const DataSettings = ({
|
||||
config,
|
||||
}: { schema: ModuleSchemas["data"]; config: ModuleConfigs["data"] }) => {
|
||||
const { app } = useBknd();
|
||||
const basepath = app.getAdminConfig().basepath;
|
||||
const prefix = `~/${basepath}/settings`.replace(/\/+/g, "/");
|
||||
const prefix = app.getAbsolutePath("settings");
|
||||
const entities = Object.keys(config.entities ?? {});
|
||||
|
||||
function fillEntities(schema: any, key: string = "entity") {
|
||||
|
||||
@@ -31,8 +31,7 @@ const uiSchema = {
|
||||
|
||||
export const FlowsSettings = ({ schema, config }) => {
|
||||
const { app } = useBknd();
|
||||
const { basepath } = app.getAdminConfig();
|
||||
const prefix = `~/${basepath}/settings`.replace(/\/+/g, "/");
|
||||
const prefix = app.getAbsolutePath("settings");
|
||||
|
||||
function fillTasks(schema: any, flow: any, key: string) {
|
||||
const tasks = Object.keys(flow.tasks ?? {});
|
||||
|
||||
@@ -17,15 +17,11 @@ const uiSchema = {
|
||||
};
|
||||
|
||||
export const ServerSettings = ({ schema: _unsafe_copy, config }) => {
|
||||
const { app, adminOverride } = useBknd();
|
||||
const { basepath } = app.getAdminConfig();
|
||||
const { app } = useBknd();
|
||||
const _schema = cloneDeep(_unsafe_copy);
|
||||
const prefix = `~/${basepath}/settings`.replace(/\/+/g, "/");
|
||||
const prefix = app.getAbsolutePath("settings");
|
||||
|
||||
const schema = _schema;
|
||||
if (adminOverride) {
|
||||
schema.properties.admin.readOnly = true;
|
||||
}
|
||||
|
||||
return (
|
||||
<Route path="/server" nest>
|
||||
@@ -33,14 +29,6 @@ export const ServerSettings = ({ schema: _unsafe_copy, config }) => {
|
||||
path="/"
|
||||
component={() => (
|
||||
<Setting
|
||||
options={{
|
||||
showAlert: () => {
|
||||
if (adminOverride) {
|
||||
return "The admin settings are read-only as they are overriden. Remaining server configuration can be edited.";
|
||||
}
|
||||
return;
|
||||
},
|
||||
}}
|
||||
schema={schema}
|
||||
uiSchema={uiSchema}
|
||||
config={config}
|
||||
|
||||
Reference in New Issue
Block a user