Merge pull request #16326 from owncloud/fix-16192

include base dn test in functionality test
This commit is contained in:
Morris Jobke 2015-05-20 12:12:52 +02:00
commit 3a4568313f
2 changed files with 29 additions and 3 deletions

View File

@ -167,6 +167,26 @@ OCA = OCA || {};
view.considerFunctionalityCheck(param); view.considerFunctionalityCheck(param);
}, },
/**
* Base DN test results will arrive here
*
* @param {WizardTabElementary} view
* @param {FeaturePayload} payload
*/
onDetectionTestCompleted: function(view, payload) {
if(payload.feature === 'TestBaseDN') {
if(payload.data.status === 'success') {
var objectsFound = parseInt(payload.data.changes.ldap_test_base, 10);
if(objectsFound > 0) {
view._updateStatusIndicator(view.STATUS_SUCCESS);
return;
}
}
view._updateStatusIndicator(view.STATUS_ERROR);
OC.Notification.showTemporary(t('user_ldap', 'The Base DN appears to be wrong'));
}
},
/** /**
* updates the status indicator based on the configuration test result * updates the status indicator based on the configuration test result
* *
@ -176,7 +196,7 @@ OCA = OCA || {};
*/ */
onTestCompleted: function(view, result) { onTestCompleted: function(view, result) {
if(result.isSuccess) { if(result.isSuccess) {
view._updateStatusIndicator(view.STATUS_SUCCESS); view.configModel.requestWizard('ldap_test_base');
} else { } else {
view._updateStatusIndicator(view.STATUS_ERROR); view._updateStatusIndicator(view.STATUS_ERROR);
} }
@ -272,6 +292,7 @@ OCA = OCA || {};
this.configModel.on('setRequested', this.onSetRequested, this); this.configModel.on('setRequested', this.onSetRequested, this);
this.configModel.on('setCompleted', this.onSetRequestDone, this); this.configModel.on('setCompleted', this.onSetRequestDone, this);
this.configModel.on('configurationTested', this.onTestCompleted, this); this.configModel.on('configurationTested', this.onTestCompleted, this);
this.configModel.on('receivedLdapFeature', this.onDetectionTestCompleted, this);
}, },
/** /**

View File

@ -17,6 +17,8 @@ OCA = OCA || {};
/** @property {number} */ /** @property {number} */
_configChooserNextServerNumber: 1, _configChooserNextServerNumber: 1,
baseDNTestTriggered: false,
/** /**
* initializes the instance. Always call it after initialization. * initializes the instance. Always call it after initialization.
* *
@ -198,8 +200,8 @@ OCA = OCA || {};
* @param {Object} configuration * @param {Object} configuration
*/ */
onConfigSwitch: function(view, configuration) { onConfigSwitch: function(view, configuration) {
this.baseDNTestTriggered = false;
view.disableElement(view.managedItems.ldap_port.$relatedElements); view.disableElement(view.managedItems.ldap_port.$relatedElements);
view.onConfigLoaded(view, configuration); view.onConfigLoaded(view, configuration);
}, },
@ -261,7 +263,8 @@ OCA = OCA || {};
* @param {FeaturePayload} payload * @param {FeaturePayload} payload
*/ */
onTestResultReceived: function(view, payload) { onTestResultReceived: function(view, payload) {
if(payload.feature === 'TestBaseDN') { if(view.baseDNTestTriggered && payload.feature === 'TestBaseDN') {
view.enableElement(view.managedItems.ldap_base.$testButton);
var message; var message;
if(payload.data.status === 'success') { if(payload.data.status === 'success') {
var objectsFound = parseInt(payload.data.changes.ldap_test_base, 10); var objectsFound = parseInt(payload.data.changes.ldap_test_base, 10);
@ -310,7 +313,9 @@ OCA = OCA || {};
*/ */
onBaseDNTestButtonClick: function(event) { onBaseDNTestButtonClick: function(event) {
event.preventDefault(); event.preventDefault();
this.baseDNTestTriggered = true;
this.configModel.requestWizard('ldap_test_base'); this.configModel.requestWizard('ldap_test_base');
this.disableElement(this.managedItems.ldap_base.$testButton);
}, },
/** /**