Skip to content

Commit 1eb9f72

Browse files
committed
chore: dev-demo menu badge counts SQLite cars waiting for listing approval instead of the seconds of the current minute AdminForth/2005
1 parent e8208d4 commit 1eb9f72

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

‎dev-demo/api.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export function initApi(app: Express, admin: IAdminForth) {
8282
},
8383
admin.express.authorize(
8484
async (req: IAdminUserExpressRequest, res: Response) => {
85-
admin.refreshMenuBadge('menuTimestamp', req.adminUser);
85+
admin.refreshMenuBadge('carsSqliteUnlisted', req.adminUser);
8686
const cars_sqlite_list = await admin.resource('cars_sl').list( [Filters.EQ('id', '0')] );
8787
console.log('cars_sqlite_list', cars_sqlite_list);
8888
const cars_pg_list = await admin.resource('cars_pg').list( [Filters.EQ('id', '0')] );

‎dev-demo/index.ts‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,6 @@ export const admin = new AdminForth({
193193
icon: 'flowbite:chart-pie-solid',
194194
component: '@@/AfComponents.vue',
195195
path: '/af-components',
196-
itemId: 'menuTimestamp',
197-
badge: async (adminUser: AdminUser, adminForth: IAdminForth) => {
198-
const now = new Date();
199-
return now.getSeconds();
200-
},
201-
badgeTooltip: 'Seconds in current minute',
202196
},
203197
{
204198
label: 'Dashboard',
@@ -218,6 +212,9 @@ export const admin = new AdminForth({
218212
{
219213
label: 'Cars (SQLITE)',
220214
resourceId: 'cars_sl',
215+
itemId: 'carsSqliteUnlisted',
216+
badge: async (adminUser: AdminUser, adminForth: IAdminForth) => adminForth.resource('cars_sl').count([Filters.EQ('listed', false)]),
217+
badgeTooltip: 'Cars waiting for listing approval',
221218
},
222219
{
223220
label: 'Cars (MySQL)',

0 commit comments

Comments
 (0)