Skip to content

Commit 5bde4ec

Browse files
GauthierPLMalanzanattadev
authored andcommitted
Move stager (#329)
* Delete empty file * Remove stager from config panel * Move stager as runTask parameter and set default to "local" * Fix Style * Improve types
1 parent 63d91c0 commit 5bde4ec

File tree

14 files changed

+21
-215
lines changed

14 files changed

+21
-215
lines changed

lib/ExecutionControlEpic/ControlPanelFeature/Presenters/ControlPanel.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import React from "react";
55
import styled from "styled-components";
66
import Section from "./Section";
77
import { List } from "immutable";
8-
import type { PackagePanel } from "../Types/types";
8+
import type { PackagePanel, PlanPanel, ToolPanel } from "../Types/types";
99
import PinButton from "./PinButton";
1010
import RunningStateIndicator from "./RunningStateIndicator";
1111
import SplitButton from "./SplitButton";
@@ -108,21 +108,21 @@ export default function ControlPanel({
108108
}) {
109109
return (
110110
<ControlPanelBox className="tool-panel-background-color">
111-
{packagePanels.map(packagePanel => (
111+
{packagePanels.map((packagePanel: PackagePanel) => (
112112
<Section
113113
key={packagePanel.package.path}
114114
title={packagePanel.package.name}
115115
foldable
116116
>
117-
{packagePanel.tools.toArray().map(toolPanel => (
117+
{packagePanel.tools.toArray().map((toolPanel: ToolPanel) => (
118118
<Section
119119
key={toolPanel.tool.name}
120120
title={toolPanel.tool.name}
121121
icon={() => <ToolIcon src={toolPanel.tool.iconUri} />}
122122
controls={() => <ToolControls />}
123123
color={toolPanel.tool.dominantColor}
124124
>
125-
{toolPanel.plans.toArray().map(planPanel => (
125+
{toolPanel.plans.toArray().map((planPanel: PlanPanel) => (
126126
<Section
127127
key={planPanel.plan.id}
128128
title={planPanel.plan.name}

lib/ExecutionControlEpic/LanguageServerProtocolFeature/Epics/Tasks.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// @flow
33

44
import Rx from "rxjs";
5-
import { List, Map } from "immutable";
5+
import { Map } from "immutable";
66
import { addTask } from "../../TaskExecutionFeature/Actions/AddTask";
77
import { startTask } from "../../TaskExecutionFeature/Actions/StartTask";
8-
import { setDiagnosticsForTask } from "../../DiagnosticsFeature/Actions/SetDiagnosticsForTask";
98
import type { SetDiagnosticsForTaskAction } from "../../DiagnosticsFeature/Actions/SetDiagnosticsForTask";
9+
import { setDiagnosticsForTask } from "../../DiagnosticsFeature/Actions/SetDiagnosticsForTask";
1010
import { runLanguageClient } from "../Model/MoleculeLanguageClient";
1111
import Execution from "../Model/Execution";
1212
import type { Diagnostic } from "../../LanguageServerProtocolFeature/Types/standard";
@@ -20,6 +20,10 @@ import { EditorFileObservable } from "../../../EventSystemEpic/EditorFeature/Mod
2020
import type { MoleculeAtomEditorEvent } from "../../../EventSystemEpic/EditorFeature/Types/editorEvents";
2121
import { setDiagnosticsForPathsForTasks } from "../../DiagnosticsFeature/Actions/SetDiagnosticsForPathsForTasks";
2222
import { killTask } from "../../TaskExecutionFeature/Actions/KillTask";
23+
import type {
24+
RUN_TASK,
25+
RunTaskAction,
26+
} from "../../TaskExecutionFeature/Actions/RunTask";
2327

2428
type ExecutionContext = {
2529
atom: AtomContext,
@@ -28,15 +32,6 @@ type ExecutionContext = {
2832
extended: ExtendedContext,
2933
};
3034

31-
export const RUN_TASK = "RUN_TASK";
32-
33-
export type RunAction = (dispatch: (action: mixed) => void) => void;
34-
35-
export type RunTaskAction = {
36-
type: typeof RUN_TASK,
37-
payload: { plan: PlanConfig },
38-
};
39-
4035
function convertSetDiagnosticsForPathToSetDiagnosticsForTasks(
4136
actions: Array<SetDiagnosticsForTaskAction>,
4237
) {
@@ -63,12 +58,12 @@ function convertSetDiagnosticsForPathToSetDiagnosticsForTasks(
6358

6459
export default (context: ExecutionContext) => (action$, store) => {
6560
const rootObs = action$
66-
.ofType(RUN_TASK)
61+
.ofType("RUN_TASK")
6762
.mergeMap((action: RunTaskAction) => {
6863
return Rx.Observable.create(observer => {
6964
const languageClientConfig = runLanguageClient({
7065
plan: action.payload.plan,
71-
stagerConfig: action.payload.plan.stager,
66+
stagerConfig: action.payload.stager,
7267
});
7368

7469
let execution = null;

lib/ExecutionControlEpic/LanguageServerProtocolFeature/ManualTests/execJest.js

Whitespace-only changes.

lib/ExecutionControlEpic/LanguageServerProtocolFeature/Types/stagers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
// @flow
33

44
export type StagerConfig = {
5-
type: "local",
5+
type: "local" | "integrated" | "remote",
66
};

lib/ExecutionControlEpic/PlanConfigurationFeature/Actions/AddPlanConfig.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use babel";
22
// @flow
33

4-
import type { DevToolInfo, Stager } from "../Types/types";
4+
import type { DevToolInfo } from "../Types/types";
55
import type { PackageInfo } from "../../../ProjectSystemEpic/PackageFeature/Types/types";
66

77
export type AddPlanConfigAction = {
@@ -11,7 +11,6 @@ export type AddPlanConfigAction = {
1111
name: string,
1212
tool: DevToolInfo,
1313
config: mixed,
14-
stager: Stager,
1514
packageInfo: PackageInfo,
1615
},
1716
};
@@ -21,7 +20,6 @@ export function addPlanConfig(
2120
name: string,
2221
toolInfo: DevToolInfo,
2322
config: mixed,
24-
stager: Stager,
2523
packageInfo: PackageInfo,
2624
): AddPlanConfigAction {
2725
return {
@@ -31,7 +29,6 @@ export function addPlanConfig(
3129
name,
3230
tool: toolInfo,
3331
config,
34-
stager,
3532
packageInfo,
3633
},
3734
};

lib/ExecutionControlEpic/PlanConfigurationFeature/Containers/DevToolPlans.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function mapDispatchToProps(
5757
if (plan.state == "running") {
5858
dispatch(killTask(plan));
5959
} else {
60-
dispatch(runTask(plan));
60+
dispatch(runTask(plan, { type: "local" }));
6161
}
6262
},
6363
};

lib/ExecutionControlEpic/PlanConfigurationFeature/Containers/PinnedPlans.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function mapDispatchToProps(
5353
if (plan.state == "running") {
5454
dispatch(killTask(plan));
5555
} else {
56-
dispatch(runTask(plan));
56+
dispatch(runTask(plan, { type: "local" }));
5757
}
5858
},
5959
};

lib/ExecutionControlEpic/PlanConfigurationFeature/Containers/PlanConfigurer.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,14 @@ export function mapDispatchToProps(
6262
onAddPlan: (plan: {
6363
name: string,
6464
config: mixed,
65-
stager: Stager,
65+
stager: StagerConfig,
6666
packageInfo: PackageInfo,
6767
}) => void,
6868
} {
6969
return {
7070
onAddPlan: (plan: {
7171
name: string,
7272
config: mixed,
73-
stager: Stager,
7473
packageInfo: PackageInfo,
7574
}) => {
7675
dispatch(
@@ -85,7 +84,6 @@ export function mapDispatchToProps(
8584
uri: ownProps.toolUri,
8685
},
8786
plan.config,
88-
plan.stager,
8987
plan.packageInfo,
9088
),
9189
);

lib/ExecutionControlEpic/PlanConfigurationFeature/Presenters/PlanConfigurer.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as React from "react";
55
import PlanConfigPart from "./PlanConfigPart";
66
import AddButton from "./AddButton";
77
import type { ConfigSchemaPart } from "../Types/types";
8-
import StagerConfig from "./StagerConfig";
98
import PlanConfigTextInputField from "./PlanConfigTextInputField";
109
import PackageConfig from "./PackageConfig";
1110
import type { Package } from "../../../ProjectSystemEpic/PackageFeature/Types/types";
@@ -62,21 +61,6 @@ export default function PlanConfigurer(
6261
marker.
6362
</Explanation>
6463
<PackageConfig elementName="packageInfo" packages={packages} />
65-
<SectionTitle>Stager</SectionTitle>
66-
<Explanation>
67-
A stager is a way for controlling how your plan will be executed by
68-
Molecule.
69-
<br />j RECOMMENDED: By default, integrated, means it will be executed
70-
in Atom.
71-
<br />
72-
EXPERIMENTAL: The local one adds an intermediary process to bufferise
73-
the output, can be a performant gain in some cases, but we don t
74-
recommand using it for now.
75-
<br />
76-
HIGHLY EXPERIMENTAL: The remote stager is for executing your plan on a
77-
remote machine.
78-
</Explanation>
79-
<StagerConfig elementName="stager" value="integrated" />
8064
<ButtonPositioner>
8165
<AddButton onClick={submit} success>
8266
Create

lib/ExecutionControlEpic/PlanConfigurationFeature/Presenters/StagerConfig.js

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)