Fix clusters active/inactive toggling

This commit is contained in:
Kamil Trzcinski 2017-12-01 12:56:31 +01:00
parent 5f296daa27
commit 4709e1dc01
1 changed files with 3 additions and 2 deletions

View File

@ -28,7 +28,7 @@ const toggleValue = (button) => {
*
* When the user clicks the toggle button for each cluster, it:
* - toggles the button
* - shows a loding and disabled state
* - shows a loading and disabled state
* - Makes a put request to the given endpoint
* Once we receive the response, either:
* 1) Show updated status in case of successfull response
@ -38,12 +38,13 @@ export default function setClusterTableToggles() {
document.querySelectorAll('.js-toggle-cluster-list')
.forEach(button => button.addEventListener('click', (e) => {
const toggleButton = e.currentTarget;
const value = toggleButton.classList.contains('checked').toString();
const endpoint = toggleButton.getAttribute('data-endpoint');
toggleValue(toggleButton);
toggleLoadingButton(toggleButton);
const value = toggleButton.classList.contains('is-checked');
ClustersService.updateCluster(endpoint, { cluster: { enabled: value } })
.then(() => {
toggleLoadingButton(toggleButton);