-
Notifications
You must be signed in to change notification settings - Fork 560
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
[ENHANCE] - Added Module to NameSpace [Owner].Module.[Module] #2910
Conversation
[ENHANCE] - Added Module to NameSpace [Owner].Module.[Module]
@vnetonline there appears to be an issue with this PR: In Oqtane.Client\Modules\Admin\ModuleCreator\Index.razor it has:
And in Oqtane.Client\Modules\Admin\ModuleDefinitions\Create.razor it has:
Notice the ".Module." identifier in the _location in the first one which does not exists in the second one. |
@vnetonline after further research... this PR impacts the ability for people to create their own custom templates. The template feature was developed with extensibility in mind... you can include your own custom templates beneath the Oqtane.Server\wwwroot\Modules\Templates folder and the UI will automatically recognize them and allow you to choose them from the list. However the problem is that there are some properties which are set independently from the template - they are set in code:
So if you were using a custom module template, this PR now forces a ".Module." segment in your namespaces which would be incompatible with your custom template. @leigh-pointer has some custom module templates which are available for download which likely now have issues due to this change. I believe that the optimal solution is for a template to be able to describe their behavior so that the framework does not make incorrect assumptions or force a specific approach. Perhaps these properties could be added to the Template.json file to mitgate this issue. This is my fault for not doing a thorough impact assessment. This item will require more research. |
@sbwalker I see your point, on a further thought about this, wouldn't it be better if developers were able to specify their namespace as a whole? For example, a developer could have various related modules in a simple case:
A developer could also have a more complex case like: Acme.Software.Bookstore which has
Further, they could have functionality within their module like Acme.Software.Bookstore.Payments
we could then parse the Namesapce to take the last element (nested Namespace) to create the
Also, the template creator doesn't have plurals in mind for example if I have the following The table name and Get List methods should be called So having fields for just Owner and Product in the UI restrict this ability to be truly extensible for the developer we could just have one field to fill in which is their NameSpace. This would remove the open to your thoughts! |
@vnetonline after reviewing this further, there may not be any need for the logic which sets the ModuleDefinitionName or ServerManagerType... these are only required for the Module Creator scenario (ie. where someone adds a Module Creator modue to a page). There is talk in a different thread about removing that option and only relying on the Create Module option in Module Management (which does not require the logic above). In regards to the suggestion about asking the user for a Namespace, why couldn't a developer simply enter "Acme.Software.Bookstore" as their Organization? I believe the templating logic supported this previously. In fact, if you wanted to use the convention which includes ".Module" you could have entered it into the Organization field as "MyCompany.Module". But after the changes in this PR it actually forces the ".Module" segment whether you want it or not. I am wondering if this needs to be rolled back. |
Yup I agree we should roll this back |
Let me know if you want me to submit a PR |
@vnetonline #3200 introduces a Namespace property to the template.json which can be used to define the naming convention in a template. It eliminates the hard-coding and restores freedom to custom templates. We can leave the default templates in their current form... people can create custom templates if they want a different naming convention. |
Thanks @sbwalker i will give it a test and report back |
@vnetonline I am guessing you did not have a chance to test this. It appears that my change caused a problem with ServerManagerType which I will need to fix in 4.0.4. |
Sorry @sbwalker didn't get chance to to test this I will find some time today |
[ENHANCE] - Added Module to NameSpace [Owner].Module.[Module]