wizardDetectorFeatureAbstract.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * SPDX-FileCopyrightText: 2015 ownCloud, Inc.
  3. * SPDX-License-Identifier: AGPL-3.0-or-later
  4. */
  5. OCA = OCA || {};
  6. (function() {
  7. /**
  8. * @classdesc abstract detector for detecting groups and object classes
  9. *
  10. * @constructor
  11. */
  12. var WizardDetectorFeatureAbstract = OCA.LDAP.Wizard.WizardDetectorGeneric.subClass({
  13. /**
  14. * runs the detector, if port is not set.
  15. *
  16. * @param {OCA.LDAP.Wizard.ConfigModel} model
  17. * @param {string} configID - the configuration prefix
  18. * @returns {boolean|jqXHR}
  19. * @abstract
  20. */
  21. run: function(model, configID) {
  22. model.notifyAboutDetectionStart(this.getTargetKey());
  23. var params = OC.buildQueryString({
  24. action: this.wizardMethod,
  25. ldap_serverconfig_chooser: configID
  26. });
  27. return model.callWizard(params, this.processResult, this);
  28. },
  29. /**
  30. * @inheritdoc
  31. */
  32. processResult: function(model, detector, result) {
  33. if(result.status === 'success') {
  34. var payload = {
  35. feature: detector.featureName,
  36. data: result.options[detector.getTargetKey()]
  37. };
  38. model.inform(payload);
  39. }
  40. this._super(model, detector, result);
  41. }
  42. });
  43. OCA.LDAP.Wizard.WizardDetectorFeatureAbstract = WizardDetectorFeatureAbstract;
  44. })();