Skip to content

Commit

Permalink
Merge pull request jhipster#10333 from qmonmert/prettierwarning6
Browse files Browse the repository at this point in the history
Prettier: fix warnings on generated app
  • Loading branch information
murdos authored Jul 20, 2024
2 parents cfe9320 + fd7a6d3 commit 9f5cef7
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class AngularHealthModuleFactory {
});\
""";

private static final String HEALTH_LINK = " <a routerLink=\"admin/health\" mat-menu-item><span>Health</span></a>";
private static final String HEALTH_LINK = " <a routerLink=\"admin/health\" mat-menu-item><span>Health</span></a>";

private static final String ADMIN_ROUTING =
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export const routes: Routes = [
];

@NgModule({
imports: [
RouterModule.forChild(routes),
],
imports: [RouterModule.forChild(routes)],
})
export default class AdminRoutingModule {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
table, h2 {
table,
h2 {
width: 90%;
margin-left: auto;
margin-right: auto;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<div>
<h2>
<span id="health-page-heading">Diagnostics</span>
<button mat-flat-button color="primary" (click)="refresh()">
<mat-icon>refresh</mat-icon> Refresh
</button>
<button mat-flat-button color="primary" (click)="refresh()"><mat-icon>refresh</mat-icon> Refresh</button>
</h2>

<table mat-table [dataSource]="datasource" class="mat-elevation-z8" aria-describedby="Health table">

<ng-container matColumnDef="key">
<th mat-header-cell *matHeaderCellDef>Service name</th>
<td mat-cell *matCellDef="let element">{{ element.key }}</td>
Expand All @@ -21,16 +18,15 @@
<ng-container matColumnDef="detail">
<th mat-header-cell *matHeaderCellDef>Details</th>
<td mat-cell *matCellDef="let element">
@if (element.details) {
<button mat-icon-button aria-label="Health" (click)="showHealth(element)">
<mat-icon>remove_red_eye</mat-icon>
</button>
}
@if (element.details) {
<button mat-icon-button aria-label="Health" (click)="showHealth(element)">
<mat-icon>remove_red_eye</mat-icon>
</button>
}
</td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table>

</div>
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ describe('HealthComponent', () => {

// THEN
expect(service.checkHealth).toHaveBeenCalled();
expect(service.checkHealth().subscribe({
next: () => expect(comp.datasource).toEqual([{"details": {"mailDetail": "mail"}, "key": "mail", "status": "UP"}]),
}));
expect(
service.checkHealth().subscribe({
next: () => expect(comp.datasource).toEqual([{ details: { mailDetail: 'mail' }, key: 'mail', status: 'UP' }]),
}),
);
});

it('should call checkHealth on refresh', done => {
Expand All @@ -66,8 +68,8 @@ describe('HealthComponent', () => {
// GIVEN
const health: Health = {
status: 'UP',
components: null
}
components: null,
};

// WHEN
comp.showHealth(health);
Expand Down Expand Up @@ -95,5 +97,4 @@ describe('HealthComponent', () => {
expect(downBadgeClass).toEqual('bg-danger');
});
});

});
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
<mat-dialog-content class="mat-typography">

<h3>Properties</h3>

@if (healthDetails) {
<table mat-table [dataSource]="healthDetails.details | keyvalue" class="mat-elevation-z8" aria-describedby="Health modal table">
<ng-container matColumnDef="key">
<th mat-header-cell *matHeaderCellDef>Name</th>
<td mat-cell *matCellDef="let element">{{ element.key }}</td>
</ng-container>

<ng-container matColumnDef="value">
<th mat-header-cell *matHeaderCellDef>Value</th>
<td mat-cell *matCellDef="let element">{{ readableValue(element.value) }}</td>
</ng-container>
@if (healthDetails) {
<table mat-table [dataSource]="healthDetails.details | keyvalue" class="mat-elevation-z8" aria-describedby="Health modal table">
<ng-container matColumnDef="key">
<th mat-header-cell *matHeaderCellDef>Name</th>
<td mat-cell *matCellDef="let element">{{ element.key }}</td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
}
<ng-container matColumnDef="value">
<th mat-header-cell *matHeaderCellDef>Value</th>
<td mat-cell *matCellDef="let element">{{ readableValue(element.value) }}</td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table>
}
</mat-dialog-content>

<mat-dialog-actions align="end">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { HealthModalComponent } from './health-modal.component';
class MatDialogMock {
open() {
return {
afterClosed: () => of(true)
}
afterClosed: () => of(true),
};
}
}

Expand All @@ -18,9 +18,7 @@ describe('HealthModalComponent', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
providers: [
{ provide: MAT_DIALOG_DATA, useValue: MatDialogMock }
]
providers: [{ provide: MAT_DIALOG_DATA, useValue: MatDialogMock }],
})
.overrideTemplate(HealthModalComponent, '')
.compileComponents();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ class {{baseName}}PageTest {

@Test
void shouldBeLastPageWithoutContent() {
{{baseName}}Page<Object> page = {{baseName}}Page.builder(List.of()).currentPage(0).pageSize(1).totalElementsCount(0).build();
{{baseName}}Page<Object> page = {{baseName}}Page.builder(List.of())
.currentPage(0)
.pageSize(1)
.totalElementsCount(0)
.build();
assertThat(page.isNotLast()).isFalse();
}

Expand All @@ -106,7 +110,10 @@ class {{baseName}}PageTest {

@Test
void shouldGetPageFromElements() {
{{baseName}}Page<String> page = {{baseName}}Page.of(List.of("hello", "java", "world"), new {{baseName}}Pageable(1, 1));
{{baseName}}Page<String> page = {{baseName}}Page.of(
List.of("hello", "java", "world"),
new {{baseName}}Pageable(1, 1)
);

assertThat(page.currentPage()).isEqualTo(1);
assertThat(page.hasNext()).isTrue();
Expand All @@ -118,7 +125,10 @@ class {{baseName}}PageTest {

@Test
void shouldGetEmptyPageFromOutOfBoundElements() {
{{baseName}}Page<String> page = {{baseName}}Page.of(List.of("hello", "java", "world"), new {{baseName}}Pageable(4, 1));
{{baseName}}Page<String> page = {{baseName}}Page.of(
List.of("hello", "java", "world"),
new {{baseName}}Pageable(4, 1)
);

assertThat(page.currentPage()).isEqualTo(4);
assertThat(page.hasNext()).isFalse();
Expand All @@ -130,7 +140,10 @@ class {{baseName}}PageTest {

@Test
void shouldGetPageWithLessThanExpectedElements() {
{{baseName}}Page<String> page = {{baseName}}Page.of(List.of("hello", "java", "world"), new {{baseName}}Pageable(0, 4));
{{baseName}}Page<String> page = {{baseName}}Page.of(
List.of("hello", "java", "world"),
new {{baseName}}Pageable(0, 4)
);

assertThat(page.currentPage()).isZero();
assertThat(page.hasNext()).isFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ class Rest{{baseName}}PageTest {
@Test
void shouldNotConvertWithoutSourcePage() {
assertThatThrownBy(() -> Rest{{baseName}}Page.from(null, source -> "test")).isExactlyInstanceOf(MissingMandatoryValueException.class);
assertThatThrownBy(() -> Rest{{baseName}}Page.from(null, source -> "test")).isExactlyInstanceOf(
MissingMandatoryValueException.class
);
}

@Test
void shouldNotConvertWithoutMappingFunction() {
assertThatThrownBy(() -> Rest{{baseName}}Page.from(page(), null)).isExactlyInstanceOf(MissingMandatoryValueException.class);
assertThatThrownBy(() -> Rest{{baseName}}Page.from(page(), null)).isExactlyInstanceOf(
MissingMandatoryValueException.class
);
}

@Test
Expand All @@ -35,7 +39,10 @@ class Rest{{baseName}}PageTest {

@Test
void shouldGetPageCountForPageLimit() {
Rest{{baseName}}Page<String> page = Rest{{baseName}}Page.from(pageBuilder().totalElementsCount(3).pageSize(3).build(), Function.identity());
Rest{{baseName}}Page<String> page = Rest{{baseName}}Page.from(
pageBuilder().totalElementsCount(3).pageSize(3).build(),
Function.identity()
);

assertThat(page.getPagesCount()).isEqualTo(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import {{packageName}}.cucumber.rest.CucumberRestTestContext;

@ActiveProfiles("test")
@CucumberContextConfiguration
@SpringBootTest(classes = { {{ baseName }}App.class, CucumberRestTemplateConfiguration.class }, webEnvironment = WebEnvironment.RANDOM_PORT)
@SpringBootTest(
classes = { {{ baseName }}App.class, CucumberRestTemplateConfiguration.class },
webEnvironment = WebEnvironment.RANDOM_PORT
)
public class CucumberConfiguration {
private final TestRestTemplate rest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {{packageName}}.sample.domain.beer.BeerSellingState;
import {{packageName}}.sample.domain.beer.Beers;
import {{packageName}}.sample.domain.beer.BeersRepository;
import {{packageName}}.shared.error.domain.Assert;

import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import {{packageName}}.shared.kipe.domain.RolesAccessesFixture.TestResource;
@UnitTest
class {{ baseName }}AuthorizationsTest {
private static final {{ baseName }}Authorizations authorizations = new {{ baseName }}Authorizations(List.of(rolesAccesses()));
private static final {{ baseName }}Authorizations authorizations = new {{ baseName }}Authorizations(
List.of(rolesAccesses())
);

@Nested
@DisplayName("All authorized")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

### Reference Documentation

* [Thymeleaf](https://www.thymeleaf.org)
- [Thymeleaf](https://www.thymeleaf.org)

### Guides
The following guides illustrate how to use some features concretely:

* [Handling Form Submission](https://spring.io/guides/gs/handling-form-submission/)
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)
- [Handling Form Submission](https://spring.io/guides/gs/handling-form-submission/)
- [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
- [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
- [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)

# Live reload setup

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html
lang="en"
xmlns:th="http://www.thymeleaf.org"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html th:lang="|${#locale.language}-${#locale.country}|"
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/projects/thymeleaf/index.html.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html
lang="en"
xmlns:th="http://www.thymeleaf.org"
Expand Down

0 comments on commit 9f5cef7

Please sign in to comment.