Skip to content

Commit

Permalink
FIX-2386 Add compare log data header (#2391)
Browse files Browse the repository at this point in the history
  • Loading branch information
janmarius authored Apr 29, 2024
1 parent 6db31fe commit 31a00b9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions Src/WitsmlExplorer.Api/Models/Reports/BaseReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
}
5 changes: 5 additions & 0 deletions Src/WitsmlExplorer.Api/Workers/CompareLogDataWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class CompareLogDataWorker : BaseWorker<CompareLogDataJob>, IWorker
public JobType JobType => JobType.CompareLogData;
private List<ICompareLogDataItem> _compareLogDataReportItems;
private Dictionary<string, int> _mnemonicsMismatchCount;
private string _sourceServerName;
private string _targetServerName;
private const int MaxMismatchesLimit = 500;
private int _sourceDepthLogDecimals;
private int _targetDepthLogDecimals;
Expand All @@ -48,6 +50,8 @@ public CompareLogDataWorker(ILogger<CompareLogDataJob> logger, IWitsmlClientProv
IEnumerable<Server> servers = _witsmlServerRepository == null ? new List<Server>() : 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;

Expand Down Expand Up @@ -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}"
};
}

Expand Down
18 changes: 18 additions & 0 deletions Src/WitsmlExplorer.Frontend/components/Modals/ReportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import {
Accordion,
DotProgress,
Icon,
TextField,
Typography
} from "@equinor/eds-core-react";
import {
ContentTable,
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";
Expand Down Expand Up @@ -97,6 +99,22 @@ export const ReportModal = (props: ReportModal): React.ReactElement => {
<ContentLayout>
{report ? (
<>
{report.jobDetails && (
<LabelsLayout>
{report.jobDetails.split("|").map((jobDetail) => {
const keyValuePair = jobDetail.split("::");
return (
<TextField
key={keyValuePair[0].trim()}
readOnly
id={keyValuePair[0].trim()}
label={keyValuePair[0]}
defaultValue={keyValuePair[1]}
/>
);
})}
</LabelsLayout>
)}
{report.warningMessage && (
<Banner colors={colors}>
<Banner.Icon variant="warning">
Expand Down
7 changes: 5 additions & 2 deletions Src/WitsmlExplorer.Frontend/models/reports/BaseReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default interface BaseReport {
warningMessage?: string;
downloadImmediately?: boolean;
reportHeader?: string;
jobDetails?: string;
}

export const createReport = (
Expand All @@ -13,14 +14,16 @@ export const createReport = (
reportItems: any[] = [],
warningMessage: string = null,
downloadImmediately: boolean = null,
reportHeader: string = null
reportHeader: string = null,
jobDetails: string = null
): BaseReport => {
return {
title,
summary,
reportItems,
warningMessage,
downloadImmediately,
reportHeader
reportHeader,
jobDetails
};
};

0 comments on commit 31a00b9

Please sign in to comment.