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/Directory.Build.targets b/Directory.Build.targets index 34c5e4e815..3a4b73e164 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -50,7 +50,7 @@ - + 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 \ 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/.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/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(); 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[]; } 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