From 31a00b90404f84aead58ff638e62299e982d814b Mon Sep 17 00:00:00 2001 From: Jan-Marius Vatle <48485965+janmarius@users.noreply.github.com> Date: Mon, 29 Apr 2024 09:20:57 +0200 Subject: [PATCH] FIX-2386 Add compare log data header (#2391) --- .../Models/Reports/BaseReport.cs | 1 + .../Workers/CompareLogDataWorker.cs | 5 +++++ .../components/Modals/ReportModal.tsx | 18 ++++++++++++++++++ .../models/reports/BaseReport.tsx | 7 +++++-- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Src/WitsmlExplorer.Api/Models/Reports/BaseReport.cs b/Src/WitsmlExplorer.Api/Models/Reports/BaseReport.cs index d55f178f5..858bbb03a 100644 --- a/Src/WitsmlExplorer.Api/Models/Reports/BaseReport.cs +++ b/Src/WitsmlExplorer.Api/Models/Reports/BaseReport.cs @@ -10,5 +10,6 @@ public class BaseReport public string WarningMessage { get; init; } public bool DownloadImmediately { get; init; } = false; public string ReportHeader { get; init; } + public string JobDetails { get; init; } } } diff --git a/Src/WitsmlExplorer.Api/Workers/CompareLogDataWorker.cs b/Src/WitsmlExplorer.Api/Workers/CompareLogDataWorker.cs index 460d1b6f0..2f3150aaf 100644 --- a/Src/WitsmlExplorer.Api/Workers/CompareLogDataWorker.cs +++ b/Src/WitsmlExplorer.Api/Workers/CompareLogDataWorker.cs @@ -27,6 +27,8 @@ public class CompareLogDataWorker : BaseWorker, IWorker public JobType JobType => JobType.CompareLogData; private List _compareLogDataReportItems; private Dictionary _mnemonicsMismatchCount; + private string _sourceServerName; + private string _targetServerName; private const int MaxMismatchesLimit = 500; private int _sourceDepthLogDecimals; private int _targetDepthLogDecimals; @@ -48,6 +50,8 @@ public CompareLogDataWorker(ILogger logger, IWitsmlClientProv IEnumerable servers = _witsmlServerRepository == null ? new List() : await _witsmlServerRepository.GetDocumentsAsync(); _sourceDepthLogDecimals = servers.FirstOrDefault((server) => server.Url.EqualsIgnoreCase(sourceHostname))?.DepthLogDecimals ?? 0; _targetDepthLogDecimals = servers.FirstOrDefault((server) => server.Url.EqualsIgnoreCase(targetHostname))?.DepthLogDecimals ?? 0; + _sourceServerName = servers.FirstOrDefault((server) => server.Url.EqualsIgnoreCase(sourceHostname))?.Name; + _targetServerName = servers.FirstOrDefault((server) => server.Url.EqualsIgnoreCase(targetHostname))?.Name; _smallestDepthLogDecimals = Math.Min(_sourceDepthLogDecimals, _targetDepthLogDecimals); _isEqualNumOfDecimals = _sourceDepthLogDecimals == _targetDepthLogDecimals; @@ -299,6 +303,7 @@ private BaseReport GenerateReport(WitsmlLog sourceLog, WitsmlLog targetLog) : $"No mismatches were found in the data indexes of the {(_isDepthLog ? "depth" : "time")} logs '{sourceLog.Name}' and '{targetLog.Name}'{indexRange}.", ReportItems = _compareLogDataReportItems, WarningMessage = _compareLogDataReportItems.Count >= MaxMismatchesLimit ? $"When finding {MaxMismatchesLimit:n0} mismatches while searching through data indexes for any mnemonic, we stop comparing the log data for that particular mnemonic. This is because {MaxMismatchesLimit:n0} is the maximum limit for mismatches during the search for each mnemonic. It indicates that there might be an issue with the compare log setup. However, you can still access the report for the comparison performed below." : null, + JobDetails = $"SourceServer::{_sourceServerName}|TargetServer::{_targetServerName}|SourceLog::{sourceLog.Name}|TargetLog::{targetLog.Name}" }; } diff --git a/Src/WitsmlExplorer.Frontend/components/Modals/ReportModal.tsx b/Src/WitsmlExplorer.Frontend/components/Modals/ReportModal.tsx index 4a9924675..88a89eb40 100644 --- a/Src/WitsmlExplorer.Frontend/components/Modals/ReportModal.tsx +++ b/Src/WitsmlExplorer.Frontend/components/Modals/ReportModal.tsx @@ -2,6 +2,7 @@ import { Accordion, DotProgress, Icon, + TextField, Typography } from "@equinor/eds-core-react"; import { @@ -9,6 +10,7 @@ import { ContentTableColumn, ContentType } from "components/ContentViews/table"; +import { LabelsLayout } from "components/Modals/ComparisonModalStyles"; import { StyledAccordionHeader } from "components/Modals/LogComparisonModal"; import ModalDialog, { ModalWidth } from "components/Modals/ModalDialog"; import { generateReport } from "components/ReportCreationHelper"; @@ -97,6 +99,22 @@ export const ReportModal = (props: ReportModal): React.ReactElement => { {report ? ( <> + {report.jobDetails && ( + + {report.jobDetails.split("|").map((jobDetail) => { + const keyValuePair = jobDetail.split("::"); + return ( + + ); + })} + + )} {report.warningMessage && ( diff --git a/Src/WitsmlExplorer.Frontend/models/reports/BaseReport.tsx b/Src/WitsmlExplorer.Frontend/models/reports/BaseReport.tsx index d47b33d8d..9d2a3d4ed 100644 --- a/Src/WitsmlExplorer.Frontend/models/reports/BaseReport.tsx +++ b/Src/WitsmlExplorer.Frontend/models/reports/BaseReport.tsx @@ -5,6 +5,7 @@ export default interface BaseReport { warningMessage?: string; downloadImmediately?: boolean; reportHeader?: string; + jobDetails?: string; } export const createReport = ( @@ -13,7 +14,8 @@ export const createReport = ( reportItems: any[] = [], warningMessage: string = null, downloadImmediately: boolean = null, - reportHeader: string = null + reportHeader: string = null, + jobDetails: string = null ): BaseReport => { return { title, @@ -21,6 +23,7 @@ export const createReport = ( reportItems, warningMessage, downloadImmediately, - reportHeader + reportHeader, + jobDetails }; };