-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/staging' into improve-run-now-st…
…ate-handling # Conflicts: # docs/Changelog.md
- Loading branch information
Showing
83 changed files
with
941 additions
and
427 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
components-api/src/main/scala/pl/touk/nussknacker/engine/api/TemplateEvaluationResult.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package pl.touk.nussknacker.engine.api | ||
|
||
case class TemplateEvaluationResult(renderedParts: List[TemplateRenderedPart]) { | ||
def renderedTemplate: String = renderedParts.map(_.value).mkString("") | ||
} | ||
|
||
sealed trait TemplateRenderedPart { | ||
def value: String | ||
} | ||
|
||
object TemplateRenderedPart { | ||
case class RenderedLiteral(value: String) extends TemplateRenderedPart | ||
|
||
case class RenderedSubExpression(value: String) extends TemplateRenderedPart | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { ProcessDefinitionData, PropertiesType, ScenarioGraph, ScenarioGraphWithName, ValidationResult } from "../../types"; | ||
import { alignFragmentWithSchema } from "../../components/graph/utils/fragmentSchemaAligner"; | ||
import { fetchProcessDefinition } from "./processDefinitionData"; | ||
import { Scenario } from "../../components/Process/types"; | ||
import HttpService from "../../http/HttpService"; | ||
import { ThunkAction } from "../reduxTypes"; | ||
|
||
type EditPropertiesAction = { | ||
type: "EDIT_PROPERTIES"; | ||
validationResult: ValidationResult; | ||
scenarioGraphAfterChange: ScenarioGraph; | ||
}; | ||
|
||
type RenameProcessAction = { | ||
type: "PROCESS_RENAME"; | ||
name: string; | ||
}; | ||
|
||
export type PropertiesActions = EditPropertiesAction | RenameProcessAction; | ||
|
||
// TODO: We synchronize fragment changes with a scenario in case of properties changes. We need to find a better way to hande it | ||
function alignFragmentsNodeWithSchema(scenarioGraph: ScenarioGraph, processDefinitionData: ProcessDefinitionData): ScenarioGraph { | ||
return { | ||
...scenarioGraph, | ||
nodes: scenarioGraph.nodes.map((node) => { | ||
return node.type === "FragmentInput" ? alignFragmentWithSchema(processDefinitionData, node) : node; | ||
}), | ||
}; | ||
} | ||
|
||
const calculateProperties = (scenario: Scenario, changedProperties: PropertiesType): ThunkAction<Promise<ScenarioGraphWithName>> => { | ||
return async (dispatch) => { | ||
const processDefinitionData = await dispatch(fetchProcessDefinition(scenario.processingType, scenario.isFragment)); | ||
const processWithNewFragmentSchema = alignFragmentsNodeWithSchema(scenario.scenarioGraph, processDefinitionData); | ||
|
||
if (scenario.name !== changedProperties.name) { | ||
dispatch({ type: "PROCESS_RENAME", name: changedProperties.name }); | ||
} | ||
|
||
return { | ||
processName: changedProperties.name, | ||
scenarioGraph: { ...processWithNewFragmentSchema, properties: changedProperties }, | ||
}; | ||
}; | ||
}; | ||
|
||
export function editProperties(scenario: Scenario, changedProperties: PropertiesType): ThunkAction { | ||
return async (dispatch) => { | ||
const { processName, scenarioGraph } = await dispatch(calculateProperties(scenario, changedProperties)); | ||
const response = await HttpService.validateProcess(scenario.name, processName, scenarioGraph); | ||
|
||
dispatch({ | ||
type: "EDIT_PROPERTIES", | ||
validationResult: response.data, | ||
scenarioGraphAfterChange: scenarioGraph, | ||
}); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.