Move modeling status code to its own module (#2866)
* Move ModelingStatus to its own file * Move getModelingStatus to modeling status module
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
import { ModeledMethod } from "../modeled-method";
|
||||||
|
|
||||||
|
export type ModelingStatus = "unmodeled" | "unsaved" | "saved";
|
||||||
|
|
||||||
|
export function getModelingStatus(
|
||||||
|
modeledMethod: ModeledMethod | undefined,
|
||||||
|
methodIsUnsaved: boolean,
|
||||||
|
): ModelingStatus {
|
||||||
|
if (modeledMethod) {
|
||||||
|
if (methodIsUnsaved) {
|
||||||
|
return "unsaved";
|
||||||
|
} else if (modeledMethod.type !== "none") {
|
||||||
|
return "saved";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "unmodeled";
|
||||||
|
}
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { styled } from "styled-components";
|
import { styled } from "styled-components";
|
||||||
import {
|
import { ModelingStatus } from "../../model-editor/shared/modeling-status";
|
||||||
ModelingStatus,
|
import { ModelingStatusIndicator } from "../model-editor/ModelingStatusIndicator";
|
||||||
ModelingStatusIndicator,
|
|
||||||
} from "../model-editor/ModelingStatusIndicator";
|
|
||||||
import { Method } from "../../model-editor/method";
|
import { Method } from "../../model-editor/method";
|
||||||
import { MethodName } from "../model-editor/MethodName";
|
import { MethodName } from "../model-editor/MethodName";
|
||||||
import { ModeledMethod } from "../../model-editor/modeled-method";
|
import { ModeledMethod } from "../../model-editor/modeled-method";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { MethodModeling } from "./MethodModeling";
|
import { MethodModeling } from "./MethodModeling";
|
||||||
import { ModelingStatus } from "../model-editor/ModelingStatusIndicator";
|
import { ModelingStatus } from "../../model-editor/shared/modeling-status";
|
||||||
import { Method } from "../../model-editor/method";
|
import { Method } from "../../model-editor/method";
|
||||||
import { ToMethodModelingMessage } from "../../common/interface-types";
|
import { ToMethodModelingMessage } from "../../common/interface-types";
|
||||||
import { assertNever } from "../../common/helpers-pure";
|
import { assertNever } from "../../common/helpers-pure";
|
||||||
|
|||||||
@@ -14,10 +14,8 @@ import { ModeledMethod } from "../../model-editor/modeled-method";
|
|||||||
import { ModelKindDropdown } from "./ModelKindDropdown";
|
import { ModelKindDropdown } from "./ModelKindDropdown";
|
||||||
import { Mode } from "../../model-editor/shared/mode";
|
import { Mode } from "../../model-editor/shared/mode";
|
||||||
import { MethodClassifications } from "./MethodClassifications";
|
import { MethodClassifications } from "./MethodClassifications";
|
||||||
import {
|
import { getModelingStatus } from "../../model-editor/shared/modeling-status";
|
||||||
ModelingStatus,
|
import { ModelingStatusIndicator } from "./ModelingStatusIndicator";
|
||||||
ModelingStatusIndicator,
|
|
||||||
} from "./ModelingStatusIndicator";
|
|
||||||
import { InProgressDropdown } from "./InProgressDropdown";
|
import { InProgressDropdown } from "./InProgressDropdown";
|
||||||
import { MethodName } from "./MethodName";
|
import { MethodName } from "./MethodName";
|
||||||
import { ModelTypeDropdown } from "./ModelTypeDropdown";
|
import { ModelTypeDropdown } from "./ModelTypeDropdown";
|
||||||
@@ -181,17 +179,3 @@ function sendJumpToUsageMessage(method: Method) {
|
|||||||
usage: method.usages[0],
|
usage: method.usages[0],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getModelingStatus(
|
|
||||||
modeledMethod: ModeledMethod | undefined,
|
|
||||||
methodIsUnsaved: boolean,
|
|
||||||
): ModelingStatus {
|
|
||||||
if (modeledMethod) {
|
|
||||||
if (methodIsUnsaved) {
|
|
||||||
return "unsaved";
|
|
||||||
} else if (modeledMethod.type !== "none") {
|
|
||||||
return "saved";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "unmodeled";
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { assertNever } from "../../common/helpers-pure";
|
import { assertNever } from "../../common/helpers-pure";
|
||||||
import { Codicon } from "../common/icon/Codicon";
|
import { Codicon } from "../common/icon/Codicon";
|
||||||
|
import { ModelingStatus } from "../../model-editor/shared/modeling-status";
|
||||||
export type ModelingStatus = "unmodeled" | "unsaved" | "saved";
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
status: ModelingStatus;
|
status: ModelingStatus;
|
||||||
|
|||||||
Reference in New Issue
Block a user