Skip to content

Commit

Permalink
Move stager (#329)
Browse files Browse the repository at this point in the history
* Delete empty file

* Remove stager from config panel

* Move stager as runTask parameter and set default to "local"

* Fix Style

* Improve types
  • Loading branch information
GauthierPLM authored and alanzanattadev committed Apr 10, 2018
1 parent 63d91c0 commit 5bde4ec
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 215 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from "react";
import styled from "styled-components";
import Section from "./Section";
import { List } from "immutable";
import type { PackagePanel } from "../Types/types";
import type { PackagePanel, PlanPanel, ToolPanel } from "../Types/types";
import PinButton from "./PinButton";
import RunningStateIndicator from "./RunningStateIndicator";
import SplitButton from "./SplitButton";
Expand Down Expand Up @@ -108,21 +108,21 @@ export default function ControlPanel({
}) {
return (
<ControlPanelBox className="tool-panel-background-color">
{packagePanels.map(packagePanel => (
{packagePanels.map((packagePanel: PackagePanel) => (
<Section
key={packagePanel.package.path}
title={packagePanel.package.name}
foldable
>
{packagePanel.tools.toArray().map(toolPanel => (
{packagePanel.tools.toArray().map((toolPanel: ToolPanel) => (
<Section
key={toolPanel.tool.name}
title={toolPanel.tool.name}
icon={() => <ToolIcon src={toolPanel.tool.iconUri} />}
controls={() => <ToolControls />}
color={toolPanel.tool.dominantColor}
>
{toolPanel.plans.toArray().map(planPanel => (
{toolPanel.plans.toArray().map((planPanel: PlanPanel) => (
<Section
key={planPanel.plan.id}
title={planPanel.plan.name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// @flow

import Rx from "rxjs";
import { List, Map } from "immutable";
import { Map } from "immutable";
import { addTask } from "../../TaskExecutionFeature/Actions/AddTask";
import { startTask } from "../../TaskExecutionFeature/Actions/StartTask";
import { setDiagnosticsForTask } from "../../DiagnosticsFeature/Actions/SetDiagnosticsForTask";
import type { SetDiagnosticsForTaskAction } from "../../DiagnosticsFeature/Actions/SetDiagnosticsForTask";
import { setDiagnosticsForTask } from "../../DiagnosticsFeature/Actions/SetDiagnosticsForTask";
import { runLanguageClient } from "../Model/MoleculeLanguageClient";
import Execution from "../Model/Execution";
import type { Diagnostic } from "../../LanguageServerProtocolFeature/Types/standard";
Expand All @@ -20,6 +20,10 @@ import { EditorFileObservable } from "../../../EventSystemEpic/EditorFeature/Mod
import type { MoleculeAtomEditorEvent } from "../../../EventSystemEpic/EditorFeature/Types/editorEvents";
import { setDiagnosticsForPathsForTasks } from "../../DiagnosticsFeature/Actions/SetDiagnosticsForPathsForTasks";
import { killTask } from "../../TaskExecutionFeature/Actions/KillTask";
import type {
RUN_TASK,
RunTaskAction,
} from "../../TaskExecutionFeature/Actions/RunTask";

type ExecutionContext = {
atom: AtomContext,
Expand All @@ -28,15 +32,6 @@ type ExecutionContext = {
extended: ExtendedContext,
};

export const RUN_TASK = "RUN_TASK";

export type RunAction = (dispatch: (action: mixed) => void) => void;

export type RunTaskAction = {
type: typeof RUN_TASK,
payload: { plan: PlanConfig },
};

function convertSetDiagnosticsForPathToSetDiagnosticsForTasks(
actions: Array<SetDiagnosticsForTaskAction>,
) {
Expand All @@ -63,12 +58,12 @@ function convertSetDiagnosticsForPathToSetDiagnosticsForTasks(

export default (context: ExecutionContext) => (action$, store) => {
const rootObs = action$
.ofType(RUN_TASK)
.ofType("RUN_TASK")
.mergeMap((action: RunTaskAction) => {
return Rx.Observable.create(observer => {
const languageClientConfig = runLanguageClient({
plan: action.payload.plan,
stagerConfig: action.payload.plan.stager,
stagerConfig: action.payload.stager,
});

let execution = null;
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
// @flow

export type StagerConfig = {
type: "local",
type: "local" | "integrated" | "remote",
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use babel";
// @flow

import type { DevToolInfo, Stager } from "../Types/types";
import type { DevToolInfo } from "../Types/types";
import type { PackageInfo } from "../../../ProjectSystemEpic/PackageFeature/Types/types";

export type AddPlanConfigAction = {
Expand All @@ -11,7 +11,6 @@ export type AddPlanConfigAction = {
name: string,
tool: DevToolInfo,
config: mixed,
stager: Stager,
packageInfo: PackageInfo,
},
};
Expand All @@ -21,7 +20,6 @@ export function addPlanConfig(
name: string,
toolInfo: DevToolInfo,
config: mixed,
stager: Stager,
packageInfo: PackageInfo,
): AddPlanConfigAction {
return {
Expand All @@ -31,7 +29,6 @@ export function addPlanConfig(
name,
tool: toolInfo,
config,
stager,
packageInfo,
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function mapDispatchToProps(
if (plan.state == "running") {
dispatch(killTask(plan));
} else {
dispatch(runTask(plan));
dispatch(runTask(plan, { type: "local" }));
}
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function mapDispatchToProps(
if (plan.state == "running") {
dispatch(killTask(plan));
} else {
dispatch(runTask(plan));
dispatch(runTask(plan, { type: "local" }));
}
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,14 @@ export function mapDispatchToProps(
onAddPlan: (plan: {
name: string,
config: mixed,
stager: Stager,
stager: StagerConfig,
packageInfo: PackageInfo,
}) => void,
} {
return {
onAddPlan: (plan: {
name: string,
config: mixed,
stager: Stager,
packageInfo: PackageInfo,
}) => {
dispatch(
Expand All @@ -85,7 +84,6 @@ export function mapDispatchToProps(
uri: ownProps.toolUri,
},
plan.config,
plan.stager,
plan.packageInfo,
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as React from "react";
import PlanConfigPart from "./PlanConfigPart";
import AddButton from "./AddButton";
import type { ConfigSchemaPart } from "../Types/types";
import StagerConfig from "./StagerConfig";
import PlanConfigTextInputField from "./PlanConfigTextInputField";
import PackageConfig from "./PackageConfig";
import type { Package } from "../../../ProjectSystemEpic/PackageFeature/Types/types";
Expand Down Expand Up @@ -62,21 +61,6 @@ export default function PlanConfigurer(
marker.
</Explanation>
<PackageConfig elementName="packageInfo" packages={packages} />
<SectionTitle>Stager</SectionTitle>
<Explanation>
A stager is a way for controlling how your plan will be executed by
Molecule.
<br />j RECOMMENDED: By default, integrated, means it will be executed
in Atom.
<br />
EXPERIMENTAL: The local one adds an intermediary process to bufferise
the output, can be a performant gain in some cases, but we don t
recommand using it for now.
<br />
HIGHLY EXPERIMENTAL: The remote stager is for executing your plan on a
remote machine.
</Explanation>
<StagerConfig elementName="stager" value="integrated" />
<ButtonPositioner>
<AddButton onClick={submit} success>
Create
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ describe("PlanConfigs", () => {
uri: "file:///file",
},
"ls -l",
{ type: "integrated" },
{
name: "",
path: "/",
Expand All @@ -52,7 +51,6 @@ describe("PlanConfigs", () => {
uri: "file:///file",
},
config: "ls -l",
stager: { type: "integrated" },
packageInfo: {
name: "",
path: "/",
Expand All @@ -70,7 +68,6 @@ describe("PlanConfigs", () => {
uri: "file:///file",
},
config: "Invoke-Mimikatz",
stager: { type: "integrated" },
packageInfo: {
name: "",
path: "/",
Expand Down Expand Up @@ -102,7 +99,6 @@ describe("PlanConfigs", () => {
uri: "file:///file",
},
config: "ls -l",
stager: { type: "integrated" },
packageInfo: {
name: "",
path: "/",
Expand All @@ -120,7 +116,6 @@ describe("PlanConfigs", () => {
uri: "file:///file",
},
config: "Invoke-Mimikatz",
stager: { type: "integrated" },
packageInfo: {
name: "",
path: "/",
Expand Down Expand Up @@ -152,7 +147,6 @@ describe("PlanConfigs", () => {
uri: "file:///file",
},
config: "ls -l",
stager: { type: "integrated" },
packageInfo: {
name: "",
path: "/",
Expand All @@ -170,7 +164,6 @@ describe("PlanConfigs", () => {
uri: "file:///file",
},
config: "Invoke-Mimikatz",
stager: { type: "integrated" },
packageInfo: {
name: "",
path: "/",
Expand Down
Loading

0 comments on commit 5bde4ec

Please sign in to comment.