From 2c5591ff7a6ec2aae574731ab94e5f23024b2d37 Mon Sep 17 00:00:00 2001 From: Elias Bruvik Date: Fri, 4 Aug 2023 09:51:40 +0100 Subject: [PATCH] FIX-499 review feedback --- .../Workers/ImportLogDataWorker.cs | 4 +- .../ContextMenus/LogObjectContextMenu.tsx | 4 +- .../components/Modals/LogComparisonModal.tsx | 2 +- .../components/Modals/LogDataImportModal.tsx | 87 ++++++++++--------- 4 files changed, 53 insertions(+), 44 deletions(-) diff --git a/Src/WitsmlExplorer.Api/Workers/ImportLogDataWorker.cs b/Src/WitsmlExplorer.Api/Workers/ImportLogDataWorker.cs index 997b8d047..a3c94472e 100644 --- a/Src/WitsmlExplorer.Api/Workers/ImportLogDataWorker.cs +++ b/Src/WitsmlExplorer.Api/Workers/ImportLogDataWorker.cs @@ -137,8 +137,8 @@ private static WitsmlLogs CreateAddMnemonicsQuery(ImportLogDataJob job, WitsmlLo { Mnemonic = job.Mnemonics.ElementAt(i), Unit = string.IsNullOrEmpty(job.Units.ElementAt(i)) ? "unitless" : job.Units.ElementAt(i), // Can't updateInStore with an empty unit - Uid = Guid.NewGuid().ToString(), - TypeLogData = (i == 0 && witsmlLog.IndexType == WitsmlLog.WITSML_INDEX_TYPE_DATE_TIME) ? WitsmlLogCurveInfo.LogDataTypeDatetime : WitsmlLogCurveInfo.LogDataTypeDouble + Uid = job.Mnemonics.ElementAt(i), + TypeLogData = WitsmlLogCurveInfo.LogDataTypeDouble }).ToList(), }.AsSingletonList() }; diff --git a/Src/WitsmlExplorer.Frontend/components/ContextMenus/LogObjectContextMenu.tsx b/Src/WitsmlExplorer.Frontend/components/ContextMenus/LogObjectContextMenu.tsx index 257a510c6..da8e9caa0 100644 --- a/Src/WitsmlExplorer.Frontend/components/ContextMenus/LogObjectContextMenu.tsx +++ b/Src/WitsmlExplorer.Frontend/components/ContextMenus/LogObjectContextMenu.tsx @@ -22,7 +22,7 @@ import { PropertiesModalMode } from "../Modals/ModalParts"; import ObjectPickerModal, { ObjectPickerProps } from "../Modals/ObjectPickerModal"; import TrimLogObjectModal, { TrimLogObjectModalProps } from "../Modals/TrimLogObject/TrimLogObjectModal"; import ContextMenu from "./ContextMenu"; -import { menuItemText, StyledIcon } from "./ContextMenuUtils"; +import { StyledIcon, menuItemText } from "./ContextMenuUtils"; import { onClickPaste } from "./CopyUtils"; import { ObjectContextMenuProps, ObjectMenuItems } from "./ObjectMenuItems"; import { useClipboardComponentReferencesOfType } from "./UseClipboardComponentReferences"; @@ -48,7 +48,7 @@ const LogObjectContextMenu = (props: ObjectContextMenuProps): React.ReactElement }; const onClickImport = async () => { - const logDataImportModalProps: LogDataImportModalProps = { targetLog: checkedObjects[0], dispatchOperation }; + const logDataImportModalProps: LogDataImportModalProps = { targetLog: checkedObjects[0] }; dispatchOperation({ type: OperationType.DisplayModal, payload: }); }; diff --git a/Src/WitsmlExplorer.Frontend/components/Modals/LogComparisonModal.tsx b/Src/WitsmlExplorer.Frontend/components/Modals/LogComparisonModal.tsx index d928bccf4..efabeec15 100644 --- a/Src/WitsmlExplorer.Frontend/components/Modals/LogComparisonModal.tsx +++ b/Src/WitsmlExplorer.Frontend/components/Modals/LogComparisonModal.tsx @@ -211,7 +211,7 @@ const columns: Column[] = [ { name: "Source/target end", accessor: "endIndexes" } ]; -const StyledAccordionHeader = styled(Accordion.Header)<{ colors: Colors }>` +export const StyledAccordionHeader = styled(Accordion.Header)<{ colors: Colors }>` background-color: ${(props) => props.colors.ui.backgroundDefault}; &:hover { background-color: ${(props) => props.colors.ui.backgroundLight}; diff --git a/Src/WitsmlExplorer.Frontend/components/Modals/LogDataImportModal.tsx b/Src/WitsmlExplorer.Frontend/components/Modals/LogDataImportModal.tsx index 5e311471e..eb7c2f6b4 100644 --- a/Src/WitsmlExplorer.Frontend/components/Modals/LogDataImportModal.tsx +++ b/Src/WitsmlExplorer.Frontend/components/Modals/LogDataImportModal.tsx @@ -1,8 +1,9 @@ -import { Button, Tooltip, Typography } from "@material-ui/core"; +import { Accordion, List } from "@equinor/eds-core-react"; +import { Button, Tooltip, Typography } from "@material-ui/core"; import { CloudUpload } from "@material-ui/icons"; -import React, { useCallback, useEffect, useState } from "react"; +import React, { useCallback, useContext, useEffect, useState } from "react"; import styled from "styled-components"; -import { HideModalAction } from "../../contexts/operationStateReducer"; +import OperationContext from "../../contexts/operationContext"; import OperationType from "../../contexts/operationType"; import { ComponentType } from "../../models/componentType"; import ImportLogDataJob from "../../models/jobs/importLogDataJob"; @@ -13,12 +14,11 @@ import { toObjectReference } from "../../models/objectOnWellbore"; import { truncateAbortHandler } from "../../services/apiClient"; import ComponentService from "../../services/componentService"; import JobService, { JobType } from "../../services/jobService"; -import Icon from "../../styles/Icons"; +import { StyledAccordionHeader } from "./LogComparisonModal"; import ModalDialog from "./ModalDialog"; export interface LogDataImportModalProps { targetLog: LogObject; - dispatchOperation: (action: HideModalAction) => void; } interface ImportColumn { index: number; @@ -31,7 +31,11 @@ const MISSING_INDEX_CURVE = "The target index curve needs to be present in the c const UNITLESS_UNIT = "unitless"; const LogDataImportModal = (props: LogDataImportModalProps): React.ReactElement => { - const { targetLog, dispatchOperation } = props; + const { targetLog } = props; + const { + dispatchOperation, + operationState: { colors } + } = useContext(OperationContext); const [uploadedFile, setUploadedFile] = useState(null); const [uploadedFileData, setUploadedFileData] = useState([]); const [uploadedFileColumns, setUploadedFileColumns] = useState([]); @@ -113,40 +117,39 @@ const LogDataImportModal = (props: LogDataImportModalProps): React.ReactElement - + + {uploadedFile?.name ?? "No file chosen"} + + + + + Limitations + + + Currently, only double values are supported as TypeLogData. + The csv is expected to have this format: -
- IndexCurve[unit],Curve1[unit],Curve2[unit] -
- 195.99,,2500 -
- 196.00,1,2501 - - } - > - - - } - > - Upload File - - - - {uploadedFile?.name ?? "No file chosen"} - - + + + IndexCurve[unit],Curve1[unit],Curve2[unit] +
+ 195.99,,2500 +
+ 196.00,1,2501 +
+
+
+
+
+
+
+ } confirmDisabled={!uploadedFile || !!error} confirmText={"Import"} @@ -169,4 +172,10 @@ const FileContainer = styled.div` } `; +const Container = styled.div` + display: flex; + flex-direction: column; + gap: 1.5rem; +`; + export default LogDataImportModal;