From 8f255ccfd465b1cb397d7663ff0993088635ce66 Mon Sep 17 00:00:00 2001 From: Song Lim Date: Sat, 12 Oct 2024 22:25:56 +0800 Subject: [PATCH 01/30] fix: typo in frontend development start command (#278) --- docs/en/contribute/get-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/contribute/get-started.md b/docs/en/contribute/get-started.md index d335e7ad..5ae6d3eb 100644 --- a/docs/en/contribute/get-started.md +++ b/docs/en/contribute/get-started.md @@ -35,7 +35,7 @@ swagger update command `task swag` ### Frontend Development Notes -start command `task: ui:dev` +start command `task ui:dev` 1. The frontend is a Vue 3 app with Nuxt.js that uses Tailwind and DaisyUI for styling. 2. We're using Vitest for our automated testing. You can run these with `task ui:watch`. From 65b247573eba3cc188d8ad84cfd2d4718bb26ccb Mon Sep 17 00:00:00 2001 From: Tonya Date: Sat, 12 Oct 2024 14:29:21 +0000 Subject: [PATCH 02/30] Merge pull request #259 * feat: duplicate item button --- frontend/pages/item/[id]/index/edit.vue | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/frontend/pages/item/[id]/index/edit.vue b/frontend/pages/item/[id]/index/edit.vue index 1f3cd0bc..9afb3ff8 100644 --- a/frontend/pages/item/[id]/index/edit.vue +++ b/frontend/pages/item/[id]/index/edit.vue @@ -8,6 +8,7 @@ import MdiDelete from "~icons/mdi/delete"; import MdiPencil from "~icons/mdi/pencil"; import MdiContentSaveOutline from "~icons/mdi/content-save-outline"; + import MdiContentCopy from "~icons/mdi/content-copy"; definePageMeta({ middleware: ["auth"], @@ -59,6 +60,37 @@ refresh(); }); + async function duplicateItem() { + const { error, data } = await api.items.create({ + name: `${item.value.name} Copy`, + description: item.value.description, + locationId: item.value.location!.id, + parentId: item.value.parent?.id, + labelIds: item.value.labels.map(l => l.id), + }); + + if (error) { + toast.error("Failed to duplicate item"); + return; + } + + // add extra fields + const { error: updateError } = await api.items.update(data.id, { + ...item.value, + id: data.id, + labelIds: data.labels.map(l => l.id), + locationId: data.location!.id, + name: data.name, + }); + + if (updateError) { + toast.error("Failed to duplicate item"); + return; + } + + navigateTo(`/item/${data.id}`); + } + async function saveItem() { if (!item.value.location?.id) { toast.error("Failed to save item: no location selected"); @@ -470,6 +502,12 @@ Advanced + + + Duplicate +