A continuation of HomeBox the inventory and organization system built for the Home User
Add demo mode check for wipe inventory action
copilot-swe-agent[bot]ff355f3cd826
diff --git a/frontend/locales/en.json b/frontend/locales/en.jsonindex a7abe21b..8af42e5e 100644--- a/frontend/locales/en.json+++ b/frontend/locales/en.json@@ -748,6 +748,9 @@"zero_datetimes_sub": "Resets the time value for all date time fields in your inventory to the beginning of the date. This is to fix a bug that was introduced early on in the development of the site that caused the time value to be stored with the time which caused issues with date fields displaying accurate values. '<a class=\"link\" href=\"https://github.com/hay-kot/homebox/issues/236\" target=\"_blank\">'See Github Issue #236 for more details.'</a>'"},"actions_sub": "Apply Actions to your inventory in bulk. These are irreversible actions. '<b>'Be careful.'</b>'",+ "demo_mode_error": {+ "wipe_inventory": "Inventory, labels and locations cannot be wiped whilst Homebox is in demo mode. Please ensure that you are not in demo mode and try again."+ },"import_export": "Import/Export","import_export_set": {"export": "Export Inventory",diff --git a/frontend/pages/tools.vue b/frontend/pages/tools.vueindex 33bb7503..b8b82fca 100644--- a/frontend/pages/tools.vue+++ b/frontend/pages/tools.vue@@ -131,6 +131,13 @@const api = useUserApi();const confirm = useConfirm();++ // Fetch status to check for demo mode+ const pubApi = usePublicApi();+ const { data: status } = useAsyncData(async () => {+ const { data } = await pubApi.status();+ return data;+ });function getBillOfMaterials() {const url = api.reports.billOfMaterialsURL();@@ -228,6 +235,12 @@}async function wipeInventory() {+ // Check if in demo mode+ if (status.value?.demo) {+ await confirm.open(t("tools.demo_mode_error.wipe_inventory"));+ return;+ }+openDialog(DialogID.WipeInventory, {onClose: async (result) => {if (!result) {