-
Notifications
You must be signed in to change notification settings - Fork 725
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
[RFR] Starting migration to ES6 #330
Conversation
I finally get a display on dashboard view, using the new ES6 classes. I'm wondering if we shouldn't break retro-compatibility with this major change. Indeed, to make it compliant with the old version, I had to remove getters and setters (to prevent name conflict issues) to put function like: layout() {
if (arguments.length) {
this._layout = arguments[0];
return this;
}
return this._layout;
} Moreover, I am not happy with the way I render classes publicly accessible, using: window.ngadmin = window.ngadmin || {};
window.ngadmin.Application = Application; But I didn't find a cleaner solution. Still in (lot of) WIP. |
@fzaninotto, I spotted something weird with master blog example config: comment.editionView()
.fields(comment.creationView().fields())
.fields([
nga.field(null, 'template')
.label('')
.template('<post-link entry="entry"></post-link>')
]); We call the I propose to replace it by: comment.editionView().fields([
comment.creationView().fields(),
nga.field(null, 'template')
.label('')
.template('<post-link entry="entry"></post-link>')
]); Do you agree? It would break a little bit BC, but not sure a lot of people use this syntax. Of course it will be mentioned in the changelog; |
You're right that |
We already pass both fields and array to post.editionView()
// ...
.fields([
post.creationView().fields(),
nga.field('tags', 'reference_many')
.targetEntity(tag)
.targetField(nga.field('name'))
// ...
]); This is why we have to flatten the fields array at some places. I propose to add a
What do you think? |
I updated PR description with left tasks. |
dest: 'examples/blog/build/', | ||
expand: true | ||
}, | ||
corejs: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need as already embedded in ng-admin-configuration.js
Switching to RFR. |
All tests are passing locally. Travis fails because of SauceLabs. I let you review it, and then I'll push my changes to re-trigger another build. |
|
||
## Configuration factory | ||
|
||
Configuration is now done through a `ConfigurationFactory`. You can retrieve it directly from Angular DI. You just have to retrieve your application from this factory instead of the `NgAdminConfigurationProvider` as previously: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no trace of ConfigurationFactory
in the code below.
Please check out https://github.com/marmelab/ng-admin/pull/327/files and the current master version of custom Fields to make sure you don't forget anything. |
super(name); | ||
this._type = "number"; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't forget fractionSize()
Display something on dashboard view Add field and entity factory methods Implement ES6 compilation into build process Implement dashboard view retro-compatibility Fix dashboard order columns Fix list screens (relationships doesn't work for now) Fix list views using correct field type
08db795
to
984398d
Compare
[RFR] Starting migration to ES6
Thanks a lot! |
This PR aims to introduce ES6 features on ng-admin. For a first PR, we will restrict to Main/component/service/config folder.
Retro-compatibility should be preserved, still using getters and setters the functional way (
field.validation({ required: true })
).Left tasks:
fields
setter behavior, calling it several times should append fields instead of replacing all of them