mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
debug page starter
This commit is contained in:
parent
b4f172baa5
commit
9f84bbaac7
7 changed files with 111 additions and 18 deletions
|
@ -5,6 +5,7 @@ const prefix = baseURL + "debug";
|
||||||
|
|
||||||
const debugURLs = {
|
const debugURLs = {
|
||||||
version: `${prefix}/version`,
|
version: `${prefix}/version`,
|
||||||
|
lastRecipe: `${prefix}/last-recipe-json`,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -12,4 +13,8 @@ export default {
|
||||||
let response = await apiReq.get(debugURLs.version);
|
let response = await apiReq.get(debugURLs.version);
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
async getLastJson() {
|
||||||
|
let response = await apiReq.get(debugURLs.lastRecipe);
|
||||||
|
return response.data;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
38
frontend/src/components/Debug/LastRecipe.vue
Normal file
38
frontend/src/components/Debug/LastRecipe.vue
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<template>
|
||||||
|
<v-card>
|
||||||
|
<v-card-title>Last Scrapped JSON Data</v-card-title>
|
||||||
|
<v-card-text>
|
||||||
|
<VJsoneditor
|
||||||
|
@error="logError()"
|
||||||
|
v-model="lastRecipeJson"
|
||||||
|
height="1500px"
|
||||||
|
:options="jsonEditorOptions"
|
||||||
|
/>
|
||||||
|
</v-card-text>
|
||||||
|
</v-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import VJsoneditor from "v-jsoneditor";
|
||||||
|
import api from "@/api";
|
||||||
|
export default {
|
||||||
|
components: { VJsoneditor },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
lastRecipeJson: {},
|
||||||
|
jsonEditorOptions: {
|
||||||
|
mode: "code",
|
||||||
|
search: false,
|
||||||
|
mainMenuBar: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
async mounted() {
|
||||||
|
this.lastRecipeJson = await api.meta.getLastJson();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
37
frontend/src/components/Debug/LogFile.vue
Normal file
37
frontend/src/components/Debug/LogFile.vue
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<template>
|
||||||
|
<v-card>
|
||||||
|
<v-card-title>Last Scrapped JSON Data</v-card-title>
|
||||||
|
<v-card-text>
|
||||||
|
<VJsoneditor
|
||||||
|
@error="logError()"
|
||||||
|
v-model="lastRecipeJson"
|
||||||
|
height="1500px"
|
||||||
|
:options="jsonEditorOptions"
|
||||||
|
/>
|
||||||
|
</v-card-text>
|
||||||
|
</v-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import VJsoneditor from "v-jsoneditor";
|
||||||
|
export default {
|
||||||
|
components: { VJsoneditor },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
lastRecipeJson: "",
|
||||||
|
jsonEditorOptions: {
|
||||||
|
mode: "code",
|
||||||
|
search: false,
|
||||||
|
mainMenuBar: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
async mounted() {
|
||||||
|
this.lastRecipeJson = "Hello \n 123 \n 567"
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
20
frontend/src/pages/Debug.vue
Normal file
20
frontend/src/pages/Debug.vue
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<LastRecipe />
|
||||||
|
<LogFile class="mt-2" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import LastRecipe from "@/components/Debug/LastRecipe";
|
||||||
|
import LogFile from "@/components/Debug/LogFile";
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
LastRecipe,
|
||||||
|
LogFile,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
|
@ -7,12 +7,14 @@ import SettingsPage from "./pages/SettingsPage";
|
||||||
import AllRecipesPage from "./pages/AllRecipesPage";
|
import AllRecipesPage from "./pages/AllRecipesPage";
|
||||||
import CategoryPage from "./pages/CategoryPage";
|
import CategoryPage from "./pages/CategoryPage";
|
||||||
import MeaplPlanPage from "./pages/MealPlanPage";
|
import MeaplPlanPage from "./pages/MealPlanPage";
|
||||||
|
import Debug from "./pages/Debug";
|
||||||
import MealPlanThisWeekPage from "./pages/MealPlanThisWeekPage";
|
import MealPlanThisWeekPage from "./pages/MealPlanThisWeekPage";
|
||||||
import api from "@/api";
|
import api from "@/api";
|
||||||
|
|
||||||
export const routes = [
|
export const routes = [
|
||||||
{ path: "/", component: HomePage },
|
{ path: "/", component: HomePage },
|
||||||
{ path: "/mealie", component: HomePage },
|
{ path: "/mealie", component: HomePage },
|
||||||
|
{ path: "/debug", component: Debug },
|
||||||
{ path: "/search", component: SearchPage },
|
{ path: "/search", component: SearchPage },
|
||||||
{ path: "/recipes/all", component: AllRecipesPage },
|
{ path: "/recipes/all", component: AllRecipesPage },
|
||||||
{ path: "/recipes/:category", component: CategoryPage },
|
{ path: "/recipes/:category", component: CategoryPage },
|
||||||
|
|
|
@ -3,22 +3,12 @@ from fastapi import FastAPI
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
|
|
||||||
# import utils.startup as startup
|
# import utils.startup as startup
|
||||||
from app_config import APP_VERSION, PORT, PRODUCTION, WEB_PATH, docs_url, redoc_url
|
from app_config import (APP_VERSION, PORT, PRODUCTION, WEB_PATH, docs_url,
|
||||||
from routes import (
|
redoc_url)
|
||||||
backup_routes,
|
from routes import (backup_routes, debug_routes, meal_routes, migration_routes,
|
||||||
debug_routes,
|
setting_routes, static_routes, theme_routes)
|
||||||
meal_routes,
|
from routes.recipe import (all_recipe_routes, category_routes,
|
||||||
migration_routes,
|
recipe_crud_routes, tag_routes)
|
||||||
setting_routes,
|
|
||||||
static_routes,
|
|
||||||
theme_routes,
|
|
||||||
)
|
|
||||||
from routes.recipe import (
|
|
||||||
all_recipe_routes,
|
|
||||||
category_routes,
|
|
||||||
recipe_crud_routes,
|
|
||||||
tag_routes,
|
|
||||||
)
|
|
||||||
from services.settings_services import default_settings_init
|
from services.settings_services import default_settings_init
|
||||||
from utils.logger import logger
|
from utils.logger import logger
|
||||||
|
|
||||||
|
@ -92,6 +82,7 @@ if __name__ == "__main__":
|
||||||
port=PORT,
|
port=PORT,
|
||||||
reload=True,
|
reload=True,
|
||||||
debug=True,
|
debug=True,
|
||||||
|
log_level="info",
|
||||||
workers=1,
|
workers=1,
|
||||||
forwarded_allow_ips="*",
|
forwarded_allow_ips="*",
|
||||||
)
|
)
|
||||||
|
|
|
@ -22,7 +22,7 @@ async def get_last_recipe_json():
|
||||||
return json.loads(f.read())
|
return json.loads(f.read())
|
||||||
|
|
||||||
|
|
||||||
@router.get("/log/{num}", response_class=HTMLResponse)
|
@router.get("/log/{num}")
|
||||||
async def get_log(num: int):
|
async def get_log(num: int):
|
||||||
""" Doc Str """
|
""" Doc Str """
|
||||||
with open(LOGGER_FILE, "rb") as f:
|
with open(LOGGER_FILE, "rb") as f:
|
||||||
|
@ -53,4 +53,4 @@ def tail(f, lines=20):
|
||||||
block_end_byte -= BLOCK_SIZE
|
block_end_byte -= BLOCK_SIZE
|
||||||
block_number -= 1
|
block_number -= 1
|
||||||
all_read_text = b"".join(reversed(blocks))
|
all_read_text = b"".join(reversed(blocks))
|
||||||
return b"<br/>".join(all_read_text.splitlines()[-total_lines_wanted:])
|
return b"/n".join(all_read_text.splitlines()[-total_lines_wanted:])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue