Skip to content

Commit d89c17d

Browse files
committed
chore: enable serialization support for spring datas Page class, avoid jooq messages when running local server
1 parent 646d861 commit d89c17d

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

server/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,11 @@ publishing {
213213
}
214214

215215
tasks.register('runServer', JavaExec) {
216-
jvmArgs = ['--enable-native-access=ALL-UNNAMED'] // due to https://github.com/netty/netty/issues/15161
216+
jvmArgs = [
217+
'-Dorg.jooq.no-logo=true',
218+
'-Dorg.jooq.no-tips=true',
219+
'--enable-native-access=ALL-UNNAMED' // due to https://github.com/netty/netty/issues/15161
220+
]
217221
classpath = sourceSets.dev.runtimeClasspath
218222
mainClass = 'org.eclipse.openvsx.RegistryApplication'
219223
}

server/src/main/java/org/eclipse/openvsx/RegistryApplication.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.springframework.boot.web.servlet.FilterRegistrationBean;
2626
import org.springframework.context.annotation.Bean;
2727
import org.springframework.core.Ordered;
28+
import org.springframework.data.web.config.EnableSpringDataWebSupport;
2829
import org.springframework.retry.annotation.EnableRetry;
2930
import org.springframework.scheduling.TaskScheduler;
3031
import org.springframework.scheduling.annotation.EnableAsync;
@@ -33,6 +34,8 @@
3334
import org.springframework.security.web.firewall.HttpStatusRequestRejectedHandler;
3435
import org.springframework.security.web.firewall.RequestRejectedHandler;
3536

37+
import static org.springframework.data.web.config.EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO;
38+
3639
@SpringBootApplication(exclude = {
3740
// currently no redis / elasticsearch repositories are being used
3841
// exclude autoconfiguration for them to avoid unnecessary logging
@@ -46,9 +49,12 @@
4649
@EnableRetry
4750
@EnableAsync
4851
@EnableConfigurationProperties(OAuth2AttributesConfig.class)
52+
// Need to enable serialization support for spring data's Page, see:
53+
// https://stevenpg.com/posts/spring-data-page-impl-serialization-warning/
54+
@EnableSpringDataWebSupport(pageSerializationMode = VIA_DTO)
4955
public class RegistryApplication {
5056

51-
public static void main(String[] args) {
57+
static void main(String[] args) {
5258
SpringApplication.run(RegistryApplication.class, args);
5359
}
5460

webui/src/extension-registry-types.ts

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -474,21 +474,10 @@ export interface Log {
474474

475475
export interface LogPageableList {
476476
content: Log[];
477-
pageable: {
478-
pageNumber: number;
479-
pageSize: number;
480-
sort: { sorted: boolean; empty: boolean; unsorted: boolean };
481-
offset: number;
482-
paged: boolean;
483-
unpaged: boolean;
477+
page: {
478+
size: number;
479+
number: number;
480+
totalElements: number;
481+
totalPages: number;
484482
};
485-
totalElements: number;
486-
totalPages: number;
487-
last: boolean;
488-
first: boolean;
489-
size: number;
490-
number: number;
491-
numberOfElements: number;
492-
sort: { sorted: boolean; empty: boolean; unsorted: boolean };
493-
empty: boolean;
494483
}

webui/src/pages/admin-dashboard/logs/logs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const Logs: FC = () => {
7070
periodFilter || undefined
7171
);
7272
setLogs(data.content);
73-
setTotalElements(data.totalElements);
73+
setTotalElements(data.page.totalElements);
7474
} catch (err: any) {
7575
if (!abortController.signal.aborted) {
7676
setError(handleError(err));

0 commit comments

Comments
 (0)