diff --git a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.component.spec.ts.ejs b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.component.spec.ts.ejs index 5951d3aef7bf..4bda52ca504c 100644 --- a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.component.spec.ts.ejs +++ b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.component.spec.ts.ejs @@ -39,7 +39,7 @@ vitest.mock('vue-router', () => ({ useRouter: () => ({ go: routerGoMock }), })); -const <%= entityInstance %>Sample = { id: <%- tsKeyId %> }; +const <%= entityInstance %>Sample = { <%= primaryKey.name %>: <%- tsKeyId %> }; describe('Component Tests', () => { let alertService: AlertService; @@ -83,7 +83,7 @@ describe('Component Tests', () => { <%= entityInstance %>ServiceStub.find.resolves(<%= entityInstance %>Sample); route = { params: { - <%= entityInstance %>Id: '' + <%- tsKeyId %>, + <%= entityInstance %><%= primaryKey.nameCapitalized %>: '' + <%- tsKeyId %>, }, }; const wrapper = shallowMount(<%= entityAngularName %>Details, { global: mountOptions }); diff --git a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.component.ts.ejs b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.component.ts.ejs index 43b439d42cbe..727f3b3112b2 100644 --- a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.component.ts.ejs +++ b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.component.ts.ejs @@ -33,17 +33,17 @@ export default defineComponent({ const previousState = () => router.go(-1); const <%= entityInstance %>: Ref> = ref({}); - const retrieve<%= entityAngularName %> = async <%= entityInstance %>Id => { + const retrieve<%= entityAngularName %> = async <%= entityInstance %><%= primaryKey.nameCapitalized %> => { try { - const res = await <%= entityInstance %>Service().find(<%= entityInstance %>Id); + const res = await <%= entityInstance %>Service().find(<%= entityInstance %><%= primaryKey.nameCapitalized %>); <%= entityInstance %>.value = res; } catch (error) { alertService.showHttpError(error.response); } }; - if (route.params?.<%= entityInstance %>Id) { - retrieve<%= entityAngularName %>(route.params.<%= entityInstance %>Id); + if (route.params?.<%= entityInstance %><%= primaryKey.nameCapitalized %>) { + retrieve<%= entityAngularName %>(route.params.<%= entityInstance %><%= primaryKey.nameCapitalized %>); } return { diff --git a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.vue.ejs b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.vue.ejs index 6bcdd166a7f6..253c1ef8d005 100644 --- a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.vue.ejs +++ b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.vue.ejs @@ -2,7 +2,7 @@
-

<%= entityAngularName %> {{<%= entityInstance %>.id}}

+

<%= entityAngularName %> {{<%= entityInstance %>.<%= primaryKey.name %>}}

<%_ for (field of fields.filter(field => !field.id)) { const fieldName = field.fieldName; @@ -49,7 +49,7 @@
<%_ if (relationship.otherEntityUser) { _%> <%_ if (relationship.relationshipManyToMany) { _%> - {{i > 0 ? ', ' : ''}} + {{i > 0 ? ', ' : ''}} {{<%= relationshipFieldName %>.<%= otherEntityField %>}} <%_ } else { _%> @@ -57,12 +57,12 @@ <%_ } _%> <%_ } else { _%> <%_ if (relationship.relationshipManyToMany) { _%> - {{i > 0 ? ', ' : ''}} - {{<%= relationshipFieldName + "." + otherEntityField %>}} + {{i > 0 ? ', ' : ''}} + {{<%= relationshipFieldName + "." + otherEntityField %>}} <%_ } else { _%>
- .id}}">{{<%= entityInstance + "." + relationshipFieldName + "." + otherEntityField %>}} + .<%= primaryKey.name %>}}">{{<%= entityInstance + "." + relationshipFieldName + "." + otherEntityField %>}}
<%_ } _%> <%_ } _%> @@ -77,7 +77,7 @@   Back <%_ if (!readOnly) { _%> - + diff --git a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.component.spec.ts.ejs b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.component.spec.ts.ejs index dc5c9aab878f..1af6a8f7f1f9 100644 --- a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.component.spec.ts.ejs +++ b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.component.spec.ts.ejs @@ -55,7 +55,7 @@ vitest.mock('vue-router', () => ({ useRouter: () => ({ go: routerGoMock }), })); -const <%= entityInstance %>Sample = { id: <%- tsKeyId %> }; +const <%= entityInstance %>Sample = { <%= primaryKey.name %>: <%- tsKeyId %> }; describe('Component Tests', () => { let mountOptions: MountingOptions<<%= entityAngularName %>UpdateComponentType>['global']; @@ -178,7 +178,7 @@ describe('Component Tests', () => { // WHEN route = { params: { - <%= entityInstance %>Id: '' + <%= entityInstance %>Sample.<%- primaryKey.name %>, + <%= entityInstance %><%= primaryKey.nameCapitalized %>: '' + <%= entityInstance %>Sample.<%- primaryKey.name %>, }, }; const wrapper = shallowMount(<%= entityAngularName %>Update, { global: mountOptions }); diff --git a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.component.ts.ejs b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.component.ts.ejs index 8463995f1c78..f144512c573c 100644 --- a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.component.ts.ejs +++ b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.component.ts.ejs @@ -64,9 +64,9 @@ export default defineComponent({ const previousState = () => router.go(-1); - const retrieve<%= entityAngularName %> = async <%= entityInstance %>Id => { + const retrieve<%= entityAngularName %> = async <%= entityInstance %><%= primaryKey.nameCapitalized %> => { try { - const res = await <%= entityInstance %>Service().find(<%= entityInstance %>Id); + const res = await <%= entityInstance %>Service().find(<%= entityInstance %><%= primaryKey.nameCapitalized %>); <%_ for (field of fields.filter(field => !field.id)) { const fieldName = field.fieldName; @@ -81,8 +81,8 @@ _%> } }; - if (route.params?.<%= entityInstance %>Id) { - retrieve<%= entityAngularName %>(route.params.<%= entityInstance %>Id); + if (route.params?.<%= entityInstance %><%= primaryKey.nameCapitalized %>) { + retrieve<%= entityAngularName %>(route.params.<%= entityInstance %><%= primaryKey.nameCapitalized %>); } <%_ if (relationships.length > 0) { _%> @@ -190,15 +190,15 @@ _%> const fieldName = field.fieldName; const fieldType = field.fieldType; } _%> - if (this.<%= entityInstance %>.id) { + if (this.<%= entityInstance %>.<%= primaryKey.name %>) { this.<%= entityInstance %>Service().update(this.<%= entityInstance %>).then((param) => { this.isSaving = false; this.previousState(); this.alertService.showInfo( <%_ if (enableTranslation) { _%> - this.t$('<%= i18nAlertHeaderPrefix %>.updated', { 'param' : param.id }) + this.t$('<%= i18nAlertHeaderPrefix %>.updated', { 'param' : param.<%= primaryKey.name %> }) <%_ } else {_%> - 'A <%= entityAngularName %> is updated with identifier ' + param.id + 'A <%= entityAngularName %> is updated with identifier ' + param.<%= primaryKey.name %> <%_ } _%> ); }).catch(error => { @@ -211,9 +211,9 @@ _%> this.previousState(); this.alertService.showSuccess( <%_ if (enableTranslation) { _%> - this.t$('<%= i18nAlertHeaderPrefix %>.created', { param: param.id }).toString() + this.t$('<%= i18nAlertHeaderPrefix %>.created', { param: param.<%= primaryKey.name %> }).toString() <%_ } else {_%> - 'A <%= entityAngularName %> is created with identifier ' + param.id + 'A <%= entityAngularName %> is created with identifier ' + param.<%= primaryKey.name %> <%_ } _%> ); }).catch(error => { @@ -242,7 +242,7 @@ _%> <%_ if (relationshipsContainManyToOne) { _%> getSelected(selectedVals, option) : any { if (selectedVals) { - return selectedVals.find(value => option.id === value.id) ?? option; + return selectedVals.find(value => option.<%= primaryKey.name %> === value.<%= primaryKey.name %>) ?? option; } return option; }, diff --git a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.vue.ejs b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.vue.ejs index 2e9f06d7823c..ed1860fb94b0 100644 --- a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.vue.ejs +++ b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.vue.ejs @@ -4,10 +4,10 @@

Create or edit a <%= entityAngularName %>

-
- - +
+ +
<%_ for (field of fields.filter(field => !field.id)) { const fieldName = field.fieldName; @@ -139,14 +139,14 @@ _%> <%_ } else { _%> <%_ } _%> - +
<%_ } else if (relationship.persistableRelationship) { _%>
<%_ } _%> diff --git a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.component.spec.ts.ejs b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.component.spec.ts.ejs index c290b0980725..483ac51d35be 100644 --- a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.component.spec.ts.ejs +++ b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.component.spec.ts.ejs @@ -86,7 +86,7 @@ describe('Component Tests', () => { describe('Mount', () => { it('Should call load all on init', async () => { // GIVEN - <%= entityInstance %>ServiceStub.retrieve.resolves({ headers: {}, data: [{ id: <%- tsKeyId %> }] }); + <%= entityInstance %>ServiceStub.retrieve.resolves({ headers: {}, data: [{ <%= primaryKey.name %>: <%- tsKeyId %> }] }); // WHEN const wrapper = shallowMount(<%= entityAngularName %>, { global: mountOptions }); @@ -95,7 +95,7 @@ describe('Component Tests', () => { // THEN expect(<%= entityInstance %>ServiceStub.retrieve.calledOnce).toBeTruthy(); - expect(comp.<%= entityInstancePlural %>[0]).toEqual(expect.objectContaining({id: <%- tsKeyId %>})); + expect(comp.<%= entityInstancePlural %>[0]).toEqual(expect.objectContaining({<%= primaryKey.name %>: <%- tsKeyId %>})); }); <%_ if (!paginationNo) { _%> @@ -126,7 +126,7 @@ describe('Component Tests', () => { it('should load a page', async () => { // GIVEN - <%= entityInstance %>ServiceStub.retrieve.resolves({ headers: {}, data: [{ id: <%- tsKeyId %> }] }); + <%= entityInstance %>ServiceStub.retrieve.resolves({ headers: {}, data: [{ <%= primaryKey.name %>: <%- tsKeyId %> }] }); // WHEN comp.page = 2; @@ -134,7 +134,7 @@ describe('Component Tests', () => { // THEN expect(<%= entityInstance %>ServiceStub.retrieve.called).toBeTruthy(); - expect(comp.<%= entityInstancePlural %>[0]).toEqual(expect.objectContaining({id: <%- tsKeyId %>})); + expect(comp.<%= entityInstancePlural %>[0]).toEqual(expect.objectContaining({<%= primaryKey.name %>: <%- tsKeyId %>})); }); <%_ if (!paginationInfiniteScroll) { _%> @@ -152,7 +152,7 @@ describe('Component Tests', () => { comp.page = 2; await comp.$nextTick(); <%= entityInstance %>ServiceStub.retrieve.reset(); - <%= entityInstance %>ServiceStub.retrieve.resolves({ headers: {}, data: [{ id: <%- tsKeyId %> }] }); + <%= entityInstance %>ServiceStub.retrieve.resolves({ headers: {}, data: [{ <%= primaryKey.name %>: <%- tsKeyId %> }] }); // WHEN comp.clear(); @@ -161,7 +161,7 @@ describe('Component Tests', () => { // THEN expect(comp.page).toEqual(1); expect(<%= entityInstance %>ServiceStub.retrieve.callCount).toEqual(1); - expect(comp.<%= entityInstancePlural %>[0]).toEqual(expect.objectContaining({id: <%- tsKeyId %>})); + expect(comp.<%= entityInstancePlural %>[0]).toEqual(expect.objectContaining({<%= primaryKey.name %>: <%- tsKeyId %>})); }); it('should calculate the sort attribute for a non-id attribute', async () => { @@ -182,7 +182,7 @@ describe('Component Tests', () => { <%= entityInstance %>ServiceStub.delete.resolves({}); // WHEN - comp.prepareRemove({id: <%- tsKeyId %>}); + comp.prepareRemove({<%= primaryKey.name %>: <%- tsKeyId %>}); comp.remove<%= entityAngularName %>(); await comp.$nextTick(); // clear components diff --git a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.component.ts.ejs b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.component.ts.ejs index 011d7c9464c9..1d5a59c9c64d 100644 --- a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.component.ts.ejs +++ b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.component.ts.ejs @@ -134,7 +134,7 @@ export default defineComponent({ const removeId: Ref<<%- primaryKey.tsType %>> = ref(null); const removeEntity = ref(null); const prepareRemove = (instance: I<%= entityAngularName %>) => { - removeId.value = instance.id; + removeId.value = instance.<%= primaryKey.name %>; removeEntity.value.show(); }; const closeDialog = () => { diff --git a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.service.spec.ts.ejs b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.service.spec.ts.ejs index 3fb564e33be1..eea56703a7d5 100644 --- a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.service.spec.ts.ejs +++ b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.service.spec.ts.ejs @@ -123,7 +123,7 @@ describe('Service Tests', () => { <%_ if (!readOnly) { _%> it('should create a <%= entityAngularName %>', async () => { const returnedFromService = Object.assign({ - id: <%- this.generateTestEntityId(primaryKey.type) %>, + <%= primaryKey.name %>: <%- this.generateTestEntityId(primaryKey.type) %>, <%_ fields.filter(field => !field.id).forEach((field) => { _%> <%_ if (field.fieldTypeLocalDate) { _%> <%= field.fieldName%>: dayjs(currentDate).format(DATE_FORMAT), diff --git a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.service.ts.ejs b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.service.ts.ejs index 6a2f17bc024b..7916103f13f3 100644 --- a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.service.ts.ejs +++ b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.service.ts.ejs @@ -20,9 +20,9 @@ export default class <%= entityAngularName %>Service { } <%_ } _%> - public find(id: <%- this.getTypescriptKeyType(primaryKey) %>) : Promise> { + public find(<%= primaryKey.name %>: <%- this.getTypescriptKeyType(primaryKey) %>) : Promise> { return new Promise>((resolve, reject) => { - axios.get(`${baseApiUrl}/${id}`).then(res => { + axios.get(`${baseApiUrl}/${<%= primaryKey.name %>}`).then(res => { resolve(res.data); }).catch(err => { reject(err); }); }); @@ -37,9 +37,9 @@ export default class <%= entityAngularName %>Service { } <%_ if (!readOnly) { _%> - public delete(id: <%- this.getTypescriptKeyType(primaryKey) %>) : Promise { + public delete(<%= primaryKey.name %>: <%- this.getTypescriptKeyType(primaryKey) %>) : Promise { return new Promise((resolve, reject) => { - axios.delete(`${baseApiUrl}/${id}`).then(res => { + axios.delete(`${baseApiUrl}/${<%= primaryKey.name %>}`).then(res => { resolve(res); }).catch(err => { reject(err); }); }); diff --git a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.vue.ejs b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.vue.ejs index e1ac4ae85db5..b748cd3942bc 100644 --- a/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.vue.ejs +++ b/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.vue.ejs @@ -46,7 +46,7 @@ - + <%_ for (field of fields.filter(field => !field.id)) { _%> <%_ } _%> @@ -61,9 +61,9 @@ + :key="<%= entityInstance %>.<%= primaryKey.name %>" data-cy="entityTable"> <%_ for (field of fields.filter(field => !field.id)) { const fieldName = field.fieldName; @@ -100,7 +100,7 @@
v-on:click="changeOrder('id')"<% } %>>ID<% if (!paginationNo) { %> <% } %> v-on:click="changeOrder('<%= primaryKey.name %>')"<% } %>>ID<% if (!paginationNo) { %> <% } %> v-on:click="changeOrder('<%= field.fieldName%>')"<% } %>><%= field.fieldNameHumanized %><% if (!paginationNo) { %> <% } %>
- {{<%= entityInstance %>.id}} + {{<%= entityInstance %>.<%= primaryKey.name %>}} <%_ if (relationship.otherEntityUser) { _%> <%_ if (relationship.relationshipManyToMany) { _%> - {{i > 0 ? ', ' : ''}} + {{i > 0 ? ', ' : ''}} {{<%= relationshipFieldName %>.<%= otherEntityField %>}} <%_ } else { _%> @@ -108,12 +108,12 @@ <%_ } _%> <%_ } else { _%> <%_ if (relationship.relationshipManyToMany) { _%> - {{i > 0 ? ', ' : ''}} - {{<%= relationshipFieldName + "." + otherEntityField %>}} + {{i > 0 ? ', ' : ''}} + {{<%= relationshipFieldName + "." + otherEntityField %>}} <%_ } else { _%>
"> - .id}}">{{<%= entityInstance + "." + relationshipFieldName + "." + otherEntityField %>}} + .<%= primaryKey.name %>}}">{{<%= entityInstance + "." + relationshipFieldName + "." + otherEntityField %>}}
<%_ } _%> <%_ } _%> @@ -123,9 +123,9 @@
<%_ if (authenticationTypeSession) { _%> - + <%_ } else { _%> - +