Skip to content

Commit

Permalink
flag displayInLandscape on ApplicationComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
mauvaisetroupe committed Oct 19, 2022
1 parent 2732bc6 commit 55d6ff1
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .jhipster/ApplicationComponent.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
"fieldName": "softwareType",
"fieldType": "SoftwareType",
"fieldValues": "ON_PREMISE_COTS,ON_PREMISE_CUSTOM,CLOUD_CUSTOM,CLOUD_SAAS,CLOUD_THIRD_PARTY,ON_PREMISE_EXTERNAL_LIBRARY"
},
{
"fieldName": "displayInLandscape",
"fieldType": "Boolean"
}
],
"fluentMethods": true,
Expand Down
3 changes: 2 additions & 1 deletion jhipster-jdl-metamodel.jdl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ entity ApplicationComponent(component) {
startDate LocalDate
endDate LocalDate
applicationType ApplicationType
softwareType SoftwareType
softwareType SoftwareType
displayInLandscape Boolean
}

entity DataFormat {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public class ApplicationComponent implements Serializable {
@Column(name = "software_type")
private SoftwareType softwareType;

@Column(name = "display_in_landscape")
private Boolean displayInLandscape;

@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties(value = { "owner", "categories", "technologies", "capabilities", "applicationsLists" }, allowSetters = true)
Expand Down Expand Up @@ -218,6 +221,19 @@ public void setSoftwareType(SoftwareType softwareType) {
this.softwareType = softwareType;
}

public Boolean getDisplayInLandscape() {
return this.displayInLandscape;
}

public ApplicationComponent displayInLandscape(Boolean displayInLandscape) {
this.setDisplayInLandscape(displayInLandscape);
return this;
}

public void setDisplayInLandscape(Boolean displayInLandscape) {
this.displayInLandscape = displayInLandscape;
}

public Application getApplication() {
return this.application;
}
Expand Down Expand Up @@ -314,6 +330,7 @@ public String toString() {
", endDate='" + getEndDate() + "'" +
", applicationType='" + getApplicationType() + "'" +
", softwareType='" + getSoftwareType() + "'" +
", displayInLandscape='" + getDisplayInLandscape() + "'" +
"}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ public ResponseEntity<ApplicationComponent> partialUpdateApplicationComponent(
if (applicationComponent.getSoftwareType() != null) {
existingApplicationComponent.setSoftwareType(applicationComponent.getSoftwareType());
}
if (applicationComponent.getDisplayInLandscape() != null) {
existingApplicationComponent.setDisplayInLandscape(applicationComponent.getDisplayInLandscape());
}

return existingApplicationComponent;
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.1.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<changeSet author="lionel (generated)" id="1666210316506-2">
<addColumn tableName="component">
<column name="display_in_landscape" type="boolean"/>
</addColumn>
</changeSet>
</databaseChangeLog>
1 change: 1 addition & 0 deletions src/main/resources/config/liquibase/master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@
<include file="config/liquibase/changelog/20220122061703_changelog.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20220123053840_changelog.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20220312054954_changelog.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20221019201151_changelog.xml" relativeToChangelogFile="false"/>

</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
<dd>
<span>{{ applicationComponent.softwareType }}</span>
</dd>
<dt>
<span>Display In Landscape</span>
</dt>
<dd>
<span>{{ applicationComponent.displayInLandscape }}</span>
</dd>
<dt>
<span>Application</span>
</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const validations: any = {
endDate: {},
applicationType: {},
softwareType: {},
displayInLandscape: {},
application: {
required,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,21 @@
<option v-for="softwareType in softwareTypeValues" :key="softwareType" v-bind:value="softwareType">{{ softwareType }}</option>
</select>
</div>
<div class="form-group">
<label class="form-control-label" for="application-component-displayInLandscape">Display In Landscape</label>
<input
type="checkbox"
class="form-check"
name="displayInLandscape"
id="application-component-displayInLandscape"
data-cy="displayInLandscape"
:class="{
valid: !$v.applicationComponent.displayInLandscape.$invalid,
invalid: $v.applicationComponent.displayInLandscape.$invalid,
}"
v-model="$v.applicationComponent.displayInLandscape.$model"
/>
</div>
<div class="form-group">
<label class="form-control-label" for="application-component-application">Application</label>
<select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<th scope="row"><span>End Date</span></th>
<th scope="row"><span>Application Type</span></th>
<th scope="row"><span>Software Type</span></th>
<th scope="row"><span>Display In Landscape</span></th>
<th scope="row"><span>Application</span></th>
<th scope="row"><span>Categories</span></th>
<th scope="row"><span>Technologies</span></th>
Expand All @@ -61,6 +62,7 @@
<td>{{ applicationComponent.endDate }}</td>
<td>{{ applicationComponent.applicationType }}</td>
<td>{{ applicationComponent.softwareType }}</td>
<td>{{ applicationComponent.displayInLandscape }}</td>
<td>
<div v-if="applicationComponent.application">
<router-link :to="{ name: 'ApplicationView', params: { applicationId: applicationComponent.application.id } }">{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface IApplicationComponent {
endDate?: Date | null;
applicationType?: ApplicationType | null;
softwareType?: SoftwareType | null;
displayInLandscape?: boolean | null;
application?: IApplication;
categories?: IApplicationCategory[] | null;
technologies?: ITechnology[] | null;
Expand All @@ -32,8 +33,11 @@ export class ApplicationComponent implements IApplicationComponent {
public endDate?: Date | null,
public applicationType?: ApplicationType | null,
public softwareType?: SoftwareType | null,
public displayInLandscape?: boolean | null,
public application?: IApplication,
public categories?: IApplicationCategory[] | null,
public technologies?: ITechnology[] | null
) {}
) {
this.displayInLandscape = this.displayInLandscape ?? false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ class ApplicationComponentResourceIT {
private static final SoftwareType DEFAULT_SOFTWARE_TYPE = SoftwareType.ON_PREMISE_COTS;
private static final SoftwareType UPDATED_SOFTWARE_TYPE = SoftwareType.ON_PREMISE_CUSTOM;

private static final Boolean DEFAULT_DISPLAY_IN_LANDSCAPE = false;
private static final Boolean UPDATED_DISPLAY_IN_LANDSCAPE = true;

private static final String ENTITY_API_URL = "/api/application-components";
private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}";

Expand Down Expand Up @@ -105,7 +108,8 @@ public static ApplicationComponent createEntity(EntityManager em) {
.startDate(DEFAULT_START_DATE)
.endDate(DEFAULT_END_DATE)
.applicationType(DEFAULT_APPLICATION_TYPE)
.softwareType(DEFAULT_SOFTWARE_TYPE);
.softwareType(DEFAULT_SOFTWARE_TYPE)
.displayInLandscape(DEFAULT_DISPLAY_IN_LANDSCAPE);
// Add required entity
Application application;
if (TestUtil.findAll(em, Application.class).isEmpty()) {
Expand Down Expand Up @@ -135,7 +139,8 @@ public static ApplicationComponent createUpdatedEntity(EntityManager em) {
.startDate(UPDATED_START_DATE)
.endDate(UPDATED_END_DATE)
.applicationType(UPDATED_APPLICATION_TYPE)
.softwareType(UPDATED_SOFTWARE_TYPE);
.softwareType(UPDATED_SOFTWARE_TYPE)
.displayInLandscape(UPDATED_DISPLAY_IN_LANDSCAPE);
// Add required entity
Application application;
if (TestUtil.findAll(em, Application.class).isEmpty()) {
Expand Down Expand Up @@ -180,6 +185,7 @@ void createApplicationComponent() throws Exception {
assertThat(testApplicationComponent.getEndDate()).isEqualTo(DEFAULT_END_DATE);
assertThat(testApplicationComponent.getApplicationType()).isEqualTo(DEFAULT_APPLICATION_TYPE);
assertThat(testApplicationComponent.getSoftwareType()).isEqualTo(DEFAULT_SOFTWARE_TYPE);
assertThat(testApplicationComponent.getDisplayInLandscape()).isEqualTo(DEFAULT_DISPLAY_IN_LANDSCAPE);
}

@Test
Expand Down Expand Up @@ -245,7 +251,8 @@ void getAllApplicationComponents() throws Exception {
.andExpect(jsonPath("$.[*].startDate").value(hasItem(DEFAULT_START_DATE.toString())))
.andExpect(jsonPath("$.[*].endDate").value(hasItem(DEFAULT_END_DATE.toString())))
.andExpect(jsonPath("$.[*].applicationType").value(hasItem(DEFAULT_APPLICATION_TYPE.toString())))
.andExpect(jsonPath("$.[*].softwareType").value(hasItem(DEFAULT_SOFTWARE_TYPE.toString())));
.andExpect(jsonPath("$.[*].softwareType").value(hasItem(DEFAULT_SOFTWARE_TYPE.toString())))
.andExpect(jsonPath("$.[*].displayInLandscape").value(hasItem(DEFAULT_DISPLAY_IN_LANDSCAPE.booleanValue())));
}

@SuppressWarnings({ "unchecked" })
Expand Down Expand Up @@ -286,7 +293,8 @@ void getApplicationComponent() throws Exception {
.andExpect(jsonPath("$.startDate").value(DEFAULT_START_DATE.toString()))
.andExpect(jsonPath("$.endDate").value(DEFAULT_END_DATE.toString()))
.andExpect(jsonPath("$.applicationType").value(DEFAULT_APPLICATION_TYPE.toString()))
.andExpect(jsonPath("$.softwareType").value(DEFAULT_SOFTWARE_TYPE.toString()));
.andExpect(jsonPath("$.softwareType").value(DEFAULT_SOFTWARE_TYPE.toString()))
.andExpect(jsonPath("$.displayInLandscape").value(DEFAULT_DISPLAY_IN_LANDSCAPE.booleanValue()));
}

@Test
Expand Down Expand Up @@ -317,7 +325,8 @@ void putNewApplicationComponent() throws Exception {
.startDate(UPDATED_START_DATE)
.endDate(UPDATED_END_DATE)
.applicationType(UPDATED_APPLICATION_TYPE)
.softwareType(UPDATED_SOFTWARE_TYPE);
.softwareType(UPDATED_SOFTWARE_TYPE)
.displayInLandscape(UPDATED_DISPLAY_IN_LANDSCAPE);

restApplicationComponentMockMvc
.perform(
Expand All @@ -340,6 +349,7 @@ void putNewApplicationComponent() throws Exception {
assertThat(testApplicationComponent.getEndDate()).isEqualTo(UPDATED_END_DATE);
assertThat(testApplicationComponent.getApplicationType()).isEqualTo(UPDATED_APPLICATION_TYPE);
assertThat(testApplicationComponent.getSoftwareType()).isEqualTo(UPDATED_SOFTWARE_TYPE);
assertThat(testApplicationComponent.getDisplayInLandscape()).isEqualTo(UPDATED_DISPLAY_IN_LANDSCAPE);
}

@Test
Expand Down Expand Up @@ -439,6 +449,7 @@ void partialUpdateApplicationComponentWithPatch() throws Exception {
assertThat(testApplicationComponent.getEndDate()).isEqualTo(DEFAULT_END_DATE);
assertThat(testApplicationComponent.getApplicationType()).isEqualTo(DEFAULT_APPLICATION_TYPE);
assertThat(testApplicationComponent.getSoftwareType()).isEqualTo(UPDATED_SOFTWARE_TYPE);
assertThat(testApplicationComponent.getDisplayInLandscape()).isEqualTo(DEFAULT_DISPLAY_IN_LANDSCAPE);
}

@Test
Expand All @@ -462,7 +473,8 @@ void fullUpdateApplicationComponentWithPatch() throws Exception {
.startDate(UPDATED_START_DATE)
.endDate(UPDATED_END_DATE)
.applicationType(UPDATED_APPLICATION_TYPE)
.softwareType(UPDATED_SOFTWARE_TYPE);
.softwareType(UPDATED_SOFTWARE_TYPE)
.displayInLandscape(UPDATED_DISPLAY_IN_LANDSCAPE);

restApplicationComponentMockMvc
.perform(
Expand All @@ -485,6 +497,7 @@ void fullUpdateApplicationComponentWithPatch() throws Exception {
assertThat(testApplicationComponent.getEndDate()).isEqualTo(UPDATED_END_DATE);
assertThat(testApplicationComponent.getApplicationType()).isEqualTo(UPDATED_APPLICATION_TYPE);
assertThat(testApplicationComponent.getSoftwareType()).isEqualTo(UPDATED_SOFTWARE_TYPE);
assertThat(testApplicationComponent.getDisplayInLandscape()).isEqualTo(UPDATED_DISPLAY_IN_LANDSCAPE);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ describe('ApplicationComponent e2e test', () => {

cy.get(`[data-cy="softwareType"]`).select('CLOUD_CUSTOM');

cy.get(`[data-cy="displayInLandscape"]`).should('not.be.checked');
cy.get(`[data-cy="displayInLandscape"]`).click().should('be.checked');

cy.get(`[data-cy="application"]`).select(1);

cy.get(entityCreateSaveButtonSelector).click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ describe('Service Tests', () => {
currentDate,
currentDate,
ApplicationType.SOFTWARE,
SoftwareType.ON_PREMISE_COTS
SoftwareType.ON_PREMISE_COTS,
false
);
});

Expand Down Expand Up @@ -121,6 +122,7 @@ describe('Service Tests', () => {
endDate: dayjs(currentDate).format(DATE_FORMAT),
applicationType: 'BBBBBB',
softwareType: 'BBBBBB',
displayInLandscape: true,
},
elemDefault
);
Expand Down Expand Up @@ -157,6 +159,7 @@ describe('Service Tests', () => {
comment: 'BBBBBB',
documentationURL: 'BBBBBB',
startDate: dayjs(currentDate).format(DATE_FORMAT),
displayInLandscape: true,
},
new ApplicationComponent()
);
Expand Down Expand Up @@ -199,6 +202,7 @@ describe('Service Tests', () => {
endDate: dayjs(currentDate).format(DATE_FORMAT),
applicationType: 'BBBBBB',
softwareType: 'BBBBBB',
displayInLandscape: true,
},
elemDefault
);
Expand Down

0 comments on commit 55d6ff1

Please sign in to comment.