wizardDetectorFeatureAbstract.js 1.3 KB

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