Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Src/WitsmlExplorer.Api/Workers/Modify/ModifyLogCurveInfoWorker.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -8,6 +9,7 @@

using Witsml;
using Witsml.Data;
using Witsml.Data.Measures;
using Witsml.Extensions;
using Witsml.ServiceReference;

Expand Down Expand Up @@ -131,6 +133,16 @@ private static WitsmlLogs GetModifyLogCurveInfoQuery(ModifyLogCurveInfoJob job,
originalLogCurveInfo.Mnemonic = job.LogCurveInfo.Mnemonic;
originalLogCurveInfo.Uid = job.LogCurveInfo.Mnemonic;
}
if (job.LogCurveInfo.SensorOffset != null)
{
originalLogCurveInfo.SensorOffset = new WitsmlLengthMeasure()
{
Value =
job.LogCurveInfo.SensorOffset.Value.ToString(
CultureInfo.InvariantCulture),
Uom = job.LogCurveInfo.SensorOffset.Uom
};
}

originalLogCurveInfo.Unit = job.LogCurveInfo.Unit;
originalLogCurveInfo.CurveDescription = job.LogCurveInfo.CurveDescription.NullIfEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { measureToString } from "models/measure";
import MultiLogCurveInfo from "models/multilogCurveInfo";
import { getNameOccurrenceSuffix } from "tools/logSameNamesHelper";
import BaseReport from "../../models/reports/BaseReport.tsx";
import { MultiLogCurveInfoViewData } from "../MultiLogUtils.tsx";

export interface LogCurveInfoRow extends ContentTableRow {
uid: string;
Expand Down Expand Up @@ -135,8 +136,7 @@ export const getTableData = (
dateTimeFormat: DateTimeFormat,
curveThreshold: CurveThreshold,
isDepthIndex: boolean,
logUid: string = null,
extendLogCurveInfoObject: boolean = false
logUid: string = null
) => {
if (!logCurveInfoList) return [];

Expand Down Expand Up @@ -224,7 +224,7 @@ export const getTableData = (
qcInfo,
qcTimestamp,
logCurveInfo,
...(extendLogCurveInfoObject ? logCurveInfo : undefined)
serverName: (logCurveInfo as MultiLogCurveInfoViewData).serverName
};
})
.sort((curve, curve2) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,7 @@ const MultiLogCurveSelectionList = (
dateTimeFormat,
curveThreshold,
isDepthIndex,
null,
true
null
)}
checkableRows={true}
stickyLeftColumns={2}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,26 @@ export default function QueryDataGrid() {
label: "value",
type: ContentType.Component
},
{
property: "required",
label: "required",
type: ContentType.String
},
{
property: "baseType",
label: "base type",
type: ContentType.String
},
{
property: "witsmlType",
label: "witsml type",
type: ContentType.String
},
{
property: "maxLength",
label: "max length",
type: ContentType.String
},
{
property: "documentation",
label: "documentation",
Expand Down Expand Up @@ -175,7 +195,7 @@ export default function QueryDataGrid() {
}, [data]);

return tableData?.length > 0 ? (
<div style={{ height: "0", minHeight: "100%" }}>
<div style={{ height: "0", minHeight: "100%", minWidth: "500px" }}>
<ContentTable
key={tabId}
viewId="queryDataGrid"
Expand Down Expand Up @@ -204,6 +224,10 @@ export default function QueryDataGrid() {

interface QueryGridDataRow extends ContentTableRow {
name: string;
required?: boolean;
baseType?: string;
witsmlType?: string;
maxLength?: number;
documentation: string;
value: any;
isAttribute?: boolean;
Expand All @@ -223,8 +247,17 @@ const mergeTemplateWithQuery = (
parentId: string = "",
index: number | null = null
): QueryGridDataRow => {
const { name, documentation, isContainer, isAttribute, properties } =
templateNode;
const {
name,
documentation,
isContainer,
isAttribute,
properties,
required,
baseType,
witsmlType,
maxLength
} = templateNode;

const uniqueId =
(parentId ? `${parentId}--` : "") +
Expand Down Expand Up @@ -257,6 +290,10 @@ const mergeTemplateWithQuery = (
return {
id: uniqueId,
name,
required,
baseType,
witsmlType,
maxLength,
documentation,
value,
isAttribute,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import { QueryEditor } from "components/QueryEditor";
import { getTag } from "components/QueryEditorUtils";
import { QueryActionType, QueryContext } from "contexts/queryContext";
import { useOperationState } from "hooks/useOperationState";
import React, { useContext, useState } from "react";
import React, {
useCallback,
useContext,
useEffect,
useRef,
useState
} from "react";
import styled from "styled-components";
import Icon from "styles/Icons";

Expand All @@ -12,8 +18,11 @@ import QueryDataGrid from "components/ContentViews/QueryDataGrid";
import { QueryEditorTypes } from "components/ContentViews/QueryView/components/QueryOptions/QueryOptions";
import ResultMeta from "components/ContentViews/QueryView/components/ResultMeta";
import { StyledTab } from "components/StyledComponents/StyledTab";
import { Colors } from "styles/Colors";
import QueryOptions from "./components/QueryOptions";

const MIN_LEFT_PANEL_WIDTH = 500;

const QueryView = (): React.ReactElement => {
const {
operationState: { colors }
Expand All @@ -25,6 +34,9 @@ const QueryView = (): React.ReactElement => {
const [editorType, setEditorType] = useState<QueryEditorTypes>(
QueryEditorTypes.AceEditor
);
const leftPaneRef = useRef<HTMLDivElement | null>(null);
const [isResizing, setIsResizing] = useState<boolean>(false);
const [resizeWidth, setResizeWidth] = useState<number | null>(null);

const { query, result } = queries[tabIndex];

Expand All @@ -51,6 +63,48 @@ const QueryView = (): React.ReactElement => {
);
};

const startResizing = useCallback(
(event: React.MouseEvent<HTMLDivElement>) => {
setIsResizing(true);
event.preventDefault();
event.stopPropagation();
setResizeWidth(
leftPaneRef.current?.getBoundingClientRect().width ??
MIN_LEFT_PANEL_WIDTH
);
},
[]
);

const stopResizing = useCallback(() => {
setIsResizing(false);
}, []);

const resize = useCallback(
(event: MouseEvent) => {
if (isResizing) {
event.stopPropagation();
event.preventDefault();
setResizeWidth((previousWidth) =>
Math.max(
(previousWidth ?? MIN_LEFT_PANEL_WIDTH) + event.movementX,
MIN_LEFT_PANEL_WIDTH
)
);
}
},
[isResizing]
);

useEffect(() => {
window.addEventListener("mousemove", resize);
window.addEventListener("mouseup", stopResizing);
return () => {
window.removeEventListener("mousemove", resize);
window.removeEventListener("mouseup", stopResizing);
};
}, [resize, stopResizing]);

return (
<Layout>
<Tabs
Expand Down Expand Up @@ -78,12 +132,15 @@ const QueryView = (): React.ReactElement => {
<div
style={{
display: "grid",
gridTemplateColumns: "1fr 1fr",
gridTemplateColumns: resizeWidth
? `${resizeWidth}px auto 1fr`
: "1fr auto 1fr",
height: "100%",
padding: "1rem 0rem"
}}
>
<Box
ref={leftPaneRef}
display="grid"
gridTemplateRows="auto 1fr auto"
gap="0.5rem"
Expand All @@ -105,6 +162,7 @@ const QueryView = (): React.ReactElement => {
/>
)}
</Box>
<ResizeDivider onMouseDown={startResizing} colors={colors} />
<Box
display="grid"
gridTemplateRows="auto 1fr"
Expand Down Expand Up @@ -136,4 +194,19 @@ const StyledClearIcon = styled(Icon)`
}
`;

const ResizeDivider = styled.div<{ colors: Colors }>`
justify-self: flex-end;
cursor: col-resize;
resize: horizontal;
width: 0.2rem;
margin: 0 0.3rem 0 0.3rem;
background: ${(props) => props.colors.interactive.sidebarDivider};
border-radius: 5px;
&:hover {
background: ${(props) => props.colors.interactive.sidebarDivider};
width: 0.4rem;
margin: 0 0.2rem 0 0.2rem;
}
`;

export default QueryView;
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { PropertiesModalMode, validText } from "components/Modals/ModalParts";
import {
PropertiesModalMode,
validMeasure,
validText
} from "components/Modals/ModalParts";
import { PropertyType } from "components/Modals/PropertiesModal/PropertyTypes";
import { getMaxLengthHelperText } from "components/Modals/PropertiesModal/ValidationHelpers";
import {
getMaxLengthHelperText,
getMeasureHelperText
} from "components/Modals/PropertiesModal/ValidationHelpers";
import { PropertiesModalProperty } from "components/Modals/PropertiesModal/propertiesModalProperty";
import AxisDefinition from "models/AxisDefinition";
import LogCurveInfo from "models/logCurveInfo";
Expand Down Expand Up @@ -30,6 +37,12 @@ export const getLogCurveInfoProperties = (
validator: (value: string) => validText(value, 1, MaxLength.UomEnum),
helperText: getMaxLengthHelperText("unit", MaxLength.UomEnum)
},
{
property: "sensorOffset",
propertyType: PropertyType.Measure,
validator: validMeasure,
helperText: getMeasureHelperText("sensorOffset")
},
{
property: "curveDescription",
propertyType: PropertyType.String,
Expand Down
11 changes: 8 additions & 3 deletions Src/WitsmlExplorer.Frontend/components/PageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ const PageLayout = (): ReactElement => {
const { operationState } = useOperationState();
const { colors } = operationState;

const startResizing = useCallback(() => {
setIsResizing(true);
}, []);
const startResizing = useCallback(
(event: React.MouseEvent<HTMLDivElement>) => {
event.stopPropagation();
event.preventDefault();
setIsResizing(true);
},
[]
);

const stopResizing = useCallback(() => {
setIsResizing(false);
Expand Down
7 changes: 5 additions & 2 deletions Src/WitsmlExplorer.Frontend/templates/all/convCore.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@
<cleaningMethod />
<dryingMethod />
<comments />
<commonTime />
<commonTime>
<dTimCreation />
<dTimLastChange />
</commonTime>
<extensionNameValue uid="">
<name />
<value uom="" />
Expand Down Expand Up @@ -228,4 +231,4 @@
</commonData>
<customData />
</convCore>
</convCores>
</convCores>
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
export interface DataGridProperty {
name: string;
documentation: string;
required?: boolean;
baseType?: string;
witsmlType?: string;
maxLength?: number;
isAttribute?: boolean;
isContainer?: boolean;
isMultiple?: boolean;
Expand Down
Loading
Loading