diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2013-05-14 17:36:28 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2013-05-17 12:32:06 +0200 |
commit | 6e90920233cc9a7c9feb040dea22cda837715c39 (patch) | |
tree | 2537b852644502a58c6afa83bf12cf1c0a267825 /install/ui/src/freeipa/details.js | |
parent | 8d07054e1b2ff8680c225e7cd847eb885e7246a4 (diff) | |
download | freeipa-6e90920233cc9a7c9feb040dea22cda837715c39.tar.gz freeipa-6e90920233cc9a7c9feb040dea22cda837715c39.tar.xz freeipa-6e90920233cc9a7c9feb040dea22cda837715c39.zip |
Move spec modifications from facet factories to pre_ops
Spec modifications in factories makes inheritance and extensibility more difficult.
Moving them to pre_ops allows modification of their output by other pre_ops.
https://fedorahosted.org/freeipa/ticket/3605
Diffstat (limited to 'install/ui/src/freeipa/details.js')
-rw-r--r-- | install/ui/src/freeipa/details.js | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/install/ui/src/freeipa/details.js b/install/ui/src/freeipa/details.js index 15239d444..6811a1dfb 100644 --- a/install/ui/src/freeipa/details.js +++ b/install/ui/src/freeipa/details.js @@ -33,7 +33,7 @@ define([ './text', './facet', './add'], - function(lang, builder, IPA, $, phases, reg, text) { + function(lang, builder, IPA, $, phases, reg, text, mod_facet) { var exp = {}; @@ -241,9 +241,8 @@ exp.facet_policies = IPA.facet_policies = function(spec) { return that; }; -exp.details_facet = IPA.details_facet = function(spec, no_init) { +exp.details_facet_pre_op = function(spec, context) { - spec = spec || {}; spec.name = spec.name || 'details'; spec.actions = spec.actions || []; @@ -277,6 +276,12 @@ exp.details_facet = IPA.details_facet = function(spec, no_init) { spec.state = spec.state || {}; spec.state.evaluators = spec.state.evaluators || []; spec.state.evaluators.push(IPA.dirty_state_evaluator); + return spec; +}; + +exp.details_facet = IPA.details_facet = function(spec, no_init) { + + spec = spec || {}; var that = IPA.facet(spec, true); @@ -1221,6 +1226,7 @@ exp.disabled_summary_cond = IPA.disabled_summary_cond = function() { exp.register = function() { var a = reg.action; + var f = reg.facet; a.register('select', exp.select_action); a.register('refresh', exp.refresh_action); @@ -1230,6 +1236,15 @@ exp.register = function() { a.register('enable', exp.enable_action); a.register('disable', exp.disable_action); a.register('delete', exp.delete_action); + + f.register({ + type: 'details', + factory: IPA.details_facet, + pre_ops: [ + mod_facet.facet_preops.details, + exp.details_facet_pre_op + ] + }); }; phases.on('registration', exp.register); |