feat: add bulk pricing refresh
Quality / test (push) Canceled after 0s

This commit is contained in:
2026-09-10 00:07:29 -04:00
parent e0d231facc
commit 099ec2fe72
10 changed files with 205 additions and 11 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ export const BulkArchiveSelection = {
docs: {
description: {
story:
"The physical inventory section supports selecting active copies and archiving them in one authenticated operation.",
"The physical inventory section supports selecting active copies for archive or asynchronous pricing refresh operations.",
},
},
},
+27
View File
@@ -12,6 +12,7 @@ import {
listAdminConditions,
listAdminInventory,
listAdminProducts,
refreshAdminInventoryPricing,
} from "@/services/admin-catalog-service.js";
import {
createAdminListing,
@@ -213,6 +214,24 @@ async function archiveSelectedInventory() {
}
}
async function refreshSelectedPricing() {
if (!selectedInventoryIds.value.length) return;
isSaving.value = true;
try {
const jobs = await refreshAdminInventoryPricing(
selectedInventoryIds.value,
pricingProvider.value,
csrfToken(),
);
pricingJobs.value = [...jobs, ...pricingJobs.value];
selectedInventoryIds.value = [];
} catch (requestError) {
error.value = requestError;
} finally {
isSaving.value = false;
}
}
async function createListing() {
const item = inventory.value.find(
(candidate) => candidate.id === listingInventoryId.value,
@@ -956,6 +975,14 @@ onMounted(load);
>
Archive selected
</button>
<button
class="button button--secondary"
type="button"
:disabled="isSaving || !selectedInventoryIds.length"
@click="refreshSelectedPricing"
>
Refresh pricing
</button>
</div>
<p v-if="!inventory.length && !isLoading" class="state state--empty">
No physical copies yet.
@@ -30,4 +30,12 @@ export function archiveAdminInventory(inventoryItemIds, csrfToken) {
headers: { 'x-csrf-token': csrfToken },
body: JSON.stringify({ action: 'ARCHIVE', inventoryItemIds }),
});
}
export function refreshAdminInventoryPricing(inventoryItemIds, providerId, csrfToken) {
return request('/admin/bulk', {
method: 'POST',
headers: { 'x-csrf-token': csrfToken },
body: JSON.stringify({ action: 'PRICING_REFRESH', inventoryItemIds, providerId }),
});
}