Merge branch 'fix-modal-groups-populate' into 'master'
fix(admin): fix modal add user groups select box populate See merge request isard/isard-sso!82
commit
8325f85781
|
@ -6,29 +6,8 @@ $(document).on('shown.bs.modal', '#modalAddDesktop', function () {
|
|||
$(document).ready(function() {
|
||||
|
||||
$('#bulk_actions option[value=""]').prop("selected",true);
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
"url": "/api/groups",
|
||||
success: function(data)
|
||||
{
|
||||
data.forEach(element => {
|
||||
var groupOrigins = [];
|
||||
['keycloak'].forEach(o => {
|
||||
if (element[o]) {
|
||||
groupOrigins.push(o)
|
||||
}
|
||||
})
|
||||
$(".groups-select").append(
|
||||
'<option value="' + element.name + '">' + element.name + '</option>'
|
||||
)
|
||||
});
|
||||
$('.groups-select').select2();
|
||||
},
|
||||
error: function(data)
|
||||
{
|
||||
alert('Something went wrong on our side...')
|
||||
}
|
||||
});
|
||||
|
||||
update_groups();
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
|
@ -123,6 +102,7 @@ $(document).ready(function() {
|
|||
// Open new user modal
|
||||
$('.btn-new-user').on('click', function () {
|
||||
$("#modalAddUserForm")[0].reset();
|
||||
update_groups();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
"url": "/api/user_password",
|
||||
|
@ -634,4 +614,31 @@ $(document).ready(function() {
|
|||
// $(div_id + ' .role-keycloak-select').val('13da53d5-c50b-42d9-8fbf-84f2ed7cbf9e');
|
||||
// $('.groups-select, .role-moodle-select, .role-nextcloud-select, .role-keycloak-select').trigger('change');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function update_groups(){
|
||||
$(".groups-select").empty()
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
"url": "/api/groups",
|
||||
success: function(data)
|
||||
{
|
||||
data.forEach(element => {
|
||||
var groupOrigins = [];
|
||||
['keycloak'].forEach(o => {
|
||||
if (element[o]) {
|
||||
groupOrigins.push(o)
|
||||
}
|
||||
})
|
||||
$(".groups-select").append(
|
||||
'<option value="' + element.name + '">' + element.name + '</option>'
|
||||
)
|
||||
});
|
||||
$('.groups-select').select2();
|
||||
},
|
||||
error: function(data)
|
||||
{
|
||||
alert('Something went wrong on our side...')
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue