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

Angular: Quick Filter buttons are not generated anymore #26356

Closed
1 task done
OmarHawk opened this issue Jun 4, 2024 · 1 comment · Fixed by #26357
Closed
1 task done

Angular: Quick Filter buttons are not generated anymore #26356

OmarHawk opened this issue Jun 4, 2024 · 1 comment · Fixed by #26357

Comments

@OmarHawk
Copy link
Contributor

OmarHawk commented Jun 4, 2024

Overview of the issue

Until at least version 8.1.0, buttons for filtering the other side of the entity were generated (initial feature: #18370). This is at least in 8.5.0 not the case anymore, as the corresponding relationships are already filtered out beforehand, so the links are not generated anymore.

Motivation for or Use Case

Feature worked before and kind of all of the of the code for that is still in there.

Reproduce the error
  1. Have an application with a ManyToOne / OneToMany /ManyToMany relationship using Angular as frontend.
  2. Generate application
  3. Expect buttons in the list view pointing from one Entity to the filtered list of the other. (see Display a link to a filtered view for the Many Side of a OneToMany / ManyToOne relationship on the One side #18370)
  4. Miss out these buttons
Related issues

Changes in #25140 are causing this, I think. Previously, the list of relationships passed to the client generator were unfiltered apart from the skipClient flag.

Suggest a Fix

get rid of the persistable/eagerload filtering here. Don't know, what effect this has elsewhere, should be tested - or only be changed for the Angular client in doubt:

export const filterEntityPropertiesForClient = (entity: Entity): Entity => ({
...entity,
fields: entity.fields.filter(field => !field.skipClient),
relationships: entity.relationships.filter(rel => !rel.skipClient && (rel.persistableRelationship || rel.relationshipEagerLoad)),
});

by the way, the parts in the html of the Angular client are still there though and there you can also see the the contradictionary conditions:

<%_ for (const relationship of relationships.filter(rel => !rel.otherEntityIsEmbedded)) { _%>
<%_ if (relationship.otherEntity.jpaMetamodelFiltering && relationship.otherEntity.paginationPagination && relationship.collection && !relationship.persistableRelationship) {
const otherEntityTranslationKey = i18nKeyPrefix + '.' + relationship.relationshipName;
_%>
<button type="submit"
[routerLink]="['/<%= relationship.otherEntity.entityPage %>']"
[queryParams]="{ 'filter[<%= relationship.otherEntityRelationshipName %>Id.in]': <%= entityInstance %>.<%= primaryKey.name %> }"
class="btn btn-info btn-sm"
data-cy="filterOtherEntityButton">
<fa-icon icon="eye"></fa-icon>
<span class="d-none d-md-inline">__jhiTranslateTagPipe__('entity.action.show', { "otherEntity": "<%= otherEntityTranslationKey %>" })</span>
</button>
<%_ } _%>
<%_ } _%>

&& !persistableRelationship (Angular code) vs. persistableRelationship (filter-entities.ts)

JHipster Version(s)

8.5.0

JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
OmarHawk added a commit to OmarHawk/generator-jhipster that referenced this issue Jun 4, 2024
@OmarHawk
Copy link
Contributor Author

OmarHawk commented Jun 4, 2024

I've tried my suggestion locally against my application and it indeed does fix this particular part of the generation.

OmarHawk added a commit to OmarHawk/generator-jhipster that referenced this issue Jun 5, 2024
OmarHawk added a commit to OmarHawk/generator-jhipster that referenced this issue Jun 5, 2024
OmarHawk added a commit to OmarHawk/generator-jhipster that referenced this issue Jun 6, 2024
@mshima mshima closed this as completed in 7a4d260 Jun 6, 2024
@mraible mraible added this to the 8.6.0 milestone Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants