Skip to content

Commit 5a54749

Browse files
committed
fix: update showIn default value logic and validation for actions
1 parent b9d6baf commit 5a54749

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

adminforth/modules/configValidator.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,15 +417,18 @@ export default class ConfigValidator implements IConfigValidator {
417417
if (!action.id) {
418418
action.id = md5hash(action.name);
419419
}
420+
421+
const defaultListValue = !!(action.action || action.url);
422+
420423
if (!action.showIn) {
421424
action.showIn = {
422-
list: true,
425+
list: defaultListValue,
423426
listThreeDotsMenu: false,
424427
showButton: false,
425428
showThreeDotsMenu: false,
426429
}
427430
} else {
428-
action.showIn.list = action.showIn.list ?? true;
431+
action.showIn.list = action.showIn.list ?? defaultListValue;
429432
action.showIn.listThreeDotsMenu = action.showIn.listThreeDotsMenu ?? false;
430433
action.showIn.showButton = action.showIn.showButton ?? false;
431434
action.showIn.showThreeDotsMenu = action.showIn.showThreeDotsMenu ?? false;
@@ -437,7 +440,7 @@ export default class ConfigValidator implements IConfigValidator {
437440
}
438441

439442
const shownInNonBulk = action.showIn.list || action.showIn.listThreeDotsMenu || action.showIn.showButton || action.showIn.showThreeDotsMenu;
440-
if (shownInNonBulk && !action.bulkHandler && !action.action && !action.url) {
443+
if (shownInNonBulk && !action.action && !action.url) {
441444
errors.push(`Resource "${res.resourceId}" action "${action.name}" has showIn enabled for non-bulk locations (list, listThreeDotsMenu, showButton, showThreeDotsMenu) but has no "action" or "url" handler. Either add an "action" handler or set those showIn flags to false.`);
442445
}
443446
});

0 commit comments

Comments
 (0)