Skip to content

Commit

Permalink
fix(website-frontend): background color staying the same after viewin…
Browse files Browse the repository at this point in the history
…g report (#899)
  • Loading branch information
xandervedder authored Sep 13, 2024
1 parent 3b8ce2e commit 0954989
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 3 deletions.
8 changes: 8 additions & 0 deletions packages/website-frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ Run `npm run build` to build the project. The build artifacts will be stored in
## Running tests

Run `npm run test` to execute the tests via [Vitest](https://vitest.dev/) and [Playwright](https://playwright.dev/).

## Adding a report to the dashboard

If you need to add a report quickly to the report, please use the following link:

https://stryker-mutator.io/docs/General/dashboard/#send-a-report-via-curl

An example report can be found [here](./test/unit/testResources/simple-report.json).
4 changes: 3 additions & 1 deletion packages/website-frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Try out the Stryker dashboard, home for your test quality" />
<link rel="icon" href="/assets/favicon.ico" sizes="48x48" />
<link rel="stylesheet" href="/src/main.css" />
<title>Stryker Dashboard</title>
<script type="module" src="./src/app.ts"></script>
</head>
Expand Down
Binary file not shown.
4 changes: 4 additions & 0 deletions packages/website-frontend/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
User-agent: *
Disallow: /repos/
Disallow: /reports/
Disallow: /auth/
15 changes: 15 additions & 0 deletions packages/website-frontend/src/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
html,
body,
stryker-dashboard {
height: 100%;
width: 100%;
}

stryker-dashboard {
display: flex;
flex-direction: column;
}

stryker-dashboard #outlet {
flex-grow: 1;
}
12 changes: 10 additions & 2 deletions packages/website-frontend/src/pages/report.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class ReportPage extends LitElement {
}

if (isMutationTestResult(report)) {
document.body.style.backgroundColor = 'rgb(24, 24, 27)';
this.#prepareStyling();

if (isPendingReport(report)) {
this.sse = `/api/real-time/${this.#sseSlug}`;
Expand All @@ -48,6 +48,14 @@ export class ReportPage extends LitElement {
});
}

#prepareStyling() {
this.style.cssText = `
display: flex;
flex-direction: column;
height: 100%;
`;
}

override render() {
if (this.didNotFindReport) {
return html`
Expand Down Expand Up @@ -114,7 +122,7 @@ export class ReportPage extends LitElement {
}

#handleThemeChange(event: CustomEvent<{ themeBackgroundColor: string }>): void {
document.body.style.backgroundColor = event.detail.themeBackgroundColor;
this.style.backgroundColor = event.detail.themeBackgroundColor;
}
}

Expand Down

0 comments on commit 0954989

Please sign in to comment.