-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a more explanatory example project #6
Comments
We have encountered this problem and I think it's not related to this plugin, but rather to AdminBro. Try changing component path from |
@SimonB407 Thanks for your help, but unfortunately it doesn't seem too work in my case :( |
@humbkr which versions (admin-bro and plugins), do you use? |
|
Hi, I would like to also see some example using some async chain like this: import { AdminModule } from '@admin-bro/nestjs';
import { Database, Resource } from '@admin-bro/typeorm';
import { GraphqlService, TypeOrmService } from '@config';
import * as Models from '@models';
import { User } from '@models';
import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { ServeStaticModule } from '@nestjs/serve-static';
import { getRepositoryToken, TypeOrmModule } from '@nestjs/typeorm';
import AdminBro from 'admin-bro';
import { join } from 'path';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import * as Resolvers from './resolvers';
AdminBro.registerAdapter({ Database, Resource });
@Module({
imports: [
ServeStaticModule.forRoot({
renderPath: '/',
rootPath: join(__dirname, 'static'),
exclude: ['/graphql', '/admin'],
serveStaticOptions: {
redirect: true
}
}),
GraphQLModule.forRootAsync({
useClass: GraphqlService
}),
TypeOrmModule.forRootAsync({
useClass: TypeOrmService
}),
TypeOrmModule.forFeature([...Object.values(Models)]), // probably wrong
AdminModule.createAdminAsync({
imports: [TypeOrmModule.forFeature([...Object.values(Models)])],
inject: [getRepositoryToken(User)], // not working
useFactory: (adminModel: User) => ({
adminBroOptions: {
rootPath: '/admin',
resources: [{ resource: adminModel }]
}
})
})
],
controllers: [AppController],
providers: [...Object.values(Resolvers), AppService]
})
export class AppModule {} If I am using async I am not able to use your package. Thanks. |
Thanks @SimonB407 after spending an unbelievable amount of time trying to get a simple component to work this fixed the issue ...
to
This is very unintuitive, especially when the first case "appears" to "build". This is a great library, please find a way to include this in the documentation! FYI: The error I got was
The origin was calling My compiled js was:
My typescript was:
|
After a bit more investigation I figured out why this wasn't woking and how to get it to work. What I originally failed to realise is that
By using By using To fix this I had to setup Here are the steps I followed to achieve this: Update
Updated
You also don't need Finally I updated my
Hope this helps someone else. |
I didn't manage to make NestJS's asset feature work. It simply didn't copy anything. {
"link-admin-components-assets": "ln -s $PWD/apps/server/src/admin-module/components $PWD/dist/apps/server/components"
} and then // __dirname = /path/to/myProject/dist/apps/server
components: {
list: AdminBro.bundle(path.join(__dirname, './components/EnumArray')),
}, |
Hi, I have same problem but my project uses |
Thanks to @maxpeterson , I resolved the issue I had with user components not being bundled in prod build. If anyone else is struggling with bundling of custom components in production, you can use my commit here as a reference. If you're struggling with nestjs+adminjs setup in general, I guess, you can use my repo for reference too. It's not very clean and there is only one entity hooked up, but it should clear some things up, if you're struggling. |
If you're using bare express.js (without any frameworks built on top if it), you should use https://github.com/SoftwareBrothers/adminjs-expressjs instead. |
Thank you all of the above comments, I learned a lot from them (especially dklymenk's commit diff view) and here are some more steps I configured on my nestjs repo to get it work: my nest-cli.json
I made this tweak to make sure the bundling matches the dir in dist And I manually deleted |
Thanks to @maxpeterson this solved our problem in the latest version of Adminjs. This works as well with the new API componentLoader.add('showImages', './components/images.show.tsx') |
Hi, thanks for your work.
I spent hours trying to customise a property in the list without any success, and I'd like some pointers.
My project uses
I'm following the docs to the letter.
In the configuration I added:
My ./components/reference-in-list is defined as the following:
All I got is an error:
Is there any special configuration to add when using adminBro with nest.js?
There are no docs on your website for using your product with nest.js and the example-app is very basic.
The text was updated successfully, but these errors were encountered: