From fd6c3e015ab65ed0e857537976fa2888809e169e Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 26 Aug 2025 15:44:19 +0000 Subject: [PATCH 01/71] extract not-ready server HTML logic into a reusable component Refactors the not-ready server HTML generation by moving the logic into a reusable React component. Simplifies the server response handler by delegating the rendering of the HTML to this new component. Improves maintainability and reduces code duplication. --- .../dashboard_server_is_not_ready_yet.tsx | 324 ++++++++++++++++++ .../server/healthcheck/healthcheck/service.ts | 308 +---------------- 2 files changed, 333 insertions(+), 299 deletions(-) create mode 100644 src/core/server/healthcheck/healthcheck/dashboard_server_is_not_ready_yet.tsx diff --git a/src/core/server/healthcheck/healthcheck/dashboard_server_is_not_ready_yet.tsx b/src/core/server/healthcheck/healthcheck/dashboard_server_is_not_ready_yet.tsx new file mode 100644 index 000000000000..520ab7f17d67 --- /dev/null +++ b/src/core/server/healthcheck/healthcheck/dashboard_server_is_not_ready_yet.tsx @@ -0,0 +1,324 @@ +import React from 'react'; +import { renderToStaticMarkup } from 'react-dom/server'; + +interface NotReadyServerProps { + appName: string; + documentationTroubleshootingLink?: string; + serverBasePath: string; +} + +const DashboardServerIsNotReadyYetComponent = ({ + appName, + documentationTroubleshootingLink, + serverBasePath, +}: NotReadyServerProps) => { + return ( + + + {appName} + + - - - -

${appName} server is not ready yet -

If this message persists after a time of the initialization, this could be caused for some problem. Review the app logs for more information.

- ${ - documentationTroubleshootingLink - ? '
Troubleshooting
' - : '' - } -
- - - `; + const html = ` ${dashboardServerIsNotReadyYet({ + appName, + documentationTroubleshootingLink, + serverBasePath, + })}`; // If server is not ready yet, because plugins or core can perform // long running tasks (build assets, saved objects migrations etc.) // we should let client know that and ask to retry after 30 seconds. From b6c45d86ac8f529003efcf21a86b12eed682008b Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Tue, 26 Aug 2025 16:01:46 +0000 Subject: [PATCH 02/71] refactor healthcheck component and externalize styles Refactors the healthcheck component to improve maintainability by moving inline styles to an external stylesheet module. Replaces `renderToStaticMarkup` with `renderToString` for rendering, and updates the component to reference an external CSS file for styling. Enhances code readability and promotes better separation of concerns. --- .../index.tsx} | 97 +------------------ .../styles.ts | 90 +++++++++++++++++ 2 files changed, 95 insertions(+), 92 deletions(-) rename src/core/server/healthcheck/healthcheck/{dashboard_server_is_not_ready_yet.tsx => dashboard_server_is_not_ready_yet/index.tsx} (74%) create mode 100644 src/core/server/healthcheck/healthcheck/dashboard_server_is_not_ready_yet/styles.ts diff --git a/src/core/server/healthcheck/healthcheck/dashboard_server_is_not_ready_yet.tsx b/src/core/server/healthcheck/healthcheck/dashboard_server_is_not_ready_yet/index.tsx similarity index 74% rename from src/core/server/healthcheck/healthcheck/dashboard_server_is_not_ready_yet.tsx rename to src/core/server/healthcheck/healthcheck/dashboard_server_is_not_ready_yet/index.tsx index 520ab7f17d67..0d7ad7ab887c 100644 --- a/src/core/server/healthcheck/healthcheck/dashboard_server_is_not_ready_yet.tsx +++ b/src/core/server/healthcheck/healthcheck/dashboard_server_is_not_ready_yet/index.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import { renderToStaticMarkup } from 'react-dom/server'; +import { renderToString } from 'react-dom/server'; +import { styles } from "./styles"; interface NotReadyServerProps { appName: string; @@ -16,97 +17,9 @@ const DashboardServerIsNotReadyYetComponent = ({ {appName} + -