Fixed inconsistent status labels.

This patch modifies the status attributes in users, DNS zones,
HBAC/sudo rules, HBAC test, and SELinux User Map to use the same
label (i.e. Status) and values (i.e. Enabled/Disabled). The method
to change the status will be modified separately.

Ticket #2247
This commit is contained in:
Endi Sukma Dewata 2012-01-18 21:54:41 -06:00 committed by Petr Voborník
parent fef343ae8f
commit b353239e59
11 changed files with 138 additions and 72 deletions

View File

@ -43,8 +43,16 @@ IPA.dns.zone_entity = function(spec) {
that.builder.facet_groups([ 'dnsrecord', 'settings' ]).
search_facet({
row_enabled_attribute: 'idnszoneactive',
title: IPA.metadata.objects.dnszone.label,
columns: [ 'idnsname' ]
columns: [
'idnsname',
{
name: 'idnszoneactive',
label: IPA.messages.status.label,
format: IPA.boolean_status_format()
}
]
}).
details_facet({
factory: IPA.dnszone_details_facet,
@ -55,9 +63,10 @@ IPA.dns.zone_entity = function(spec) {
{
type: 'radio',
name: 'idnszoneactive',
label: IPA.messages.status.label,
options: [
{ value: 'TRUE', label: IPA.get_message('true') },
{ value: 'FALSE', label: IPA.get_message('false') }
{ value: 'TRUE', label: IPA.messages.status.enabled },
{ value: 'FALSE', label: IPA.messages.status.disabled }
]
},
'idnssoamname',

View File

@ -43,9 +43,8 @@ IPA.hbac.rule_entity = function(spec) {
'cn',
{
name: 'ipaenabledflag',
format: IPA.boolean_format({
show_false: true
})
label: IPA.messages.status.label,
format: IPA.boolean_status_format()
},
'description'
]
@ -208,6 +207,7 @@ IPA.hbacrule_details_facet = function(spec) {
{
type: 'enable',
name: 'ipaenabledflag',
label: IPA.messages.status.label,
priority: IPA.hbac.enable_priority,
widget: 'general.ipaenabledflag'
}
@ -230,8 +230,8 @@ IPA.hbacrule_details_facet = function(spec) {
type: 'enable',
name: 'ipaenabledflag',
options: [
{ value: 'TRUE', label: IPA.get_message('true') },
{ value: 'FALSE', label: IPA.get_message('false') }
{ value: 'TRUE', label: IPA.messages.status.enabled },
{ value: 'FALSE', label: IPA.messages.status.disabled }
]
}
]

View File

@ -50,13 +50,10 @@ IPA.hbac.test_entity = function(spec) {
'sn',
{
name: 'nsaccountlock',
format: IPA.boolean_format({
true_value: IPA.messages.objects.user.active,
false_value: IPA.messages.objects.user.inactive,
invert_value: true,
show_false: true
}),
label: IPA.messages.objects.user.account_status
label: IPA.messages.status.label,
format: IPA.boolean_status_format({
invert_value: true
})
}
]
}).
@ -118,9 +115,8 @@ IPA.hbac.test_entity = function(spec) {
'cn',
{
name: 'ipaenabledflag',
format: IPA.boolean_format({
show_false: true
})
label: IPA.messages.status.label,
format: IPA.boolean_status_format()
},
'description'
]
@ -142,9 +138,8 @@ IPA.hbac.test_entity = function(spec) {
},
{
name: 'ipaenabledflag',
format: IPA.boolean_format({
show_false: true
})
label: IPA.messages.status.label,
format: IPA.boolean_status_format()
},
'description'
]

View File

@ -42,9 +42,8 @@ IPA.selinux.selinuxusermap_entity = function(spec) {
'ipaselinuxuser',
{
name: 'ipaenabledflag',
format: IPA.boolean_format({
show_false: true
})
label: IPA.messages.status.label,
format: IPA.boolean_status_format()
},
'description'
]
@ -96,6 +95,7 @@ IPA.selinux_details_facet = function(spec) {
{
type: 'enable',
name: 'ipaenabledflag',
label: IPA.messages.status.label,
priority: IPA.selinux.enable_priority,
widget: 'general.ipaenabledflag'
}
@ -128,8 +128,8 @@ IPA.selinux_details_facet = function(spec) {
type: 'enable',
name: 'ipaenabledflag',
options: [
{ value: 'TRUE', label: IPA.get_message('true') },
{ value: 'FALSE', label: IPA.get_message('false') }
{ value: 'TRUE', label: IPA.messages.status.enabled },
{ value: 'FALSE', label: IPA.messages.status.disabled }
]
}
]

View File

@ -41,9 +41,8 @@ IPA.sudo.rule_entity = function(spec) {
'cn',
{
name: 'ipaenabledflag',
format: IPA.boolean_format({
show_false: true
})
label: IPA.messages.status.label,
format: IPA.boolean_status_format()
},
'description'
]
@ -206,6 +205,7 @@ IPA.sudorule_details_facet = function(spec) {
{
type: 'enable',
name: 'ipaenabledflag',
label: IPA.messages.status.label,
priority: IPA.sudo.enable_priority,
widget: 'general.ipaenabledflag'
}
@ -228,8 +228,8 @@ IPA.sudorule_details_facet = function(spec) {
type: 'enable',
name: 'ipaenabledflag',
options: [
{ value: 'TRUE', label: IPA.get_message('true') },
{ value: 'FALSE', label: IPA.get_message('false') }
{ value: 'TRUE', label: IPA.messages.status.enabled },
{ value: 'FALSE', label: IPA.messages.status.disabled }
]
}
]

View File

@ -15,6 +15,12 @@
"idnsname": [
"example.com"
]
},
{
"dn": "idnsname=test.com,cn=dns,dc=example,dc=com",
"idnsname": [
"test.com"
]
}
],
"summary": null,

View File

@ -101,6 +101,55 @@
},
"summary": null,
"value": "example.com"
},
{
"error": null,
"result": {
"dn": "idnsname=test.com,cn=dns,dc=example,dc=com",
"idnsallowdynupdate": [
"TRUE"
],
"idnsname": [
"test.com"
],
"idnssoaexpire": [
"1209600"
],
"idnssoaminimum": [
"3600"
],
"idnssoamname": [
"dev.example.com."
],
"idnssoarefresh": [
"3600"
],
"idnssoaretry": [
"900"
],
"idnssoarname": [
"root.dev.example.com."
],
"idnssoaserial": [
"2010021201"
],
"idnsupdatepolicy": [
"grant TEST.COM krb5-self * A;"
],
"idnszoneactive": [
"FALSE"
],
"nsrecord": [
"dev.example.com."
],
"objectclass": [
"top",
"idnsrecord",
"idnszone"
]
},
"summary": null,
"value": "test.com"
}
]
}

View File

@ -202,12 +202,10 @@
"posix": "Is this a POSIX group?"
},
"hbacrule": {
"active": "Active",
"any_host": "Any Host",
"any_service": "Any Service",
"anyone": "Anyone",
"host": "Accessing",
"inactive": "Inactive",
"ipaenabledflag": "Rule status",
"service": "Via Service",
"sourcehost": "From",
@ -310,7 +308,6 @@
"commands": "Commands"
},
"sudorule": {
"active": "Active",
"allow": "Allow",
"any_command": "Any Command",
"any_group": "Any Group",
@ -320,7 +317,6 @@
"deny": "Deny",
"external": "External",
"host": "Access this host",
"inactive": "Inactive",
"ipaenabledflag": "Rule status",
"options": "Options",
"runas": "As Whom",
@ -333,17 +329,13 @@
"user": {
"account": "Account Settings",
"account_status": "Account Status",
"activate": "Activate",
"activation_confirmation": "Are you sure you want to ${action} the user?<br/>The change will take effect immediately.",
"activation_link": "Click to ${action}",
"active": "Active",
"contact": "Contact Settings",
"deactivate": "Deactivate",
"employee": "Employee Information",
"error_changing_status": "Error changing account status",
"inactive": "Inactive",
"mailing": "Mailing Address",
"misc": "Misc. Information"
"misc": "Misc. Information",
"status_confirmation": "Are you sure you want to ${action} the user?<br/>The change will take effect immediately.",
"status_link": "Click to ${action}"
}
},
"password": {
@ -363,6 +355,13 @@
"truncated": "Query returned more results than the configured size limit. Displaying the first ${counter} results.",
"unselect_all": "Unselect All"
},
"status": {
"disable": "Disable",
"disabled": "Disabled",
"enable": "Enable",
"enabled": "Enabled",
"label": "Status"
},
"tabs": {
"audit": "Audit",
"automount": "Automount",

View File

@ -43,13 +43,10 @@ IPA.user.entity = function(spec) {
'sn',
{
name: 'nsaccountlock',
format: IPA.boolean_format({
true_value: IPA.messages.objects.user.active,
false_value: IPA.messages.objects.user.inactive,
invert_value: true,
show_false: true
}),
label: IPA.messages.objects.user.account_status
label: IPA.messages.status.label,
format: IPA.boolean_status_format({
invert_value: true
})
},
'uidnumber',
'mail',
@ -78,7 +75,7 @@ IPA.user.entity = function(spec) {
{
factory: IPA.user_status_widget,
name: 'nsaccountlock',
label: IPA.messages.objects.user.account_status
label: IPA.messages.status.label
},
'uid',
{
@ -439,19 +436,19 @@ IPA.user_status_widget = function(spec) {
var action;
if (locked) {
status = IPA.messages.objects.user.inactive;
action = 'activate';
status = IPA.messages.status.disabled;
action = 'enable';
} else {
status = IPA.messages.objects.user.active;
action = 'deactivate';
status = IPA.messages.status.enabled;
action = 'disable';
}
that.status_span.html(status);
that.status_link.attr('href', action);
var message = IPA.messages.objects.user.activation_link;
var action_label = IPA.messages.objects.user[action];
var message = IPA.messages.objects.user.status_link;
var action_label = IPA.messages.status[action];
message = message.replace('${action}', action_label);
that.status_link.html(message);
@ -473,12 +470,12 @@ IPA.user_status_widget = function(spec) {
var action = that.status_link.attr('href');
var message = IPA.messages.objects.user.activation_confirmation;
var action_label = IPA.messages.objects.user[action];
var message = IPA.messages.objects.user.status_confirmation;
var action_label = IPA.messages.status[action];
message = message.replace('${action}', action_label.toLocaleLowerCase());
var dialog = IPA.dialog({
'title': IPA.messages.dialogs.confirmation
title: IPA.messages.dialogs.confirmation
});
dialog.create = function() {
@ -490,7 +487,7 @@ IPA.user_status_widget = function(spec) {
label: action_label,
click: function() {
that.set_status(
action == 'activate',
action,
function(data, textStatus, xhr) {
var facet = that.entity.get_facet();
facet.refresh();
@ -511,10 +508,9 @@ IPA.user_status_widget = function(spec) {
dialog.open(that.container);
};
that.set_status = function(enabled, on_success, on_error) {
that.set_status = function(method, on_success, on_error) {
var pkey = IPA.nav.get_state('user-pkey');
var method = enabled ? 'enable' : 'disable';
IPA.command({
entity: 'user',

View File

@ -1019,6 +1019,19 @@ IPA.boolean_format = function(spec) {
return that;
};
IPA.boolean_status_format = function(spec) {
spec = spec || {};
var that = IPA.boolean_format(spec);
that.true_value = spec.true_value || IPA.messages.status.enabled;
that.false_value = spec.false_value || IPA.messages.status.disabled;
that.show_false = true;
return that;
};
/*
The entity name must be set in the spec either directly or via entity.name
*/

View File

@ -339,12 +339,10 @@ class i18n_messages(Command):
"posix": _("Is this a POSIX group?"),
},
"hbacrule": {
"active": _("Active"),
"any_host": _("Any Host"),
"any_service": _("Any Service"),
"anyone": _("Anyone"),
"host": _("Accessing"),
"inactive": _("Inactive"),
"ipaenabledflag": _("Rule status"),
"service": _("Via Service"),
"sourcehost": _("From"),
@ -449,7 +447,6 @@ class i18n_messages(Command):
"commands": _("Commands"),
},
"sudorule": {
"active": _("Active"),
"allow": _("Allow"),
"any_command": _("Any Command"),
"any_group": _("Any Group"),
@ -459,7 +456,6 @@ class i18n_messages(Command):
"deny": _("Deny"),
"external": _("External"),
"host": _("Access this host"),
"inactive": _("Inactive"),
"ipaenabledflag": _("Rule status"),
"options": _("Options"),
"runas": _("As Whom"),
@ -472,17 +468,13 @@ class i18n_messages(Command):
"user": {
"account": _("Account Settings"),
"account_status": _("Account Status"),
"activate": _("Activate"),
"activation_confirmation": _("Are you sure you want to ${action} the user?<br/>The change will take effect immediately."),
"activation_link": _("Click to ${action}"),
"active": _("Active"),
"contact": _("Contact Settings"),
"deactivate": _("Deactivate"),
"employee": _("Employee Information"),
"error_changing_status": _("Error changing account status"),
"inactive": _("Inactive"),
"mailing": _("Mailing Address"),
"misc": _("Misc. Information"),
"status_confirmation": _("Are you sure you want to ${action} the user?<br/>The change will take effect immediately."),
"status_link": _("Click to ${action}"),
},
},
"password": {
@ -502,6 +494,13 @@ class i18n_messages(Command):
"truncated": _("Query returned more results than the configured size limit. Displaying the first ${counter} results."),
"unselect_all": _("Unselect All"),
},
"status": {
"disable": _("Disable"),
"disabled": _("Disabled"),
"enable": _("Enable"),
"enabled": _("Enabled"),
"label": _("Status"),
},
"tabs": {
"audit": _("Audit"),
"automount": _("Automount"),