newrelic / nr1-pathpoint

Pathpoint is an enterprise platform tracker that models system health in relation to actual user-impacting business stages.
Apache License 2.0
8 stars 19 forks source link

Steps Editor Save Update #74

Closed rsamanez closed 5 months ago

rsamanez commented 11 months ago

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

Additional context

rsamanez commented 5 months ago

This issue was fixed on the BUG # 82