Use a button and a post request instead of UJS links - part 1 - Environments
What does this MR do?
Part 1 of a set of MRs to remove UJS from Vue components:
1 - Uses a button and a post request instead of UJS links in Environments:
- Stop environment Button
- Manual Actions Dropdown
- Rollback/Retry Button
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 - Updates require statements to import ones.
3 - Improves HTML a11y by adding aria-hidden
and title
attributes to buttons with only icons
Screenshots
When the user clicks in a button in the environments table, instead of being redirect to another page, should see a loading spinner while the request is being made:
Does this MR meet the acceptance criteria?
-
Changelog entry added -
Documentation created/updated -
API support added - 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