-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7174 from TouK/template-lazy-param-flink-creator
Template parts handling approach change: expression level instead of LazyParameter level
- Loading branch information
Showing
136 changed files
with
1,875 additions
and
893 deletions.
There are no files selected for viewing
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
11 changes: 11 additions & 0 deletions
11
common-api/src/main/scala/pl/touk/nussknacker/engine/api/parameter/ParameterName.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 |
---|---|---|
@@ -1,5 +1,16 @@ | ||
package pl.touk.nussknacker.engine.api.parameter | ||
|
||
import io.circe.generic.extras.semiauto.{deriveUnwrappedDecoder, deriveUnwrappedEncoder} | ||
import io.circe.{Decoder, Encoder, KeyDecoder, KeyEncoder} | ||
|
||
final case class ParameterName(value: String) { | ||
def withBranchId(branchId: String): ParameterName = ParameterName(s"$value for branch $branchId") | ||
} | ||
|
||
object ParameterName { | ||
implicit val encoder: Encoder[ParameterName] = deriveUnwrappedEncoder | ||
implicit val decoder: Decoder[ParameterName] = deriveUnwrappedDecoder | ||
|
||
implicit val keyEncoder: KeyEncoder[ParameterName] = KeyEncoder.encodeKeyString.contramap(_.value) | ||
implicit val keyDecoder: KeyDecoder[ParameterName] = KeyDecoder.decodeKeyString.map(ParameterName(_)) | ||
} |
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
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
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
Oops, something went wrong.