fix: add custom action for fixing broken date/times (#268)

This commit is contained in:
Hayden 2023-02-08 17:59:04 -09:00 committed by GitHub
parent bd933af874
commit ce2fc7712a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 240 additions and 59 deletions

View file

@ -180,6 +180,25 @@
notify.success(`${result.data.completed} assets have been updated.`);
}
async function resetItemDateTimes() {
const { isCanceled } = await confirm.open(
"Are you sure you want to reset all date and time values? This will take a while and cannot be undone."
);
if (isCanceled) {
return;
}
const result = await api.actions.resetItemDateTimes();
if (result.error) {
notify.error("Failed to reset date and time values.");
return;
}
notify.success(`${result.data.completed} assets have been updated.`);
}
</script>
<template>
@ -313,7 +332,7 @@
</template>
</BaseSectionHeader>
<div class="py-4 border-t-2 border-gray-300">
<div class="py-4 border-t-2 border-gray-300 space-y-8">
<div class="grid grid-cols-1 md:grid-cols-4 gap-10">
<div class="col-span-3">
<h4>Manage Asset IDs</h4>
@ -325,6 +344,20 @@
</div>
<BaseButton class="btn-primary mt-auto" @click="ensureAssetIDs"> Ensure Asset IDs </BaseButton>
</div>
<div class="grid grid-cols-1 md:grid-cols-4 gap-10">
<div class="col-span-3">
<h4>Zero Item Date Times</h4>
<p class="text-sm">
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>
</p>
</div>
<BaseButton class="btn-primary mt-auto" @click="resetItemDateTimes"> Zero Item Date Times </BaseButton>
</div>
</div>
</template>
</BaseCard>