Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NU-1806] Add action parameters #6860

Open
wants to merge 14 commits into
base: staging
Choose a base branch
from
Open

Conversation

gskrobisz
Copy link
Member

@gskrobisz gskrobisz commented Sep 13, 2024

Describe your changes

obraz

  1. Source defines parameters that are required by action (here action deploy). When scenario has multiple sources each source defines those parameters separately.
  2. FE fetches those parameters and displays "advanced parameters" form in deploy action window (see screenshot above).
  3. Values are provided as simple kv map to deploy endpoint. So far deploy required plain text comment as body, now it requires json with comment and nodes deployment data (optional).
  4. Nodes deployment data are passed further into deployment command, and can be used to initialize flink source function.

Checklist before merge

  • Related issue ID is placed at the beginning of PR title in [brackets] (can be GH issue or Nu Jira issue)
  • Code is cleaned from temporary changes and commented out lines
  • Parts of the code that are not easy to understand are documented in the code
  • Changes are covered by automated tests
  • Showcase in dev-application.conf added to demonstrate the feature
  • Documentation added or updated
  • Added entry in Changelog.md describing the change from the perspective of a public distribution user
  • Added MigrationGuide.md entry in the appropriate subcategory if introducing a breaking change
  • Verify that PR will be squashed during merge

Copy link
Contributor

github-actions bot commented Sep 13, 2024

created: #7461
⚠️ Be careful! Snapshot changes are not necessarily the cause of the error. Check the logs.

@gskrobisz gskrobisz force-pushed the activity_capabilities branch 3 times, most recently from be0fe74 to e0b7858 Compare September 25, 2024 22:37
@github-actions github-actions bot added client client main fe ui labels Sep 25, 2024
@gskrobisz gskrobisz force-pushed the activity_capabilities branch from 8dd895f to 68932ac Compare October 1, 2024 12:36
@gskrobisz gskrobisz force-pushed the activity_capabilities branch 2 times, most recently from 214c008 to 6eb498d Compare December 17, 2024 22:56
import pl.touk.nussknacker.ui.uiresolving.UIProcessResolver

// TODO: move to ActivityService? execute node compilation only once with ScenarioTestService?
class ActivityInfoService(activityInfoProvider: ActivityInfoProvider, processResolver: UIProcessResolver) {
Copy link
Contributor

@mgoworko mgoworko Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment about naming convention: I think that in this context the name "Scenario action" should be used. Deploy/cancel and others are scenario actions, not activities from what I know. It can be especially confusing now, when ScenarioActivities exist in different context.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed: activity -> action

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"activity" is still used in some contexts, such as nodeToActivityToParameters, FE const activityParameters, const activityNodeParameters and possibly some more usages.

@gskrobisz gskrobisz force-pushed the activity_capabilities branch from 6eb498d to 62b2354 Compare December 20, 2024 18:28
@gskrobisz gskrobisz changed the title [NU-1806] Add activity parameters [NU-1806] Add action parameters Jan 7, 2025
@gskrobisz gskrobisz force-pushed the activity_capabilities branch from 2413cc2 to f763629 Compare January 9, 2025 16:55
@gskrobisz gskrobisz marked this pull request as ready for review January 14, 2025 13:06
@gskrobisz gskrobisz force-pushed the activity_capabilities branch from bfe6011 to f0db0a0 Compare January 15, 2025 10:30
@github-actions github-actions bot added the docs label Jan 15, 2025
@gskrobisz gskrobisz force-pushed the activity_capabilities branch from 8872b48 to 43a81b6 Compare January 15, 2025 18:23
@gskrobisz gskrobisz force-pushed the activity_capabilities branch from cf58d86 to cf9611b Compare January 20, 2025 14:25
@Dzuming Dzuming self-requested a review January 21, 2025 10:55
Copy link
Contributor

@Dzuming Dzuming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments

@@ -46,6 +51,7 @@ export const FixedValuesEditor: ExtendedEditor<Props> = (props: Props) => {
};

const { expressionObj, readOnly, onValueChange, className, showValidation, editorConfig, fieldErrors } = props;
const mode = FixedValuesEditorMode[editorConfig.mode || "LIST"];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for introducing editor mode concept instead of adding a new editor

@@ -23,6 +25,9 @@ export default function DeployButton(props: ToolbarButtonProps) {
const capabilities = useSelector(getCapabilities);
const { disabled, type } = props;

// TODO: find better place to reload activity capabilities and properties
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this todo, will you resolve it in this pr?

Advanced parameters
</Typography>
) : null}
{activityNodeParameters.map((anp: ActionNodeParameters) => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This acronym was a little confusing to me. I needed to go back to activityNodeParameters to understand what was going on. WDYT about renaming it to activityNodeParameter?

textDecoration: "none",
})}
>
Advanced parameters
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing i18n

import { default as EditableEditor } from "../graph/node-modal/editors/EditableEditor";

interface Props {
nodeName: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be nodeName or nodeId?

} catch (error) {
setValidationError(error?.response?.data);
}
}, [action, comment, dispatch, processName, props]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing values dependency here

import { getProcessName, getScenarioGraph } from "../../../reducers/selectors/graph";
import { useEffect } from "react";
import { fetchActionParameters } from "../../../actions/nk";
export function useActionCapabilities() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add blank line before import?

@@ -39,7 +44,7 @@ export default function DeployButton(props: ToolbarButtonProps) {
const { open } = useWindows();

const message = t("panels.actions.deploy.dialog", "Deploy scenario {{name}}", { name: processName });
const action = (p, c) => HttpService.deploy(p, c).finally(() => dispatch(loadProcessState(processName, processVersionId)));
const action = (p, c, d) => HttpService.deploy(p, c, d).finally(() => dispatch(loadProcessState(processName, processVersionId)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we find a better name for these (p, c, d) parameters?

@@ -34,7 +34,7 @@ export default function RunOffScheduleButton(props: ToolbarButtonProps) {
const available = !disabled && isPossible && capabilities.deploy;

const { open } = useWindows();
const action = (p, c) => HttpService.runOffSchedule(p, c).finally(() => dispatch(loadProcessState(processName, processVersionId)));
const action = (p, c, d) => HttpService.runOffSchedule(p, c).finally(() => dispatch(loadProcessState(processName, processVersionId)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we find a better name for these (p, c, d) parameters?

): Promise<{
isSuccess: boolean;
}> {
const runDeploymentRequest = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just simplify it to

const runDeploymentRequest = { nodesDeploymentData, comment };
?

Undefined values will be removed automatically from a JSON.

Alternatively, if we want to do it explicitly, maybe can we use lodash?

const runDeploymentRequest = _.pickBy({comment, nodesDeploymentData});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client main fe docs ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants