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

Steps Editor Save Update #74

Closed
rsamanez opened this issue Oct 5, 2023 · 1 comment
Closed

Steps Editor Save Update #74

rsamanez opened this issue Oct 5, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@rsamanez
Copy link
Collaborator

rsamanez commented Oct 5, 2023

Only save the last change

Description

If you add a new steps level in many stages, the tool only saves the change made in the last stage

Steps to Reproduce

the issue was reported in the next video

Solution

It requiere an update in the file: nerdlets/pathpoint-nerdlet/components/Modal/StepsEditor.js

add the lines with the red arrow in the image
image

and add the next function
image

CODE:

HandleOnChange = (target, value, id) => {
    this.setState(
      state => {
        const form = { ...state.form };
        form[`step_${id}`][target] = value;
        const stages = this.UpdateSubSteps(value, id);
        return {
          form,
          stages
        };
      },
      () => {
        if (target === 'substeps') {
          this.ChangeSubsteps(id, value);
        }
      }
    );
    if (target === 'level') {
      this.ChangeOrder(id, value);
    }
  };

  UpdateSubSteps(value, id) {
    const current = { ...this.state.current };
    const stages = [...this.state.stages];
    const stage = stages.find(item => item.id === current.stage);
    const currentStep = stage.steps.find(item => item.id === id);
    const array = value.split(',');
    const sub_steps = [];
    array.forEach(item => {
      sub_steps.push({ value: item });
    });
    currentStep.sub_steps = [...sub_steps];
    return stages;
  }

Relevant Logs / Console output

Your Environment

  • NR1 CLI version used:
  • Browser name and version:
  • Operating System and version:

Additional context

@rsamanez rsamanez added the bug Something isn't working label Oct 5, 2023
JimHagan pushed a commit that referenced this issue Nov 21, 2023
* Fixing issue 74 according to the published solution

* Fixing Variable default type to solve issues running Unit Test
@rsamanez rsamanez added this to the NEW_TOUCHPOINTS_1_7_9 milestone Mar 20, 2024
@rsamanez
Copy link
Collaborator Author

This issue was fixed on the BUG # 82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant