Commit bea43038 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix clusters active/inactive toggling

parent 363c5746
...@@ -28,7 +28,7 @@ const toggleValue = (button) => { ...@@ -28,7 +28,7 @@ const toggleValue = (button) => {
* *
* When the user clicks the toggle button for each cluster, it: * When the user clicks the toggle button for each cluster, it:
* - toggles the button * - toggles the button
* - shows a loding and disabled state * - shows a loading and disabled state
* - Makes a put request to the given endpoint * - Makes a put request to the given endpoint
* Once we receive the response, either: * Once we receive the response, either:
* 1) Show updated status in case of successfull response * 1) Show updated status in case of successfull response
...@@ -38,12 +38,13 @@ export default function setClusterTableToggles() { ...@@ -38,12 +38,13 @@ export default function setClusterTableToggles() {
document.querySelectorAll('.js-toggle-cluster-list') document.querySelectorAll('.js-toggle-cluster-list')
.forEach(button => button.addEventListener('click', (e) => { .forEach(button => button.addEventListener('click', (e) => {
const toggleButton = e.currentTarget; const toggleButton = e.currentTarget;
const value = toggleButton.classList.contains('checked').toString();
const endpoint = toggleButton.getAttribute('data-endpoint'); const endpoint = toggleButton.getAttribute('data-endpoint');
toggleValue(toggleButton); toggleValue(toggleButton);
toggleLoadingButton(toggleButton); toggleLoadingButton(toggleButton);
const value = toggleButton.classList.contains('is-checked');
ClustersService.updateCluster(endpoint, { cluster: { enabled: value } }) ClustersService.updateCluster(endpoint, { cluster: { enabled: value } })
.then(() => { .then(() => {
toggleLoadingButton(toggleButton); toggleLoadingButton(toggleButton);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment