Skip to content

Commit

Permalink
Merge pull request #2038 from janmarius/FIX-2034
Browse files Browse the repository at this point in the history
FIX-2034 add itemState to mudLog properties
  • Loading branch information
janmarius authored Sep 21, 2023
2 parents b6dee93 + 4c87c24 commit 4f6966f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const MudLogsListView = (): React.ReactElement => {
endMd: measureToString(mudLog.endMd),
dTimCreation: formatDateString(mudLog.commonData?.dTimCreation, timeZone),
dTimLastChange: formatDateString(mudLog.commonData?.dTimLastChange, timeZone),
itemState: mudLog.commonData?.itemState,
uid: mudLog.uid,
mudLog
};
Expand All @@ -71,6 +72,7 @@ export const MudLogsListView = (): React.ReactElement => {
{ property: "endMd", label: "endMd", type: ContentType.Measure },
{ property: "dTimCreation", label: "commonData.dTimCreation", type: ContentType.DateTime },
{ property: "dTimLastChange", label: "commonData.dTimLastChange", type: ContentType.DateTime },
{ property: "itemState", label: "commonData.itemState", type: ContentType.String },
{ property: "uid", label: "uid", type: ContentType.String }
];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TextField } from "@equinor/eds-core-react";
import { Autocomplete, TextField } from "@equinor/eds-core-react";
import React, { useContext, useEffect, useState } from "react";
import styled from "styled-components";
import OperationContext from "../../contexts/operationContext";
import OperationType from "../../contexts/operationType";
import { itemStateValues } from "../../models/commonData";
import MaxLength from "../../models/maxLength";
import MudLog from "../../models/mudLog";
import ObjectOnWellbore, { toObjectReference } from "../../models/objectOnWellbore";
Expand All @@ -18,6 +19,7 @@ export interface MudLogPropertiesModalProps {
interface EditableMudLog extends ObjectOnWellbore {
mudLogCompany?: string;
mudLogEngineers?: string;
itemState?: string;
}

const MudLogPropertiesModal = (props: MudLogPropertiesModalProps): React.ReactElement => {
Expand All @@ -32,7 +34,7 @@ const MudLogPropertiesModal = (props: MudLogPropertiesModalProps): React.ReactEl
const onSubmit = async (updatedMudLog: EditableMudLog) => {
setIsLoading(true);
const modifyMudLogJob = {
mudLog: updatedMudLog
mudLog: { ...updatedMudLog, commonData: updatedMudLog.itemState ? { itemState: updatedMudLog.itemState } : null }
};
await JobService.orderJob(JobType.ModifyMudLog, modifyMudLogJob);
setIsLoading(false);
Expand Down Expand Up @@ -86,6 +88,16 @@ const MudLogPropertiesModal = (props: MudLogPropertiesModalProps): React.ReactEl
<TextField id="endMd" label="endMd" disabled defaultValue={mudLog?.endMd?.value} unit={mudLog?.endMd?.uom} />
<TextField disabled id="dTimCreation" label="commonData.dTimCreation" defaultValue={formatDateString(mudLog?.commonData?.dTimCreation, timeZone)} />
<TextField disabled id="dTimLastChange" label="commonData.dTimLastChange" defaultValue={formatDateString(mudLog?.commonData?.dTimCreation, timeZone)} />
<Autocomplete
id="itemState"
label="commonData.itemState"
options={itemStateValues}
initialSelectedOptions={[mudLog?.commonData?.itemState]}
hideClearButton
onOptionsChange={({ selectedItems }) => {
setEditableMudLog({ ...editableMudLog, itemState: selectedItems[0] });
}}
/>
</Layout>
}
confirmDisabled={invalidName || invalidMudLogCompany || invalidMudLogEngineers}
Expand Down
2 changes: 2 additions & 0 deletions Src/WitsmlExplorer.Frontend/models/commonData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ export function emptyCommonData(): CommonData {
serviceCategory: ""
};
}

export const itemStateValues = ["actual", "model", "plan", "unknown"];

0 comments on commit 4f6966f

Please sign in to comment.