Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
4709e1dc
Commit
4709e1dc
authored
Dec 01, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix clusters active/inactive toggling
parent
5f296daa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
app/assets/javascripts/clusters/clusters_index.js
app/assets/javascripts/clusters/clusters_index.js
+3
-2
No files found.
app/assets/javascripts/clusters/clusters_index.js
View file @
4709e1dc
...
@@ -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 lo
a
ding 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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment