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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
093a7745
Commit
093a7745
authored
Oct 13, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix conflicts for app/assets/javascripts/members.js
parent
066eed4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
120 deletions
+69
-120
app/assets/javascripts/members.js
app/assets/javascripts/members.js
+69
-120
No files found.
app/assets/javascripts/members.js
View file @
093a7745
<<<<<<<
HEAD
/* eslint-disable class-methods-use-this, promise/catch-or-return */
/* eslint-disable no-new */
import
Flash
from
'
./flash
'
;
(()
=>
{
window
.
gl
=
window
.
gl
||
{};
class
Members
{
constructor
()
{
this
.
addListeners
();
this
.
initGLDropdown
();
}
addListeners
()
{
$
(
'
.js-ldap-permissions
'
).
off
(
'
click
'
).
on
(
'
click
'
,
this
.
showLDAPPermissionsWarning
.
bind
(
this
));
$
(
'
.js-ldap-override
'
).
off
(
'
click
'
).
on
(
'
click
'
,
this
.
toggleMemberAccessToggle
.
bind
(
this
));
$
(
'
.project_member, .group_member
'
).
off
(
'
ajax:success
'
).
on
(
'
ajax:success
'
,
this
.
removeRow
);
$
(
'
.js-member-update-control
'
).
off
(
'
change
'
).
on
(
'
change
'
,
this
.
formSubmit
.
bind
(
this
));
$
(
'
.js-edit-member-form
'
).
off
(
'
ajax:success
'
).
on
(
'
ajax:success
'
,
this
.
formSuccess
.
bind
(
this
));
gl
.
utils
.
disableButtonIfEmptyField
(
'
#user_ids
'
,
'
input[name=commit]
'
,
'
change
'
);
}
=======
export
default
class
Members
{
constructor
()
{
this
.
addListeners
();
...
...
@@ -28,60 +7,25 @@ export default class Members {
}
addListeners
()
{
$
(
'
.js-ldap-permissions
'
).
off
(
'
click
'
).
on
(
'
click
'
,
this
.
showLDAPPermissionsWarning
.
bind
(
this
));
$
(
'
.js-ldap-override
'
).
off
(
'
click
'
).
on
(
'
click
'
,
this
.
toggleMemberAccessToggle
.
bind
(
this
));
$
(
'
.project_member, .group_member
'
).
off
(
'
ajax:success
'
).
on
(
'
ajax:success
'
,
this
.
removeRow
);
$
(
'
.js-member-update-control
'
).
off
(
'
change
'
).
on
(
'
change
'
,
this
.
formSubmit
.
bind
(
this
));
$
(
'
.js-edit-member-form
'
).
off
(
'
ajax:success
'
).
on
(
'
ajax:success
'
,
this
.
formSuccess
.
bind
(
this
));
gl
.
utils
.
disableButtonIfEmptyField
(
'
#user_ids
'
,
'
input[name=commit]
'
,
'
change
'
);
}
>>>>>>>
upstream
/
master
initGLDropdown
()
{
$
(
'
.js-member-permissions-dropdown
'
).
each
((
i
,
btn
)
=>
{
const
$btn
=
$
(
btn
);
<<<<<<<
HEAD
$btn
.
glDropdown
({
selectable
:
true
,
isSelectable
(
selected
,
$el
)
{
if
(
$el
.
data
(
'
revert
'
))
{
return
false
;
}
return
!
$el
.
hasClass
(
'
is-active
'
);
},
fieldName
:
$btn
.
data
(
'
field-name
'
),
id
(
selected
,
$el
)
{
return
$el
.
data
(
'
id
'
);
},
toggleLabel
(
selected
,
$el
)
{
if
(
$el
.
data
(
'
revert
'
))
{
return
$btn
.
text
();
}
return
$el
.
text
();
},
clicked
:
(
options
)
=>
{
const
$link
=
options
.
$el
;
if
(
!
$link
.
data
(
'
revert
'
))
{
this
.
formSubmit
(
null
,
$link
);
}
else
{
const
{
$memberListItem
,
$toggle
,
$dateInput
}
=
this
.
getMemberListItems
(
$link
);
$toggle
.
disable
();
$dateInput
.
disable
();
this
.
overrideLdap
(
$memberListItem
,
$link
.
data
(
'
endpoint
'
),
false
).
fail
(()
=>
{
$toggle
.
enable
();
$dateInput
.
enable
();
});
}
},
});
=======
$btn
.
glDropdown
({
selectable
:
true
,
isSelectable
(
selected
,
$el
)
{
if
(
$el
.
data
(
'
revert
'
))
{
return
false
;
}
return
!
$el
.
hasClass
(
'
is-active
'
);
},
fieldName
:
$btn
.
data
(
'
field-name
'
),
...
...
@@ -89,12 +33,29 @@ export default class Members {
return
$el
.
data
(
'
id
'
);
},
toggleLabel
(
selected
,
$el
)
{
if
(
$el
.
data
(
'
revert
'
))
{
return
$btn
.
text
();
}
return
$el
.
text
();
},
clicked
:
(
options
)
=>
{
this
.
formSubmit
(
null
,
options
.
$el
);
const
$link
=
options
.
$el
;
if
(
!
$link
.
data
(
'
revert
'
))
{
this
.
formSubmit
(
null
,
$link
);
}
else
{
const
{
$memberListItem
,
$toggle
,
$dateInput
}
=
this
.
getMemberListItems
(
$link
);
$toggle
.
disable
();
$dateInput
.
disable
();
this
.
overrideLdap
(
$memberListItem
,
$link
.
data
(
'
endpoint
'
),
false
).
fail
(()
=>
{
$toggle
.
enable
();
$dateInput
.
enable
();
});
}
},
>>>>>>>
upstream
/
master
});
});
}
...
...
@@ -120,67 +81,19 @@ export default class Members {
$dateInput
.
disable
();
}
<<<<<<<
HEAD
showLDAPPermissionsWarning
(
e
)
{
const
$btn
=
$
(
e
.
currentTarget
);
const
{
$memberListItem
}
=
this
.
getMemberListItems
(
$btn
);
const
$ldapPermissionsElement
=
$memberListItem
.
next
();
$ldapPermissionsElement
.
toggle
();
}
getMemberListItems
(
$el
)
{
const
$memberListItem
=
$el
.
is
(
'
.member
'
)
?
$el
:
$
(
`#
${
$el
.
data
(
'
el-id
'
)}
`
);
return
{
$memberListItem
,
$toggle
:
$memberListItem
.
find
(
'
.dropdown-menu-toggle
'
),
$dateInput
:
$memberListItem
.
find
(
'
.js-access-expiration-date
'
),
};
}
toggleMemberAccessToggle
(
e
)
{
const
$btn
=
$
(
e
.
currentTarget
);
const
{
$memberListItem
,
$toggle
,
$dateInput
}
=
this
.
getMemberListItems
(
$btn
);
$btn
.
disable
();
this
.
overrideLdap
(
$memberListItem
,
$btn
.
data
(
'
endpoint
'
),
true
).
then
(()
=>
{
this
.
showLDAPPermissionsWarning
(
e
);
$toggle
.
enable
();
$dateInput
.
enable
();
}).
fail
((
xhr
)
=>
{
$btn
.
enable
();
if
(
xhr
.
status
===
403
)
{
new
Flash
(
'
You do not have the correct permissions to override the settings from the LDAP group sync.
'
,
'
alert
'
);
}
else
{
new
Flash
(
'
An error occured whilst saving LDAP override status. Please try again.
'
,
'
alert
'
);
}
});
}
overrideLdap
(
$memberListitem
,
endpoint
,
override
)
{
return
$
.
ajax
({
url
:
endpoint
,
type
:
'
PATCH
'
,
data
:
{
group_member
:
{
override
,
},
},
}).
then
(()
=>
{
$memberListitem
.
toggleClass
(
'
is-overriden
'
,
override
);
});
}
=======
formSuccess
(
e
)
{
const
{
$toggle
,
$dateInput
}
=
this
.
getMemberListItems
(
$
(
e
.
currentTarget
).
closest
(
'
.member
'
));
$toggle
.
enable
();
$dateInput
.
enable
();
>>>>>>>
upstream
/
master
}
showLDAPPermissionsWarning
(
e
)
{
const
$btn
=
$
(
e
.
currentTarget
);
const
{
$memberListItem
}
=
this
.
getMemberListItems
(
$btn
);
const
$ldapPermissionsElement
=
$memberListItem
.
next
();
$ldapPermissionsElement
.
toggle
();
}
// eslint-disable-next-line class-methods-use-this
getMemberListItems
(
$el
)
{
...
...
@@ -192,4 +105,40 @@ export default class Members {
$dateInput
:
$memberListItem
.
find
(
'
.js-access-expiration-date
'
),
};
}
toggleMemberAccessToggle
(
e
)
{
const
$btn
=
$
(
e
.
currentTarget
);
const
{
$memberListItem
,
$toggle
,
$dateInput
}
=
this
.
getMemberListItems
(
$btn
);
$btn
.
disable
();
// eslint-disable-next-line promise/catch-or-return
this
.
overrideLdap
(
$memberListItem
,
$btn
.
data
(
'
endpoint
'
),
true
).
then
(()
=>
{
this
.
showLDAPPermissionsWarning
(
e
);
$toggle
.
enable
();
$dateInput
.
enable
();
}).
fail
((
xhr
)
=>
{
$btn
.
enable
();
if
(
xhr
.
status
===
403
)
{
Flash
(
'
You do not have the correct permissions to override the settings from the LDAP group sync.
'
,
'
alert
'
);
}
else
{
Flash
(
'
An error occured whilst saving LDAP override status. Please try again.
'
,
'
alert
'
);
}
});
}
// eslint-disable-next-line class-methods-use-this
overrideLdap
(
$memberListitem
,
endpoint
,
override
)
{
return
$
.
ajax
({
url
:
endpoint
,
type
:
'
PATCH
'
,
data
:
{
group_member
:
{
override
,
},
},
}).
then
(()
=>
{
$memberListitem
.
toggleClass
(
'
is-overriden
'
,
override
);
});
}
}
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