Use objectToQuery to generate in pipelines updateInternalState() method

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Description

Use objectToQuery from url_utility to replace the following code.

// app/assets/javascripts/pipelines/mixins/pipelines_mixin.js
      const queryString = Object.keys(parameters)
        .map((parameter) => {
          const value = parameters[parameter];
          // update internal state for UI
          this[parameter] = value;
          return `${parameter}=${encodeURIComponent(value)}`;
        })
        .join('&');

Note: ⚠️ During this change we have to ensure these two lines can be safely removed:

// update internal state for UI
this[parameter] = value;

Original Discussion

The following discussion from !53834 (merged) should be addressed:

  • @svedova started a discussion: (+1 comment)

    suggestion The url_utility class contains a helper function for this: objectToQuery. Perhaps we can make use of it? And for updating the state part we can simply:

    const queryString = objectToQuery(parameters);
    Object.assign(this, parameters);

    WDYT?

Edited by 🤖 GitLab Bot 🤖