Skip to content

Commit

Permalink
Revert "[NU-1806] Add action parameters (#6860)"
Browse files Browse the repository at this point in the history
This reverts commit 69250dc
  • Loading branch information
mgoworko committed Feb 12, 2025
1 parent c9d90ef commit 6463096
Show file tree
Hide file tree
Showing 53 changed files with 131 additions and 1,398 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
package pl.touk.nussknacker.engine.api.component

import io.circe.generic.extras.semiauto.{deriveUnwrappedDecoder, deriveUnwrappedEncoder}
import io.circe.{Decoder, Encoder}
import pl.touk.nussknacker.engine.api.NodeId
import pl.touk.nussknacker.engine.api.component.NodesDeploymentData.NodeDeploymentData

final case class NodesDeploymentData(dataByNodeId: Map[NodeId, NodeDeploymentData])

object NodesDeploymentData {

// Raw deployment parameters (name -> value) that are used as additional node configuration during deployment.
// Each node can be provided with dedicated set of parameters.
// TODO: consider replacing NodeDeploymentData with Json
type NodeDeploymentData = Map[String, String]

val empty: NodesDeploymentData = NodesDeploymentData(Map.empty)

implicit val nodesDeploymentDataEncoder: Encoder[NodesDeploymentData] = Encoder
Expand All @@ -23,3 +18,19 @@ object NodesDeploymentData {
Decoder.decodeMap[NodeId, NodeDeploymentData].map(NodesDeploymentData(_))

}

sealed trait NodeDeploymentData

final case class SqlFilteringExpression(sqlExpression: String) extends NodeDeploymentData

object NodeDeploymentData {

implicit val nodeDeploymentDataEncoder: Encoder[NodeDeploymentData] =
deriveUnwrappedEncoder[SqlFilteringExpression].contramap { case sqlExpression: SqlFilteringExpression =>
sqlExpression
}

implicit val nodeDeploymentDataDecoder: Decoder[NodeDeploymentData] =
deriveUnwrappedDecoder[SqlFilteringExpression].map(identity)

}
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ case object CronParameterEditor extends SimpleParameterEditor
@JsonCodec case class FixedValuesWithIconParameterEditor(possibleValues: List[FixedExpressionValueWithIcon])
extends SimpleParameterEditor

@JsonCodec case class FixedValuesWithRadioParameterEditor(possibleValues: List[FixedExpressionValue])
extends SimpleParameterEditor

// TODO: currently only supports String/Boolean/Long dictionaries (same set of supported types as AdditionalDataValue)
@JsonCodec case class DictParameterEditor(
dictId: String // dictId must be present in ExpressionConfigDefinition.dictionaries
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export enum EditorType {
STRING_PARAMETER_EDITOR = "StringParameterEditor",
FIXED_VALUES_PARAMETER_EDITOR = "FixedValuesParameterEditor",
FIXED_VALUES_WITH_ICON_PARAMETER_EDITOR = "FixedValuesWithIconParameterEditor",
FIXED_VALUES_WITH_RADIO_PARAMETER_EDITOR = "FixedValuesWithRadioParameterEditor",
DATE = "DateParameterEditor",
TIME = "TimeParameterEditor",
DATE_TIME = "DateTimeParameterEditor",
Expand All @@ -88,7 +87,6 @@ export const editors: Record<EditorType, SimpleEditor | ExtendedEditor> = {
[EditorType.DURATION_EDITOR]: DurationEditor,
[EditorType.FIXED_VALUES_PARAMETER_EDITOR]: FixedValuesEditor,
[EditorType.FIXED_VALUES_WITH_ICON_PARAMETER_EDITOR]: FixedValuesEditor,
[EditorType.FIXED_VALUES_WITH_RADIO_PARAMETER_EDITOR]: FixedValuesEditor,
[EditorType.JSON_PARAMETER_EDITOR]: JsonEditor,
[EditorType.PERIOD_EDITOR]: PeriodEditor,
[EditorType.RAW_PARAMETER_EDITOR]: RawEditor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { ExpressionObj } from "./types";
import { isEmpty } from "lodash";
import { cx } from "@emotion/css";
import { selectStyled } from "../../../../../stylesheets/SelectStyled";
import { FormControlLabel, Radio, RadioGroup, Stack, styled, useTheme } from "@mui/material";
import { EditorType, ExtendedEditor } from "./Editor";
import { Stack, styled, Typography, useTheme } from "@mui/material";
import { ExtendedEditor } from "./Editor";
import { FieldError } from "../Validators";
import { FixedValuesOption } from "../../fragment-input-definition/item";
import { PreloadedIcon } from "../../../../toolbars/creator/ComponentIcon";
Expand Down Expand Up @@ -58,16 +58,7 @@ export const FixedValuesEditor: ExtendedEditor<Props> = (props: Props) => {

const { control, input, valueContainer, singleValue, menuPortal, menu, menuList, menuOption, indicatorSeparator, dropdownIndicator } =
selectStyled(theme);
return editorConfig.type === EditorType.FIXED_VALUES_WITH_RADIO_PARAMETER_EDITOR ? (
<div className={cx(className)}>
<RadioGroup value={currentOption.value} onChange={(event) => onValueChange(event.target.value)}>
{options.map((option: Option) => {
const label = option.value === props.param?.defaultValue ? `${option.label} (default)` : option.label;
return <FormControlLabel key={option.value} value={option.value} control={<Radio />} label={label} />;
})}
</RadioGroup>
</div>
) : (
return (
<div className={cx(className)}>
<Creatable
value={currentOption}
Expand Down
42 changes: 0 additions & 42 deletions designer/client/src/components/modals/ActionParameter.tsx

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,9 @@ import ProcessDialogWarnings from "./ProcessDialogWarnings";
import { FormHelperText, Typography } from "@mui/material";
import { LoadingButtonTypes } from "../../windowManager/LoadingButton";
import { ScenarioActionResult, ScenarioActionResultType } from "../toolbars/scenarioActions/buttons/types";
import { NodesDeploymentData } from "../../http/HttpService";

export type ToggleProcessActionModalData = {
action: (
processName: ProcessName,
processVersionId: ProcessVersionId,
comment: string,
nodeData?: NodesDeploymentData,
) => Promise<ScenarioActionResult>;
action: (processName: ProcessName, processVersionId: ProcessVersionId, comment: string) => Promise<ScenarioActionResult>;
displayWarnings?: boolean;
};

Expand Down
167 changes: 0 additions & 167 deletions designer/client/src/components/modals/DeployWithParametersDialog.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
import { useDispatch, useSelector } from "react-redux";
import { disableToolTipsHighlight, enableToolTipsHighlight, loadProcessState } from "../../../../actions/nk";
import Icon from "../../../../assets/img/toolbarButtons/deploy.svg";
import HttpService, { NodesDeploymentData } from "../../../../http/HttpService";
import HttpService from "../../../../http/HttpService";
import { getProcessName, hasError, isDeployPossible, isSaveDisabled } from "../../../../reducers/selectors/graph";
import { getCapabilities } from "../../../../reducers/selectors/other";
import { useWindows } from "../../../../windowManager";
Expand Down Expand Up @@ -38,8 +38,8 @@ export default function DeployButton(props: ToolbarButtonProps) {
const { open } = useWindows();

const message = t("panels.actions.deploy.dialog", "Deploy scenario {{name}}", { name: processName });
const action = (name: ProcessName, versionId: ProcessVersionId, comment: string, nodesDeploymentData?: NodesDeploymentData) =>
HttpService.deploy(name, comment, nodesDeploymentData).finally(() => dispatch(loadProcessState(name, versionId)));
const action = (name: ProcessName, versionId: ProcessVersionId, comment: string) =>
HttpService.deploy(name, comment).finally(() => dispatch(loadProcessState(name, versionId)));

return (
<ToolbarButton
Expand All @@ -50,7 +50,7 @@ export default function DeployButton(props: ToolbarButtonProps) {
onClick={() =>
open<ToggleProcessActionModalData>({
title: message,
kind: WindowKind.deployWithParameters,
kind: WindowKind.deployProcess,
width: ACTION_DIALOG_WIDTH,
meta: { action, displayWarnings: true },
})
Expand Down
Loading

0 comments on commit 6463096

Please sign in to comment.