Make summary conditions declarative

https://fedorahosted.org/freeipa/ticket/3235
This commit is contained in:
Petr Vobornik 2013-04-17 16:18:26 +02:00
parent bee39848d3
commit c206249bd2
7 changed files with 22 additions and 16 deletions

View File

@ -24,6 +24,7 @@
/* IPA Object Details - populating definiton lists from entry data */
define([
'dojo/_base/lang',
'./builder',
'./ipa',
'./jquery',
@ -32,7 +33,7 @@ define([
'./text',
'./facet',
'./add'],
function(builder, IPA, $, phases, reg, text) {
function(lang, builder, IPA, $, phases, reg, text) {
var exp = {};
@ -1194,21 +1195,26 @@ exp.delete_action = IPA.delete_action = function(spec) {
exp.enabled_summary_cond = IPA.enabled_summary_cond = function() {
return {
var that = IPA.object();
lang.mixin(that, {
pos: ['enabled'],
neg: [],
description: text.get('@i18n:status.enabled'),
state: ['enabled']
};
});
return that;
};
exp.disabled_summary_cond = IPA.disabled_summary_cond = function() {
return {
var that = IPA.object();
lang.mixin(that, {
pos: [],
neg: ['enabled'],
description: text.get('@i18n:status.disabled'),
state: ['disabled']
};
});
return that;
};
exp.register = function() {

View File

@ -255,8 +255,8 @@ IPA.dns.zone_entity = function(spec) {
IPA.dns.zone_has_permission_evaluator
],
summary_conditions: [
IPA.enabled_summary_cond(),
IPA.disabled_summary_cond()
IPA.enabled_summary_cond,
IPA.disabled_summary_cond
]
}
}).

View File

@ -1787,7 +1787,7 @@ exp.state = IPA.state = function(spec) {
that.evaluators = builder.build('state_evaluator', spec.evaluators) || [];
that.summary_evaluator = builder.build('', spec.summary_evaluator || IPA.summary_evaluator);
that.summary_conditions = spec.summary_conditions || [];
that.summary_conditions = builder.build('', spec.summary_conditions) || [];
that.init = function(facet) {

View File

@ -82,8 +82,8 @@ IPA.hbac.rule_entity = function(spec) {
}
],
summary_conditions: [
IPA.enabled_summary_cond(),
IPA.disabled_summary_cond()
IPA.enabled_summary_cond,
IPA.disabled_summary_cond
]
}
}).

View File

@ -81,8 +81,8 @@ IPA.selinux.selinuxusermap_entity = function(spec) {
}
],
summary_conditions: [
IPA.enabled_summary_cond(),
IPA.disabled_summary_cond()
IPA.enabled_summary_cond,
IPA.disabled_summary_cond
]
}
}).

View File

@ -80,8 +80,8 @@ IPA.sudo.rule_entity = function(spec) {
}
],
summary_conditions: [
IPA.enabled_summary_cond(),
IPA.disabled_summary_cond()
IPA.enabled_summary_cond,
IPA.disabled_summary_cond
]
}
}).

View File

@ -251,8 +251,8 @@ IPA.user.entity = function(spec) {
IPA.user.reset_password_acl_evaluator
],
summary_conditions: [
IPA.enabled_summary_cond(),
IPA.disabled_summary_cond()
IPA.enabled_summary_cond,
IPA.disabled_summary_cond
]
}
}).