From 863a1dd0c5c57b1b1145abceac4210b86293c903 Mon Sep 17 00:00:00 2001 From: Daniel Weber Date: Thu, 22 Jul 2021 14:01:31 +0200 Subject: [PATCH 1/5] UI.Core: Save 'data' fields from checks to the database as raw string. --- .../Data/Configuration/HealthCheckExecutionEntryMap.cs | 3 +++ src/HealthChecks.UI.Core/Data/HealthCheckExecutionEntry.cs | 2 ++ src/HealthChecks.UI/Core/Extensions/HealthReportExtensions.cs | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/HealthChecks.UI.Core/Data/Configuration/HealthCheckExecutionEntryMap.cs b/src/HealthChecks.UI.Core/Data/Configuration/HealthCheckExecutionEntryMap.cs index 434a7323df..f7b6828cf9 100644 --- a/src/HealthChecks.UI.Core/Data/Configuration/HealthCheckExecutionEntryMap.cs +++ b/src/HealthChecks.UI.Core/Data/Configuration/HealthCheckExecutionEntryMap.cs @@ -20,6 +20,9 @@ public void Configure(EntityTypeBuilder builder) builder.Property(le => le.Status) .IsRequired(true); + builder.Property(le => le.Data) + .IsRequired(false); + builder.Property(le => le.Description) .IsRequired(false); diff --git a/src/HealthChecks.UI.Core/Data/HealthCheckExecutionEntry.cs b/src/HealthChecks.UI.Core/Data/HealthCheckExecutionEntry.cs index b484c24f86..fcc99117ec 100644 --- a/src/HealthChecks.UI.Core/Data/HealthCheckExecutionEntry.cs +++ b/src/HealthChecks.UI.Core/Data/HealthCheckExecutionEntry.cs @@ -16,5 +16,7 @@ public class HealthCheckExecutionEntry public TimeSpan Duration { get; set; } public List Tags { get; set; } + + public string Data { get; set; } } } diff --git a/src/HealthChecks.UI/Core/Extensions/HealthReportExtensions.cs b/src/HealthChecks.UI/Core/Extensions/HealthReportExtensions.cs index 7448730043..04a9228b05 100644 --- a/src/HealthChecks.UI/Core/Extensions/HealthReportExtensions.cs +++ b/src/HealthChecks.UI/Core/Extensions/HealthReportExtensions.cs @@ -1,5 +1,6 @@ using HealthChecks.UI.Core; using HealthChecks.UI.Core.Data; +using Newtonsoft.Json; using System.Collections.Generic; using System.Linq; @@ -18,6 +19,7 @@ public static List ToExecutionEntries(this UIHealthRe Status = item.Value.Status, Description = item.Value.Description, Duration = item.Value.Duration, + Data = JsonConvert.SerializeObject(item.Value.Data), Tags = item.Value.Tags?.ToList() ?? null }; }).ToList(); From ebb4cdf74eb336f2cd696ffc7ed0b158d7d3ab36 Mon Sep 17 00:00:00 2001 From: Mariusz Kogut Date: Thu, 22 Jul 2021 14:26:27 +0200 Subject: [PATCH 2/5] Introduce LivenessData component --- src/HealthChecks.UI/.editorconfig | 2 ++ src/HealthChecks.UI/assets/healthchecksui.css | 6 +++++ .../client/components/LivenessData.tsx | 23 +++++++++++++++++++ .../client/components/LivenessDetail.tsx | 2 ++ .../client/typings/models.d.ts | 1 + 5 files changed, 34 insertions(+) create mode 100644 src/HealthChecks.UI/.editorconfig create mode 100644 src/HealthChecks.UI/client/components/LivenessData.tsx diff --git a/src/HealthChecks.UI/.editorconfig b/src/HealthChecks.UI/.editorconfig new file mode 100644 index 0000000000..879c89f8aa --- /dev/null +++ b/src/HealthChecks.UI/.editorconfig @@ -0,0 +1,2 @@ +[*] +indent_size = 4 diff --git a/src/HealthChecks.UI/assets/healthchecksui.css b/src/HealthChecks.UI/assets/healthchecksui.css index 52b564b609..f710fb742c 100644 --- a/src/HealthChecks.UI/assets/healthchecksui.css +++ b/src/HealthChecks.UI/assets/healthchecksui.css @@ -462,6 +462,12 @@ h4 { justify-content: center; } +.hc-liveness-detail__data { + display: block; + padding: 0.5rem; + background-color: var(--midGrayColor); +} + .hc-liveness-detail .hc-status { font-size: 0.75rem; } diff --git a/src/HealthChecks.UI/client/components/LivenessData.tsx b/src/HealthChecks.UI/client/components/LivenessData.tsx new file mode 100644 index 0000000000..990d8a2dbb --- /dev/null +++ b/src/HealthChecks.UI/client/components/LivenessData.tsx @@ -0,0 +1,23 @@ +import React, {FunctionComponent, useEffect, useState} from 'react'; +import {Check} from '../typings/models'; + +interface LivenessDataProps { + healthcheck: Check; +} + +const LivenessData: FunctionComponent = props => { + if (props.healthcheck === null) return null; + + const [data, setData] = useState(null) + useEffect(() => { + setData(JSON.parse(props.healthcheck.data)) + }, [props]) + + return ( +
+ {data && (
{JSON.stringify(data, null, 2)}
)} +
+ ); +}; + +export {LivenessData}; diff --git a/src/HealthChecks.UI/client/components/LivenessDetail.tsx b/src/HealthChecks.UI/client/components/LivenessDetail.tsx index 804c2dcb9b..7d2c252dbe 100644 --- a/src/HealthChecks.UI/client/components/LivenessDetail.tsx +++ b/src/HealthChecks.UI/client/components/LivenessDetail.tsx @@ -6,6 +6,7 @@ import { import 'react-vertical-timeline-component/style.min.css'; import { ExecutionHistory, Check } from '../typings/models'; import { Status } from './Status'; +import { LivenessData } from "./LivenessData"; import moment from 'moment'; interface LivenessDetailsProps { @@ -22,6 +23,7 @@ const LivenessDetail: FunctionComponent = props => {

{props.healthcheck.name}

+
{props.executionHistory.length > 0 && ( diff --git a/src/HealthChecks.UI/client/typings/models.d.ts b/src/HealthChecks.UI/client/typings/models.d.ts index f4e616d162..554fe5ea3b 100644 --- a/src/HealthChecks.UI/client/typings/models.d.ts +++ b/src/HealthChecks.UI/client/typings/models.d.ts @@ -24,6 +24,7 @@ export interface Check { status: string; description: string; duration: string; + data: string; tags: string[]; } From 4d8a114dbaea0ec97c3ca50af89e8634e6e24ca9 Mon Sep 17 00:00:00 2001 From: Daniel Weber Date: Fri, 11 Jun 2021 14:44:21 +0200 Subject: [PATCH 3/5] In HealthChecks.UI.Image/Dockerfile, dotnet build reports that npm 8 is no longer supported, so I updated it. Works for me. --- build/docker-images/HealthChecks.UI.Image/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/docker-images/HealthChecks.UI.Image/Dockerfile b/build/docker-images/HealthChecks.UI.Image/Dockerfile index 1d4b2c3ded..0342d564e3 100644 --- a/build/docker-images/HealthChecks.UI.Image/Dockerfile +++ b/build/docker-images/HealthChecks.UI.Image/Dockerfile @@ -4,8 +4,8 @@ EXPOSE 80 FROM mcr.microsoft.com/dotnet/sdk:6.0.101-bullseye-slim AS sdk-with-node -ENV NODE_VERSION 8.11.1 -ENV NODE_DOWNLOAD_SHA 0e20787e2eda4cc31336d8327556ebc7417e8ee0a6ba0de96a09b0ec2b841f60 +ENV NODE_VERSION 14.17.0 +ENV NODE_DOWNLOAD_SHA 3d06eabc73ec8626337bff370474306eac1c3c21122f677720d154c556ceafaf RUN curl -SL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz" --output nodejs.tar.gz \ && echo "$NODE_DOWNLOAD_SHA nodejs.tar.gz" | sha256sum -c - \ && tar -xzf "nodejs.tar.gz" -C /usr/local --strip-components=1 \ From 5d2ed71ca13d8f36d9b3ca313552690a4fd45449 Mon Sep 17 00:00:00 2001 From: Daniel Weber Date: Thu, 22 Jul 2021 11:42:00 +0200 Subject: [PATCH 4/5] Build docker image on Github actions. --- .github/workflows/build.yml | 71 +++++++++++++++++++++++++++++++++++++ version.json | 8 +++++ 2 files changed, 79 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 version.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..bd4f6650a3 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,71 @@ +name: Build HealthCheck UI docker image + +on: + push : + branches: + - 'ExRam' + +env: + DotNetVersion: '6.0.100' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup .NET Core ${{ env.DotNetVersion }} + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ env.DotNetVersion }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Determine semantic version + uses: dotnet/nbgv@master + id: nbgv + with: + setAllVars: true + + - name: Set versions + run: | + echo "version1=${{steps.nbgv.outputs.VersionMajor}}" >> $GITHUB_ENV + echo "version2=${{steps.nbgv.outputs.VersionMajor}}.${{steps.nbgv.outputs.VersionMinor}}" >> $GITHUB_ENV + echo "version3=${{steps.nbgv.outputs.VersionMajor}}.${{steps.nbgv.outputs.VersionMinor}}.${{steps.nbgv.outputs.BuildNumber}}" >> $GITHUB_ENV + echo "version4=${{steps.nbgv.outputs.VersionMajor}}.${{steps.nbgv.outputs.VersionMinor}}.${{steps.nbgv.outputs.BuildNumber}}${{steps.nbgv.outputs.PrereleaseVersion}}" >> $GITHUB_ENV + echo "version5=${{steps.nbgv.outputs.VersionMajor}}.${{steps.nbgv.outputs.VersionMinor}}.${{steps.nbgv.outputs.BuildNumber}}${{steps.nbgv.outputs.PrereleaseVersion}}.${{steps.nbgv.outputs.VersionHeight}}" >> $GITHUB_ENV + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.PACKAGES_TOKEN }} + + - name: Build Dockerfile + uses: docker/build-push-action@v2 + with: + push: true + file: build/docker-images/HealthChecks.UI.Image/Dockerfile + build-args: | + version=${{ env.version4 }} + versionHeight=${{steps.nbgv.outputs.VersionHeight}} + tags: | + ghcr.io/exram/aspnetcore.diagnostics.healthchecks.ui:${{ env.version1 }} + ghcr.io/exram/aspnetcore.diagnostics.healthchecks.ui:${{ env.version2 }} + ghcr.io/exram/aspnetcore.diagnostics.healthchecks.ui:${{ env.version3 }} + ghcr.io/exram/aspnetcore.diagnostics.healthchecks.ui:${{ env.version4 }} + ghcr.io/exram/aspnetcore.diagnostics.healthchecks.ui:${{ env.version5 }} + + - name: Bump version and push tag + uses: mathieudutour/github-tag-action@v5.3 + with: + custom_tag: AspNetCore.Diagnostics.HealthChecks.UI-Docker-${{ env.version5 }} + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/version.json b/version.json new file mode 100644 index 0000000000..e7c4b963c0 --- /dev/null +++ b/version.json @@ -0,0 +1,8 @@ +{ + "version": "1.0.3", + "cloudBuild": { + "buildNumber": { + "enabled": true + } + } +} \ No newline at end of file From cbf001b30dfd2505f291cca95d38b8faaaf926f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 15:41:51 +0000 Subject: [PATCH 5/5] Bump docker/build-push-action from 2 to 6 Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2 to 6. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v2...v6) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd4f6650a3..571506441c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,7 +50,7 @@ jobs: password: ${{ secrets.PACKAGES_TOKEN }} - name: Build Dockerfile - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: push: true file: build/docker-images/HealthChecks.UI.Image/Dockerfile