tailosoft / jhipster-primeng-blueprint

This blueprint can be used to generate jhipster project with primeng frontend instead of bootstrap (work in progress)
Apache License 2.0
26 stars 21 forks source link

Dies when trying to generate entity dropdown when property is Enumeration #8

Closed ngholbrook closed 4 years ago

ngholbrook commented 4 years ago

`Error: Copying template ./angular/src/main/webapp/app/entities/entity-management-update.component.html.ejs failed. [TypeError: /home/ngholbrook/work/code/desmw/primeng/nodemodules/generator-jhipster-primeng-blueprint/generators/entity-client/templates/angular/src/main/webapp/app/entities/entity-management-update.component.html.ejs:51 49| <label jhiTranslate="<%= translationKey %>" for="field<%= fieldName %>"<% if (fields[idx].javadoc) { if (enableTranslation) { %> [pTooltip]="'<%= i18nKeyPrefix %>.help.<%= fieldName %>' | translate"<% } else { %> pTooltip="<%= fields[idx].javadoc %>"<% } } %>><%= fieldNameHumanized %> 50| <% if (fields[idx].fieldIsEnum) { %>

51| <p-dropdown [options]="<%= fields[idx].fieldName %>Options" name="<%= fieldName %>" formControlName="<%= fieldName %>" id="field<%= fieldName %>" placeholder="Choose"<% if(!fields[idx].fieldValidateRules.includes('required')){ %> [showClear]="true"<% } %><% if (fields[idx].partOfId) { %> [readonly]="edit"<% } %>> 52| <ng-template let-<%= fields[idx].fieldName %> pTemplate="item">{{'<%= ${angularAppName}.${fields[idx].fieldType} %>.' + <%= fields[idx].fieldName %>.label | translate}} 53| 54| <% } else { %>

Cannot read property 'includes' of undefined] at Environment.error (/home/ngholbrook/work/code/desmw/primeng/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/environment.js:176:40) at module.exports.error (/home/ngholbrook/work/code/desmw/primeng/node_modules/generator-jhipster-primeng-blueprint/node_modules/generator-jhipster/generators/generator-base.js:1478:18) at /home/ngholbrook/work/code/desmw/primeng/node_modules/generator-jhipster-primeng-blueprint/node_modules/generator-jhipster/generators/utils.js:231:23 at tryHandleCache (/home/ngholbrook/work/code/desmw/primeng/node_modules/ejs/lib/ejs.js:254:14) at Object.exports.renderFile (/home/ngholbrook/work/code/desmw/primeng/node_modules/ejs/lib/ejs.js:482:10) at renderContent (/home/ngholbrook/work/code/desmw/primeng/node_modules/generator-jhipster-primeng-blueprint/node_modules/generator-jhipster/generators/utils.js:227:9) at Object.copyWebResource (/home/ngholbrook/work/code/desmw/primeng/node_modules/generator-jhipster-primeng-blueprint/node_modules/generator-jhipster/generators/utils.js:194:9) at module.exports.copyTemplate (/home/ngholbrook/work/code/desmw/primeng/node_modules/generator-jhipster-primeng-blueprint/node_modules/generator-jhipster/generators/generator-base.js:885:31) at module.exports.processHtml (/home/ngholbrook/work/code/desmw/primeng/node_modules/generator-jhipster-primeng-blueprint/node_modules/generator-jhipster/generators/generator-base.js:936:14) at /home/ngholbrook/work/code/desmw/primeng/node_modules/generator-jhipster-primeng-blueprint/node_modules/generator-jhipster/generators/generator-base.js:1912:42 Emitted 'error' event on Generator instance at: at Immediate. (/home/ngholbrook/work/code/desmw/primeng/node_modules/generator-jhipster-primeng-blueprint/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:433:22) at processImmediate (internal/timers.js:439:21)`

yelhouti commented 4 years ago

Context? jdl? explenation?

ngholbrook commented 4 years ago

All I have is the stack trace which I pasted. I'll try to get more information. I have an entity Car which has a property CarType. CarType is an Enumeration. When the generator tries to create the options list on the Car form, it blows up. I haven't figured it out yet. If I do, I'll send you more information.

Thanks

Nic

On Fri, Apr 10, 2020 at 1:06 PM yelhouti notifications@github.com wrote:

Context? jdl? explenation?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/elhoutico/jhipster-primeng-blueprint/issues/8#issuecomment-612174223, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEJHOOHOHIAW5AAWN2NYZUDRL5U2FANCNFSM4MFTS27A .

ngholbrook commented 4 years ago

After I have generated the initial blueprint, I put my json entities into the .jhipster folder and run "jhipster --with-entities" to generate entities. This is when it crashes.

Nic

On Fri, Apr 10, 2020 at 4:46 PM ngh ngholbrook@gmail.com wrote:

All I have is the stack trace which I pasted. I'll try to get more information. I have an entity Car which has a property CarType. CarType is an Enumeration. When the generator tries to create the options list on the Car form, it blows up. I haven't figured it out yet. If I do, I'll send you more information.

Thanks

Nic

On Fri, Apr 10, 2020 at 1:06 PM yelhouti notifications@github.com wrote:

Context? jdl? explenation?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/elhoutico/jhipster-primeng-blueprint/issues/8#issuecomment-612174223, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEJHOOHOHIAW5AAWN2NYZUDRL5U2FANCNFSM4MFTS27A .

yelhouti commented 4 years ago

you should not put the .jdl in the .jhipster folder, it should be on the root of your project, and you can create the project from scratch using the bluepint

ngholbrook commented 4 years ago

Not .jdl. The .json entity files.

On Sat, Apr 11, 2020 at 9:11 AM yelhouti notifications@github.com wrote:

you should not put the .jdl in the .jhipster folder, it should be on the root of your project, and you can create the project from scratch using the bluepint

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/elhoutico/jhipster-primeng-blueprint/issues/8#issuecomment-612442711, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEJHOOENTDHE524V72ESQDTRMCCCLANCNFSM4MFTS27A .

yelhouti commented 4 years ago

maybe you can remove entities until you find the on creating the problem and post it here please. we are using this in many projects without a problem

ngholbrook commented 4 years ago

I will give it a try. I'm pretty sure it is when I have an entity with a property that is an enumeration.

On Sat, Apr 11, 2020 at 3:38 PM yelhouti notifications@github.com wrote:

maybe you can remove entities until you find the on creating the problem and post it here please. we are using this in many projects without a problem

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/elhoutico/jhipster-primeng-blueprint/issues/8#issuecomment-612518646, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEJHOOGYG7ML4QRPAPQAGOLRMDPPBANCNFSM4MFTS27A .

yelhouti commented 4 years ago

@ngholbrook could you try both syntaxes of enum, with and without the value? Thanks

ngholbrook commented 4 years ago

Yep. I'll give it a try.

On Sun, Apr 12, 2020 at 12:26 PM yelhouti notifications@github.com wrote:

@ngholbrook https://github.com/ngholbrook could you try both syntaxes of enum, with and without the value? Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/elhoutico/jhipster-primeng-blueprint/issues/8#issuecomment-612656945, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEJHOOBBNKN42QVHLWCDVADRMIBWBANCNFSM4MFTS27A .

ngholbrook commented 4 years ago

Actually, it is the default enumeration type defined by JHipster. I only define the field values as seen below. Jhipster turns it into an enum.

"name": "CrmIssue", "fields": [ { "fieldName": "cdrlUuid", "fieldType": "String" }, { "fieldName": "dateCreated", "fieldType": "Instant" }, { "fieldName": "createdBy", "fieldType": "String" }, { "fieldName": "issueStatus", "fieldType": "IssueStatus", "fieldValues": "COMMENT_REVIEW,COMMENT_REWORK,RESPONSE_REVIEW,EXPORT,RESOLVED,DELETED" } ]

Nic

On Sun, Apr 12, 2020 at 1:32 PM ngh ngholbrook@gmail.com wrote:

Yep. I'll give it a try.

On Sun, Apr 12, 2020 at 12:26 PM yelhouti notifications@github.com wrote:

@ngholbrook https://github.com/ngholbrook could you try both syntaxes of enum, with and without the value? Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/elhoutico/jhipster-primeng-blueprint/issues/8#issuecomment-612656945, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEJHOOBBNKN42QVHLWCDVADRMIBWBANCNFSM4MFTS27A .

ngholbrook commented 4 years ago

The code below is where I tracked the error to. I haven't figured out why yet. If I remove what I have highlighted in red, it works with my enum's. It is part of the entity-management-update-component.html.ejs line 51 where it is generating the options list. I don't have time right now to understand what it is supposed to be doing but a null check on fields[idx].fieldValidateRules would probably fix it since it is undefined when it tries to check the includes('required').

Thanks again for your efforts.

Nic

<% if (fields[idx].fieldIsEnum) { %> <p-dropdown [options]="<%= fields[idx].fieldName %>Options" name="<%= fieldName %>" formControlName="<%= fieldName %>" id="field<%= fieldName %>" placeholder="Choose"*<% if(!fields[idx].fieldValidateRules.includes('required')){ %> [showClear]="true"<% } %><% if (fields[idx].partOfId) { %> [readonly]="edit"<% } %>*> <ng-template let-<%= fields[idx].fieldName %> pTemplate="item">{{'<%= ${angularAppName}.${fields[idx].fieldType} %>.' + <%= fields[idx].fieldName %>.label | translate}} <% } else { %>

On Sun, Apr 12, 2020 at 12:26 PM yelhouti notifications@github.com wrote:

@ngholbrook https://github.com/ngholbrook could you try both syntaxes of enum, with and without the value? Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/elhoutico/jhipster-primeng-blueprint/issues/8#issuecomment-612656945, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEJHOOBBNKN42QVHLWCDVADRMIBWBANCNFSM4MFTS27A .

ngholbrook commented 4 years ago

Hate to be a pain but it looks like it also has trouble if you set pagination: 'no'. Works again if I use infinite-scroll or paging. I'll see if I can figure more out and try to fix it. I've just got a ton of work right now so it may be a while before I can get to it.

Thanks

Nic

On Sun, Apr 12, 2020 at 7:19 PM ngh ngholbrook@gmail.com wrote:

The code below is where I tracked the error to. I haven't figured out why yet. If I remove what I have highlighted in red, it works with my enum's. It is part of the entity-management-update-component.html.ejs line 51 where it is generating the options list. I don't have time right now to understand what it is supposed to be doing but a null check on fields[idx].fieldValidateRules would probably fix it since it is undefined when it tries to check the includes('required').

Thanks again for your efforts.

Nic

<% if (fields[idx].fieldIsEnum) { %> <p-dropdown [options]="<%= fields[idx].fieldName %>Options" name="<%= fieldName %>" formControlName="<%= fieldName %>" id="field<%= fieldName %>" placeholder="Choose"*<% if(!fields[idx].fieldValidateRules.includes('required')){ %> [showClear]="true"<% } %><% if (fields[idx].partOfId) { %> [readonly]="edit"<% } %>*> <ng-template let-<%= fields[idx].fieldName %> pTemplate="item">{{'<%= ${angularAppName}.${fields[idx].fieldType} %>.' + <%= fields[idx].fieldName %>.label | translate}} <% } else { %>

On Sun, Apr 12, 2020 at 12:26 PM yelhouti notifications@github.com wrote:

@ngholbrook https://github.com/ngholbrook could you try both syntaxes of enum, with and without the value? Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/elhoutico/jhipster-primeng-blueprint/issues/8#issuecomment-612656945, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEJHOOBBNKN42QVHLWCDVADRMIBWBANCNFSM4MFTS27A .

yelhouti commented 4 years ago

@ngholbrook could you try again with the latest version