fix: translate __orphan__ sentinel to null in bulk move; ungrouped units now fully bulk-operable
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
"label": "Blurb",
|
"label": "Blurb",
|
||||||
"labelPlural": "Blurbs",
|
"labelPlural": "Blurbs",
|
||||||
"symbol": "bl",
|
"symbol": "bl",
|
||||||
"group": "florp",
|
"group": "agroup",
|
||||||
"toBase": 1
|
"toBase": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -13,42 +13,14 @@
|
|||||||
"label": "Snorp",
|
"label": "Snorp",
|
||||||
"labelPlural": "Snorps",
|
"labelPlural": "Snorps",
|
||||||
"symbol": "sn",
|
"symbol": "sn",
|
||||||
"group": "florp",
|
"group": "agroup",
|
||||||
"toBase": 7.5
|
"toBase": 7.5
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "krumble",
|
|
||||||
"label": "Krumble",
|
|
||||||
"labelPlural": "Krumbles",
|
|
||||||
"symbol": "kr",
|
|
||||||
"group": "the-third-group",
|
|
||||||
"toBase": 0.25
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "wobbit",
|
|
||||||
"label": "Wobbit",
|
|
||||||
"labelPlural": "Wobbits",
|
|
||||||
"symbol": "wb",
|
|
||||||
"group": "florp",
|
|
||||||
"toBase": 144
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
"id": "florp",
|
"id": "agroup",
|
||||||
"label": "Florp Units",
|
"label": "agroup",
|
||||||
"baseUnitId": "blurb",
|
|
||||||
"toUniversal": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "non-florp-units",
|
|
||||||
"label": "The other group",
|
|
||||||
"baseUnitId": "",
|
|
||||||
"toUniversal": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "the-third-group",
|
|
||||||
"label": "The third group",
|
|
||||||
"baseUnitId": "",
|
"baseUnitId": "",
|
||||||
"toUniversal": 1
|
"toUniversal": 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,12 +125,14 @@
|
|||||||
if (bulkAction === 'move') {
|
if (bulkAction === 'move') {
|
||||||
if (!bulkMoveTargetGroupId || checkedUnitIds.size === 0) return;
|
if (!bulkMoveTargetGroupId || checkedUnitIds.size === 0) return;
|
||||||
formError = null;
|
formError = null;
|
||||||
|
// '__orphan__' is the sentinel value for "move to ungrouped" (group: null)
|
||||||
|
const targetGroup = bulkMoveTargetGroupId === '__orphan__' ? null : bulkMoveTargetGroupId;
|
||||||
const results = await Promise.all(
|
const results = await Promise.all(
|
||||||
[...checkedUnitIds].map((unitId) =>
|
[...checkedUnitIds].map((unitId) =>
|
||||||
fetch(`/admin/api/units/${unitId}`, {
|
fetch(`/admin/api/units/${unitId}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ group: bulkMoveTargetGroupId })
|
body: JSON.stringify({ group: targetGroup })
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user