Skip to content
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

Manage Settings bug #2958

Closed
rcpacheco opened this issue Jun 29, 2023 Discussed in #2957 · 14 comments
Closed

Manage Settings bug #2958

rcpacheco opened this issue Jun 29, 2023 Discussed in #2957 · 14 comments

Comments

@rcpacheco
Copy link
Contributor

Discussed in #2957

Originally posted by rcpacheco June 29, 2023
After activating the DNF.Project, per video 2, It activated properly and was able to create a project.
But when I tried to display the module's "Manage Settings" I got the following error:

image

image

@sbwalker
Copy link
Member

sbwalker commented Jun 30, 2023

@rcpacheco very strange.... I am not able to reproduce this error on https://www.dnfprojects.com. Does Manage Settings work for any of your other modules in your site (ie. Html/Text, etc...)

@rcpacheco
Copy link
Contributor Author

Yes, Manage Settings work for any of the other modules. I will repeat a couple of times the process an will give you further feedback. Thanks

@sbwalker
Copy link
Member

sbwalker commented Jun 30, 2023

Ok... it does not sound like a framework issue... more likely an issue in the DNF.Projects module itself. I will keep investigating.

@rcpacheco
Copy link
Contributor Author

rcpacheco commented Jun 30, 2023

I did yesterday the exercise in a Windows 10 machine with the latest dev version.
Today I tried with a linux machine and got some interesting errors.
In linux I used dotnet console commands to build the project inside the DNF.Module.Project folder. I compiled succesfully:
image

But then I tried to check if the projects files where properly copied to the debug folder and saw:

image

I noticed that strange ''$'\r' file.

I deleted it and repeat and manually run debug.sh with same result. Did cat to the file and copied the instrucctions from the console and executed them succesfully and got the content copied to the server project.
Launched the app again and while trying to activate the module got an error.

The message was:

System.ArgumentNullException: Value cannot be null. (Parameter 'source')
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Linq.OrderedEnumerable`2..ctor(IEnumerable`1 source, Func`2 keySelector, IComparer`1 comparer, Boolean descending, OrderedEnumerable`1 parent)
   at System.Linq.Enumerable.OrderBy[TSource,TKey](IEnumerable`1 source, Func`2 keySelector)
   at DNF.Module.Project.Services.ProjectService.GetProjectsAsync(Int32 ModuleId) in /home/rpacheco/Documents/SaaS/DNF.Module.Project/Client/Services/ProjectService.cs:line 21
   at DNF.Module.Project.Index.OnInitializedAsync() in /home/rpacheco/Documents/SaaS/DNF.Module.Project/Client/Modules/DNF.Module.Project/Index.razor:line 53

Will repeat again the same exercise in windows, later in the day.

@sbwalker
Copy link
Member

sbwalker commented Jul 1, 2023

The Linux capabilities were recently introduced in 4.0 based on feedback from @AnjaSimons in #2913. If there is an issue with them I would appreciate any help you can provide as I do not develop in Linux.

@sbwalker
Copy link
Member

sbwalker commented Jul 1, 2023

The DNF.Projects error seems to be related to the module assuming data exists in your database. I will upgrade the module to .NET 6 and Oqtane 4.0 and ensure it is functional. If you want to experiment with Oqtane I would suggest you simply create a new module using the Module Creator in the Develop page of a new install.

@rcpacheco
Copy link
Contributor Author

Sorry for the delay, but have been very busy.

Today I recreated the exercise in windows 10 with the dev branch commit 563695c

I got the same error in trying to clic the settings option:

image

image

I tried to find the missing type DNF.Project.Settings, DNF.Project.Client.Oqtane in the modules table, but did not find it:
image

Where should I look for it ?

@rcpacheco
Copy link
Contributor Author

Does the fact that in the project Settings is under DNF.Module.Project an not under DNF.Project has something to do?

image

@sbwalker
Copy link
Member

sbwalker commented Jul 7, 2023

I have not had time to uograde the DNF.Project module to .NET 7 yet. I mentioned above that if you want to experiment with Oqtane I would suggest you simply create a new module using the Module Creator in the Develop page of a new install.

@rcpacheco
Copy link
Contributor Author

Yes indeed, I did so. I used the same name, but the DNF project I created was no coming from any repo. It was created with the module creator tool. I just used the same name.

@rcpacheco
Copy link
Contributor Author

I did yesterday the exercise in a Windows 10 machine with the latest dev version. Today I tried with a linux machine and got some interesting errors. In linux I used dotnet console commands to build the project inside the DNF.Module.Project folder. I compiled succesfully: image

But then I tried to check if the projects files where properly copied to the debug folder and saw:

image

I noticed that strange ''$'\r' file.

I deleted it and repeat and manually run debug.sh with same result. Did cat to the file and copied the instrucctions from the console and executed them succesfully and got the content copied to the server project. Launched the app again and while trying to activate the module got an error.

The message was:

System.ArgumentNullException: Value cannot be null. (Parameter 'source')
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Linq.OrderedEnumerable`2..ctor(IEnumerable`1 source, Func`2 keySelector, IComparer`1 comparer, Boolean descending, OrderedEnumerable`1 parent)
   at System.Linq.Enumerable.OrderBy[TSource,TKey](IEnumerable`1 source, Func`2 keySelector)
   at DNF.Module.Project.Services.ProjectService.GetProjectsAsync(Int32 ModuleId) in /home/rpacheco/Documents/SaaS/DNF.Module.Project/Client/Services/ProjectService.cs:line 21
   at DNF.Module.Project.Index.OnInitializedAsync() in /home/rpacheco/Documents/SaaS/DNF.Module.Project/Client/Modules/DNF.Module.Project/Index.razor:line 53

Will repeat again the same exercise in windows, later in the day.

Regarding the issue of the mysterious ''$'\r' file in linux, I changed the file endings of the debug.sh in the Package project from CRLF line terminators to LF using the linux command dos2unix, and now the command ran properly and copied the module dll's, pdb's and files for the wwwroot\Modules directory.

Therefore, my recommendation is to change the file endings of the linux bash scripts (debug.sh and release.sh) in the template folder Oqtane.Server/wwwroot/Modules/Templates/External/Package and indicate git to preserve the line endings in the code repo using the .gitattributes file with the following contents:
Oqtane.Server/wwwroot/Modules/Templates/External/Package/*.sh eol=lf

@rcpacheco
Copy link
Contributor Author

Does the fact that in the project Settings is under DNF.Module.Project an not under DNF.Project has something to do?

image

Also, following up on this subject, it seem to me that since the path of the Oqtane.Server/wwwroot/Modules/Templates/External/Client/Modules/[Owner].Module.[Module]/Settings.razor file shows [Owner].Module.[Module]

I wonder if the line:
private string resourceType = "[Owner].[Module].Settings, [Owner].[Module].Client.Oqtane"; // for localization
should read instead:
private string resourceType = "[Owner].Module.[Module].Settings, [Owner].Module.[Module].Client.Oqtane"; // for localization

What do you think?
image

sbwalker added a commit to sbwalker/oqtane.framework that referenced this issue Jul 13, 2023
sbwalker added a commit that referenced this issue Jul 13, 2023
fix bash script line endings and preserve using gitattributes (credit @rcpacheco in #2958)
@sbwalker
Copy link
Member

@rcpacheco can you please review/test #3019

@sbwalker
Copy link
Member

@rcpacheco I have upgraded the DNF.Projects repo to .NET 7 - oqtane/DNF.Projects#7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants