Skip to content

Commit c19517b

Browse files
committed
fix: add message into custom action type, add icons collection
1 parent 77090a6 commit c19517b

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

adminforth/modules/codeInjector.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,16 @@ class CodeInjector implements ICodeInjector {
365365
}
366366
});
367367

368+
this.adminforth.config.resources.forEach((resource) => {
369+
if (resource.options?.actions) {
370+
resource.options.actions.forEach((action) => {
371+
if (action.icon) {
372+
icons.push(action.icon);
373+
}
374+
});
375+
}
376+
});
377+
368378
const uniqueIcons = Array.from(new Set(icons));
369379

370380
// icons are collectionName:iconName. Get list of all unique collection names:

adminforth/types/Back.ts

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -721,20 +721,28 @@ interface AdminForthInputConfigCustomization {
721721
}
722722

723723
export interface AdminForthActionInput {
724-
name: string,
724+
name: string;
725+
showIn?: {
726+
list?: boolean,
727+
showButton?: boolean,
728+
showThreeDotsMenu?: boolean,
729+
};
725730
action: (params: {
726-
adminforth: IAdminForth,
727-
resource: AdminForthResource,
728-
recordId: string,
729-
adminUser: AdminUser,
730-
extra?: HttpExtra,
731-
tr: Function,
732-
}) => Promise<{ok: boolean, error?: string}>,
733-
icon?: string,
734-
id?: string,
731+
adminforth: IAdminForth;
732+
resource: AdminForthResource;
733+
recordId: string;
734+
adminUser: AdminUser;
735+
extra?: HttpExtra;
736+
tr: Function;
737+
}) => Promise<{
738+
ok: boolean;
739+
error?: string;
740+
message?: string;
741+
}>;
742+
icon?: string;
743+
id?: string;
735744
}
736745

737-
738746
export interface AdminForthResourceInput extends Omit<AdminForthResourceInputCommon, 'columns' | 'hooks' | 'options'> {
739747

740748
/**

0 commit comments

Comments
 (0)