LDAP Wizard: Use Ajax Spinner to indicate something is happening, especiall port detection
This commit is contained in:
parent
f64ae75107
commit
63e9c56d48
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
.tablecell {
|
.tablecell {
|
||||||
display: table-cell !important;
|
display: table-cell !important;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tablerow {
|
.tablerow {
|
||||||
|
@ -75,6 +76,10 @@
|
||||||
color: #FF3B3B;
|
color: #FF3B3B;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wizSpinner {
|
||||||
|
height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
#ldap fieldset p label {
|
#ldap fieldset p label {
|
||||||
width: 20%;
|
width: 20%;
|
||||||
max-width: 200px;
|
max-width: 200px;
|
||||||
|
|
|
@ -128,6 +128,7 @@ var LdapWizard = {
|
||||||
checkPortInfoShown: false,
|
checkPortInfoShown: false,
|
||||||
saveBlacklist: {},
|
saveBlacklist: {},
|
||||||
userFilterGroupSelectState: 'enable',
|
userFilterGroupSelectState: 'enable',
|
||||||
|
spinner: '<img class="wizSpinner" src="'+ OC.imagePath('core', 'loading.gif') +'">',
|
||||||
|
|
||||||
ajax: function(param, fnOnSuccess, fnOnError) {
|
ajax: function(param, fnOnSuccess, fnOnError) {
|
||||||
$.post(
|
$.post(
|
||||||
|
@ -168,15 +169,18 @@ var LdapWizard = {
|
||||||
param = 'action=guessBaseDN'+
|
param = 'action=guessBaseDN'+
|
||||||
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val();
|
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val();
|
||||||
|
|
||||||
|
LdapWizard.showSpinner('#ldap_base');
|
||||||
LdapWizard.ajax(param,
|
LdapWizard.ajax(param,
|
||||||
function(result) {
|
function(result) {
|
||||||
LdapWizard.applyChanges(result);
|
LdapWizard.applyChanges(result);
|
||||||
|
LdapWizard.hideSpinner('#ldap_base');
|
||||||
if($('#ldap_base').val()) {
|
if($('#ldap_base').val()) {
|
||||||
$('#ldap_base').removeClass('invisible');
|
$('#ldap_base').removeClass('invisible');
|
||||||
LdapWizard.hideInfoBox();
|
LdapWizard.hideInfoBox();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function (result) {
|
function (result) {
|
||||||
|
LdapWizard.hideSpinner('#ldap_base');
|
||||||
$('#ldap_base').removeClass('invisible');
|
$('#ldap_base').removeClass('invisible');
|
||||||
LdapWizard.showInfoBox('Please specify a port');
|
LdapWizard.showInfoBox('Please specify a port');
|
||||||
}
|
}
|
||||||
|
@ -193,9 +197,11 @@ var LdapWizard = {
|
||||||
param = 'action=guessPortAndTLS'+
|
param = 'action=guessPortAndTLS'+
|
||||||
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val();
|
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val();
|
||||||
|
|
||||||
|
LdapWizard.showSpinner('#ldap_port');
|
||||||
LdapWizard.ajax(param,
|
LdapWizard.ajax(param,
|
||||||
function(result) {
|
function(result) {
|
||||||
LdapWizard.applyChanges(result);
|
LdapWizard.applyChanges(result);
|
||||||
|
LdapWizard.hideSpinner('#ldap_port');
|
||||||
if($('#ldap_port').val()) {
|
if($('#ldap_port').val()) {
|
||||||
LdapWizard.checkBaseDN();
|
LdapWizard.checkBaseDN();
|
||||||
$('#ldap_port').removeClass('invisible');
|
$('#ldap_port').removeClass('invisible');
|
||||||
|
@ -203,6 +209,7 @@ var LdapWizard = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function (result) {
|
function (result) {
|
||||||
|
LdapWizard.hideSpinner('#ldap_port');
|
||||||
$('#ldap_port').removeClass('invisible');
|
$('#ldap_port').removeClass('invisible');
|
||||||
LdapWizard.showInfoBox('Please specify the BaseDN');
|
LdapWizard.showInfoBox('Please specify the BaseDN');
|
||||||
}
|
}
|
||||||
|
@ -278,6 +285,7 @@ var LdapWizard = {
|
||||||
param = 'action=determineAttributes'+
|
param = 'action=determineAttributes'+
|
||||||
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val();
|
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val();
|
||||||
|
|
||||||
|
LdapWizard.showSpinner('#ldap_loginfilter_attributes');
|
||||||
LdapWizard.ajax(param,
|
LdapWizard.ajax(param,
|
||||||
function(result) {
|
function(result) {
|
||||||
$('#ldap_loginfilter_attributes').find('option').remove();
|
$('#ldap_loginfilter_attributes').find('option').remove();
|
||||||
|
@ -287,6 +295,7 @@ var LdapWizard = {
|
||||||
$('#ldap_loginfilter_attributes').append(
|
$('#ldap_loginfilter_attributes').append(
|
||||||
"<option value='"+attr+"'>"+attr+"</option>");
|
"<option value='"+attr+"'>"+attr+"</option>");
|
||||||
}
|
}
|
||||||
|
LdapWizard.hideSpinner('#ldap_loginfilter_attributes');
|
||||||
LdapWizard.applyChanges(result);
|
LdapWizard.applyChanges(result);
|
||||||
$('#ldap_loginfilter_attributes').multiselect('refresh');
|
$('#ldap_loginfilter_attributes').multiselect('refresh');
|
||||||
$('#ldap_loginfilter_attributes').multiselect('enable');
|
$('#ldap_loginfilter_attributes').multiselect('enable');
|
||||||
|
@ -296,6 +305,7 @@ var LdapWizard = {
|
||||||
$('#ldap_loginfilter_attributes').multiselect(
|
$('#ldap_loginfilter_attributes').multiselect(
|
||||||
{noneSelectedText : 'No attributes found'});
|
{noneSelectedText : 'No attributes found'});
|
||||||
$('#ldap_loginfilter_attributes').multiselect('disable');
|
$('#ldap_loginfilter_attributes').multiselect('disable');
|
||||||
|
LdapWizard.hideSpinner('#ldap_loginfilter_attributes');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -307,6 +317,7 @@ var LdapWizard = {
|
||||||
param = 'action=determineGroupsFor'+type+
|
param = 'action=determineGroupsFor'+type+
|
||||||
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val();
|
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val();
|
||||||
|
|
||||||
|
LdapWizard.showSpinner('#'+multisel);
|
||||||
LdapWizard.ajax(param,
|
LdapWizard.ajax(param,
|
||||||
function(result) {
|
function(result) {
|
||||||
$('#'+multisel).find('option').remove();
|
$('#'+multisel).find('option').remove();
|
||||||
|
@ -315,11 +326,13 @@ var LdapWizard = {
|
||||||
objc = result.options[multisel][i];
|
objc = result.options[multisel][i];
|
||||||
$('#'+multisel).append("<option value='"+objc+"'>"+objc+"</option>");
|
$('#'+multisel).append("<option value='"+objc+"'>"+objc+"</option>");
|
||||||
}
|
}
|
||||||
|
LdapWizard.hideSpinner('#'+multisel);
|
||||||
LdapWizard.applyChanges(result);
|
LdapWizard.applyChanges(result);
|
||||||
$('#'+multisel).multiselect('refresh');
|
$('#'+multisel).multiselect('refresh');
|
||||||
$('#'+multisel).multiselect('enable');
|
$('#'+multisel).multiselect('enable');
|
||||||
},
|
},
|
||||||
function (result) {
|
function (result) {
|
||||||
|
LdapWizard.hideSpinner('#'+multisel);
|
||||||
$('#'+multisel).multiselect('disable');
|
$('#'+multisel).multiselect('disable');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -332,6 +345,7 @@ var LdapWizard = {
|
||||||
param = 'action=determine'+type+'ObjectClasses'+
|
param = 'action=determine'+type+'ObjectClasses'+
|
||||||
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val();
|
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val();
|
||||||
|
|
||||||
|
LdapWizard.showSpinner('#'+multisel);
|
||||||
LdapWizard.ajax(param,
|
LdapWizard.ajax(param,
|
||||||
function(result) {
|
function(result) {
|
||||||
$('#'+multisel).find('option').remove();
|
$('#'+multisel).find('option').remove();
|
||||||
|
@ -340,10 +354,12 @@ var LdapWizard = {
|
||||||
objc = result.options[multisel][i];
|
objc = result.options[multisel][i];
|
||||||
$('#'+multisel).append("<option value='"+objc+"'>"+objc+"</option>");
|
$('#'+multisel).append("<option value='"+objc+"'>"+objc+"</option>");
|
||||||
}
|
}
|
||||||
|
LdapWizard.hideSpinner('#'+multisel);
|
||||||
LdapWizard.applyChanges(result);
|
LdapWizard.applyChanges(result);
|
||||||
$('#'+multisel).multiselect('refresh');
|
$('#'+multisel).multiselect('refresh');
|
||||||
},
|
},
|
||||||
function (result) {
|
function (result) {
|
||||||
|
LdapWizard.hideSpinner('#'+multisel);
|
||||||
//TODO: error handling
|
//TODO: error handling
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -379,6 +395,11 @@ var LdapWizard = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hideSpinner: function(id) {
|
||||||
|
$(id+' + .wizSpinner').remove();
|
||||||
|
$(id + " + button").css('display', 'inline');
|
||||||
|
},
|
||||||
|
|
||||||
init: function() {
|
init: function() {
|
||||||
if($('#ldap_port').val()) {
|
if($('#ldap_port').val()) {
|
||||||
$('#ldap_port').removeClass('invisible');
|
$('#ldap_port').removeClass('invisible');
|
||||||
|
@ -510,6 +531,11 @@ var LdapWizard = {
|
||||||
LdapWizard.checkInfoShown = true;
|
LdapWizard.checkInfoShown = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showSpinner: function(id) {
|
||||||
|
$(LdapWizard.spinner).insertAfter($(id));
|
||||||
|
$(id + " + img + button").css('display', 'none');
|
||||||
|
},
|
||||||
|
|
||||||
toggleRawFilter: function(container, moc, mg, stateVar) {
|
toggleRawFilter: function(container, moc, mg, stateVar) {
|
||||||
if($(container).hasClass('invisible')) {
|
if($(container).hasClass('invisible')) {
|
||||||
$(container).removeClass('invisible');
|
$(container).removeClass('invisible');
|
||||||
|
|
Loading…
Reference in New Issue