mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-23 15:19:41 +02:00
fix(backend): 🐛 Fix recipe page issues (#778)
* fix(backend): 🐛 Fix favorite assignment on backend * fix(frontend): 🐛 fix printer button on recipe page * style(frontend): 🚸 add user feadback on copy of recipe link * fix(frontend): 🐛 Fix enableLandscape incorrect bindings to remove duplicate values * feat(frontend): ✨ add ingredient copy button for markdown list -[ ] format * feat(frontend): ✨ add remove prefix button to bulk entry * fix(frontend): 🐛 disable random button when no recipes are present * fix(frontend): ✨ fix .zip download error * fix(frontend): 🚸 close image dialog on upload/get * fix(frontend): 🐛 fix assignment on creation for categories and tags * feat(frontend): ✨ Open editor on creation / fix edit button on main screen * fix(frontend): 🐛 fix false negative regex match for urls on creationg page * feat(frontend): 🚸 provide better user feadback when recipe exists * feat(frontend): ✨ lock bulk importer on submit * remove zip from navigation * fix(frontend): ✨ rerender recipes on delete Co-authored-by: Hayden K <hay-kot@pm.me>
This commit is contained in:
parent
ec3b53cdc3
commit
9f8c61a75a
27 changed files with 323 additions and 163 deletions
|
@ -287,12 +287,20 @@
|
|||
</v-col>
|
||||
</v-row>
|
||||
<v-card-actions class="justify-end">
|
||||
<BaseButton delete @click="bulkUrls = []"> Clear </BaseButton>
|
||||
<BaseButton
|
||||
delete
|
||||
@click="
|
||||
bulkUrls = [];
|
||||
lockBulkImport = false;
|
||||
"
|
||||
>
|
||||
Clear
|
||||
</BaseButton>
|
||||
<v-spacer></v-spacer>
|
||||
<BaseButton color="info" @click="bulkUrls.push({ url: '', categories: [], tags: [] })">
|
||||
<template #icon> {{ $globals.icons.createAlt }} </template> New
|
||||
</BaseButton>
|
||||
<BaseButton :disabled="bulkUrls.length === 0" @click="bulkCreate">
|
||||
<BaseButton :disabled="bulkUrls.length === 0 || lockBulkImport" @click="bulkCreate">
|
||||
<template #icon> {{ $globals.icons.check }} </template> Submit
|
||||
</BaseButton>
|
||||
</v-card-actions>
|
||||
|
@ -352,13 +360,13 @@ export default defineComponent({
|
|||
const api = useApiSingleton();
|
||||
const router = useRouter();
|
||||
|
||||
function handleResponse(response: any) {
|
||||
function handleResponse(response: any, edit: Boolean = false) {
|
||||
if (response?.status !== 201) {
|
||||
state.error = true;
|
||||
state.loading = false;
|
||||
return;
|
||||
}
|
||||
router.push(`/recipe/${response.data}`);
|
||||
router.push(`/recipe/${response.data}?edit=${edit}`);
|
||||
}
|
||||
|
||||
// ===================================================
|
||||
|
@ -385,12 +393,17 @@ export default defineComponent({
|
|||
|
||||
async function createByUrl(url: string) {
|
||||
if (!domUrlForm.value.validate() || url === "") {
|
||||
console.log("Invalid URL", url);
|
||||
return;
|
||||
}
|
||||
state.loading = true;
|
||||
const { response } = await api.recipes.createOneByUrl(url);
|
||||
if (response?.status !== 201) {
|
||||
state.error = true;
|
||||
// @ts-ignore
|
||||
if (!response?.error?.response?.data?.detail?.message) {
|
||||
state.error = true;
|
||||
}
|
||||
|
||||
state.loading = false;
|
||||
return;
|
||||
}
|
||||
|
@ -408,7 +421,7 @@ export default defineComponent({
|
|||
return;
|
||||
}
|
||||
const { response } = await api.recipes.createOne({ name });
|
||||
handleResponse(response);
|
||||
handleResponse(response, true);
|
||||
}
|
||||
|
||||
// ===================================================
|
||||
|
@ -432,6 +445,7 @@ export default defineComponent({
|
|||
// Bulk Importer
|
||||
|
||||
const bulkUrls = ref([{ url: "", categories: [], tags: [] }]);
|
||||
const lockBulkImport = ref(false);
|
||||
|
||||
async function bulkCreate() {
|
||||
if (bulkUrls.value.length === 0) {
|
||||
|
@ -442,6 +456,7 @@ export default defineComponent({
|
|||
|
||||
if (response?.status === 202) {
|
||||
alert.success("Bulk Import process has started");
|
||||
lockBulkImport.value = true;
|
||||
} else {
|
||||
alert.error("Bulk import process has failed");
|
||||
}
|
||||
|
@ -450,6 +465,7 @@ export default defineComponent({
|
|||
return {
|
||||
bulkCreate,
|
||||
bulkUrls,
|
||||
lockBulkImport,
|
||||
debugTreeView,
|
||||
tabs,
|
||||
domCreateByName,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue