Use a button and a post request instead of UJS links - part 2 - Pipelines
What does this MR do?
Part 2 of a set of MRs to remove UJS from Vue components:
1 - Uses a button and a post request instead of UJS links in Pipelines:
Architecture decisions:
Provide the service to each button component:
-
⬆ Allows managing the state of each component in it's own scope: show a loading while request is being made, hide it when it finishes; -
⬆ Allows reusing the same function; -
⬆ Use the same instance of the Service class instead of creating a new one for each rendered component - which can be a LOT; -
⬇ Need to provide the service as a prop.
Use event emitter to tell the parent component to refresh the table without refreshing the page:
-
⬆ Child component just needs to emit an event -
⬆ Child component doesn't need to be provided a function as a prop to update the parent table.
Decisions match Vue's documentation: Data goes down, events go up. https://vuejs.org/v2/guide/components.html#Composing-Components https://vuejs.org/v2/guide/components.html#One-Way-Data-Flow
2 - Architectural changes needed to accomplish point 1:
- Divides actions into small components to make it easier to manage each state and request.
- Renames folder to match the existing ones
- Creates a Service to fetch data to match existing ones and documented ones
- Creates a Store to store data to match existing ones and documented process.
- Merges Stores and Services of all pipelines table into one.
- Uses harmony syntax instead of cjs.
- Removes use of global namespace on the store related methods.
- Exports Vue components as objects
- Removes usage of global namespace in pipelines related code.
- Improves Coverage:
Before | After |
---|---|
Does this MR meet the acceptance criteria?
- Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
What are the relevant issue numbers?
Closes #20450 (closed) Closes #28535 (closed) Closes #5580 (closed)