Skip to content

Commit 70e04a1

Browse files
Rename to MdelingStatusIndicator and move to a separate file
1 parent de7d65f commit 70e04a1

2 files changed

Lines changed: 25 additions & 21 deletions

File tree

extensions/ql-vscode/src/view/data-extensions-editor/MethodRow.tsx

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ import { extensiblePredicateDefinitions } from "../../data-extensions-editor/pre
1919
import { Mode } from "../../data-extensions-editor/shared/mode";
2020
import { Dropdown } from "../common/Dropdown";
2121
import { MethodClassifications } from "./MethodClassifications";
22-
import { Codicon } from "../common/icon";
23-
import { assertNever } from "../../common/helpers-pure";
22+
import { ModelingStatusIndicator } from "./ModelingStatusIndicator";
2423

2524
const ApiOrMethodCell = styled(VSCodeDataGridCell)`
2625
display: flex;
@@ -215,7 +214,7 @@ function ModelableMethodRow(props: Props) {
215214
return (
216215
<VSCodeDataGridRow>
217216
<ApiOrMethodCell gridColumn={1}>
218-
<ModificationIndicator state={modificationState} />
217+
<ModelingStatusIndicator status={modificationState} />
219218
<ExternalApiUsageName {...props} />
220219
{mode === Mode.Application && (
221220
<UsagesButton onClick={jumpToUsage}>
@@ -271,7 +270,7 @@ function UnmodelableMethodRow(props: Props) {
271270
return (
272271
<VSCodeDataGridRow>
273272
<ApiOrMethodCell gridColumn={1}>
274-
<ModificationIndicator state="saved" />
273+
<ModelingStatusIndicator status="saved" />
275274
<ExternalApiUsageName {...props} />
276275
{mode === Mode.Application && (
277276
<UsagesButton onClick={jumpToUsage}>
@@ -307,20 +306,3 @@ function sendJumpToUsageMessage(externalApiUsage: ExternalApiUsage) {
307306
location: externalApiUsage.usages[0].url,
308307
});
309308
}
310-
311-
function ModificationIndicator({
312-
state,
313-
}: {
314-
state: "unmodeled" | "unsaved" | "saved";
315-
}) {
316-
switch (state) {
317-
case "unmodeled":
318-
return <Codicon name="circle-large-outline" label="Method not modeled" />;
319-
case "unsaved":
320-
return <Codicon name="pass" label="Changes have not been saved" />;
321-
case "saved":
322-
return <Codicon name="pass-filled" label="Method modeled" />;
323-
default:
324-
assertNever(state);
325-
}
326-
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import * as React from "react";
2+
import { assertNever } from "../../common/helpers-pure";
3+
import { Codicon } from "../common/icon/Codicon";
4+
5+
export type ModelingStatus = "unmodeled" | "unsaved" | "saved";
6+
7+
interface Props {
8+
status: ModelingStatus;
9+
}
10+
11+
export function ModelingStatusIndicator({ status }: Props) {
12+
switch (status) {
13+
case "unmodeled":
14+
return <Codicon name="circle-large-outline" label="Method not modeled" />;
15+
case "unsaved":
16+
return <Codicon name="pass" label="Changes have not been saved" />;
17+
case "saved":
18+
return <Codicon name="pass-filled" label="Method modeled" />;
19+
default:
20+
assertNever(status);
21+
}
22+
}

0 commit comments

Comments
 (0)