Open kunall435 opened 4 years ago
Did you register your UserAdmin class in AdminSite? If not, than you should do something like this:
import { JobEntity } from './../dashboard/job.entity';
import {
DefaultAdminModule,
DefaultAdminSite,
AdminEntity,
AdminUserEntity,
} from 'nestjs-admin';
import { Module } from '@nestjs/common';
export class UserAdmin extends AdminEntity {
entity = JobEntity;
listDisplay = ['title', 'isAprooved'];
fields = ['title', 'isAprooved'];
}
@Module({
imports: [DefaultAdminModule],
})
export class BackofficeModule {
constructor(private readonly adminSite: DefaultAdminSite) {
adminSite.register('Administration', AdminUserEntity);
adminSite.register('UserAdministation', UserAdmin);
}
}
And than just import BackofficeModule in your AppModule
Hey thanks for the super fast reply, yes definetly I've registered this one in the Module class
Also I've got the listDisplay
paramter working correctly, I can only see the title
and the isAprooved
field in the display of jobs but while editing the job, its having some issues.
const coreModule = AdminCoreModuleFactory.createAdminCoreModule({});
const authModulezxc = AdminAuthModuleFactory.createAdminAuthModule({
adminCoreModule: coreModule, // what admin module are you configuring authentication for
credentialValidator: adminCredentialValidator, // how do you validate credentials
imports: [TypeOrmModule.forFeature([UserEntity])], // what modules export the dependencies of the credentialValidator available
providers: [], // additional providers that will be instanciated and exported by the AdminAuthModuleFactory
});
@Module({
imports: [
forwardRef(() => AuthModule),
TypeOrmModule.forFeature([UserRepository]),
coreModule,
authModulezxc,
],
controllers: [UserController],
exports: [UserService, coreModule],
providers: [UserService],
})
export class UserModule {
constructor(private readonly _adminSite: DefaultAdminSite) {
_adminSite.register('Jobs', UserAdmin);
}
}
Yeah...just have checked, and seem's like it's really don't work, as you said before - listDisplay and searchFields works fine, but fields doesn't.
Yeah, thanks for the confirmation. Can you please provide a fix for that?
Oh, sorry, but I'm not a collaborator on this project xD Just like this admin panel
@williamdclt Can you help here?
@maksimoancha, did we get a fix for this?
I've made a class extending from the AdminEntity and added the fields array as given in the documentation but still on adding/changing properties, it shows me all the fields from the column.
Is there something which I'm doing wrong?