forked from mirrors/homebox
feat: asset tags/ids (#142)
* add schema * run db migration * bulk seed asset IDs * breaking: update runtime options * conditionally increment asset IDs * update API endpoints * fix import asset id assignment * refactor display + marshal/unmarshal * add docs page * add to form field * hide 000-000 values * update ENV vars
This commit is contained in:
parent
976f68252d
commit
6dc2ae1bea
32 changed files with 905 additions and 72 deletions
|
@ -163,6 +163,25 @@
|
|||
passwordChange.current = "";
|
||||
passwordChange.loading = false;
|
||||
}
|
||||
|
||||
async function ensureAssetIDs() {
|
||||
const { isCanceled } = await confirm.open(
|
||||
"Are you sure you want to ensure all assets have an ID? This will take a while and cannot be undone."
|
||||
);
|
||||
|
||||
if (isCanceled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const result = await api.actions.ensureAssetIDs();
|
||||
|
||||
if (result.error) {
|
||||
notify.error("Failed to ensure asset IDs.");
|
||||
return;
|
||||
}
|
||||
|
||||
notify.success(`${result.data.completed} assets have been updated.`);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -286,6 +305,32 @@
|
|||
</div>
|
||||
</BaseCard>
|
||||
|
||||
<BaseCard>
|
||||
<template #title>
|
||||
<BaseSectionHeader>
|
||||
<Icon name="mdi-warning" class="mr-2 -mt-1 text-base-600" />
|
||||
<span class="text-base-600"> Actions </span>
|
||||
<template #description>
|
||||
Apply Actions to your inventory in bulk. These are irreversible actions. Be careful.
|
||||
</template>
|
||||
</BaseSectionHeader>
|
||||
|
||||
<div class="py-4 border-t-2 border-gray-300">
|
||||
<div class="grid grid-cols-1 md:grid-cols-4 gap-10">
|
||||
<div class="col-span-3">
|
||||
<h4>Manage Asset IDs</h4>
|
||||
<p class="text-sm">
|
||||
Ensures that all items in your inventory have a valid asset_id field. This is done by finding the
|
||||
highest current asset_id field in the database and applying the next value to each item that has an
|
||||
unset asset_id field. This is done in order of the created_at field.
|
||||
</p>
|
||||
</div>
|
||||
<BaseButton class="btn-primary mt-auto" @click="ensureAssetIDs"> Ensure Asset IDs </BaseButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</BaseCard>
|
||||
|
||||
<BaseCard>
|
||||
<template #title>
|
||||
<BaseSectionHeader>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue