mirror of
https://github.com/directus/directus.git
synced 2026-01-24 07:07:58 -05:00
Improve IDs field interaction for Flows item read/update/delete operations when empty (#14090)
* Prevent empty key array in item operations * tweak visual on app side
This commit is contained in:
@@ -42,7 +42,7 @@ export default defineOperationApi<Options>({
|
||||
|
||||
let result: PrimaryKey | PrimaryKey[] | null;
|
||||
|
||||
if (!key) {
|
||||
if (!key || (Array.isArray(key) && key.length === 0)) {
|
||||
result = await itemsService.deleteByQuery(sanitizedQueryObject);
|
||||
} else {
|
||||
const keys = toArray(key);
|
||||
|
||||
@@ -42,7 +42,7 @@ export default defineOperationApi<Options>({
|
||||
|
||||
let result: Item | Item[] | null;
|
||||
|
||||
if (!key) {
|
||||
if (!key || (Array.isArray(key) && key.length === 0)) {
|
||||
result = await itemsService.readByQuery(sanitizedQueryObject);
|
||||
} else {
|
||||
const keys = toArray(key);
|
||||
|
||||
@@ -53,7 +53,7 @@ export default defineOperationApi<Options>({
|
||||
|
||||
let result: PrimaryKey | PrimaryKey[] | null;
|
||||
|
||||
if (!key) {
|
||||
if (!key || (Array.isArray(key) && key.length === 0)) {
|
||||
result = await itemsService.updateByQuery(sanitizedQueryObject, payloadObject, { emitEvents });
|
||||
} else {
|
||||
const keys = toArray(key);
|
||||
|
||||
@@ -14,7 +14,7 @@ export default defineOperationApp({
|
||||
},
|
||||
{
|
||||
label: '$t:operations.item-delete.key',
|
||||
text: key ? toArray(key).join(', ') : '--',
|
||||
text: toArray(key).length > 0 ? toArray(key).join(', ') : '--',
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export default defineOperationApp({
|
||||
},
|
||||
{
|
||||
label: '$t:operations.item-read.key',
|
||||
text: key ? toArray(key).join(', ') : '--',
|
||||
text: toArray(key).length > 0 ? toArray(key).join(', ') : '--',
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export default defineOperationApp({
|
||||
},
|
||||
{
|
||||
label: '$t:operations.item-update.key',
|
||||
text: key ? toArray(key).join(', ') : '--',
|
||||
text: toArray(key).length > 0 ? toArray(key).join(', ') : '--',
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user