Skip to content

Commit 28de247

Browse files
authored
Merge pull request #162 from morph-data/feature/morph-data-frontend
Feature/integrate @morph-data/frontend
2 parents 908838c + 7b9ace9 commit 28de247

44 files changed

Lines changed: 572 additions & 1083 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/morph/api/app.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
inertia_request_validation_exception_handler,
2222
inertia_version_conflict_exception_handler,
2323
)
24-
from starlette.middleware.cors import CORSMiddleware
25-
from starlette.middleware.sessions import SessionMiddleware
26-
2724
from morph.api.error import ApiBaseError, InternalError, render_error_html
2825
from morph.api.handler import router
2926
from morph.api.plugin import plugin_app
@@ -32,6 +29,8 @@
3229
MorphFunctionMetaObjectCacheManager,
3330
MorphGlobalContext,
3431
)
32+
from starlette.middleware.cors import CORSMiddleware
33+
from starlette.middleware.sessions import SessionMiddleware
3534

3635
# configuration values
3736

@@ -42,10 +41,11 @@
4241
# set true to MORPH_LOCAL_DEV_MODE to use local frontend server
4342
is_local_dev_mode = True if os.getenv("MORPH_LOCAL_DEV_MODE") == "true" else False
4443

44+
project_root = find_project_root_dir()
45+
4546

4647
def custom_compile_logic():
4748
logger.info("Compiling python and sql files...")
48-
project_root = find_project_root_dir()
4949
context = MorphGlobalContext.get_instance()
5050
errors = context.load(project_root)
5151
if len(errors) > 0:
@@ -129,8 +129,6 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
129129
inertia_request_validation_exception_handler,
130130
)
131131

132-
frontend_dir = os.path.join(os.getcwd(), ".morph", "frontend")
133-
134132

135133
def get_inertia_config():
136134
templates_dir = os.path.join(Path(__file__).resolve().parent, "templates")
@@ -148,15 +146,16 @@ def get_inertia_config():
148146
use_flash_messages=True,
149147
use_flash_errors=True,
150148
entrypoint_filename="main.tsx",
151-
assets_prefix="/src",
149+
root_directory=".morph/frontend",
152150
dev_url=frontend_url,
153151
)
154152

155153
return InertiaConfig(
156154
templates=Jinja2Templates(directory=templates_dir),
157-
manifest_json_path=os.path.join(frontend_dir, "dist", "manifest.json"),
155+
manifest_json_path=os.path.join(project_root, "dist", "manifest.json"),
158156
environment="production",
159157
entrypoint_filename="main.tsx",
158+
root_directory=".morph/frontend",
160159
)
161160

162161

@@ -167,13 +166,13 @@ def get_inertia_config():
167166
if is_local_dev_mode:
168167
app.mount(
169168
"/src",
170-
StaticFiles(directory=os.path.join(frontend_dir, "src")),
169+
StaticFiles(directory=os.path.join(project_root, "src")),
171170
name="src",
172171
)
173172
else:
174173
app.mount(
175174
"/assets",
176-
StaticFiles(directory=os.path.join(frontend_dir, "dist", "assets")),
175+
StaticFiles(directory=os.path.join(project_root, "dist", "assets")),
177176
name="assets",
178177
)
179178

core/morph/api/templates/index.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@
1616
window.__vite_plugin_react_preamble_installed__ = true;
1717
</script>
1818
{% endif %}
19-
20-
<script src="https://cdn.tailwindcss.com"></script>
21-
<script>
22-
tailwind.config = {
23-
darkMode: "class",
24-
};
25-
</script>
2619
</head>
2720
<body>
2821
{% inertia_body %}

core/morph/frontend/template/.eslintrc.cjs

Lines changed: 0 additions & 18 deletions
This file was deleted.

core/morph/frontend/template/.gitignore

Lines changed: 0 additions & 32 deletions
This file was deleted.

core/morph/frontend/template/index.html

Lines changed: 0 additions & 12 deletions
This file was deleted.

core/morph/frontend/template/package.json

Lines changed: 0 additions & 41 deletions
This file was deleted.

core/morph/frontend/template/src/admin/AdminPage.tsx

Lines changed: 0 additions & 5 deletions
This file was deleted.

core/morph/frontend/template/src/admin/common/useResourcesQuery.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

core/morph/frontend/template/src/admin/common/useScheduledJobsQuery.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

core/morph/frontend/template/src/admin/common/utils/useQuery.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)