Show disabled entries in gray.

The users, HBAC/sudo rules, HBAC test, and SELinux list pages have
been modified to show disabled entries in gray. Icons will be added
separately.

Ticket #1996
This commit is contained in:
Endi Sukma Dewata 2012-01-18 17:58:55 -06:00 committed by Petr Voborník
parent 7c0c39581c
commit fef343ae8f
14 changed files with 239 additions and 16 deletions

View File

@ -413,6 +413,9 @@ IPA.table_facet = function(spec) {
that.search_all_attributes = spec.search_all_attributes;
that.selectable = spec.selectable === undefined ? true : spec.selectable;
that.row_enabled_attribute = spec.row_enabled_attribute;
that.row_disabled_attribute = spec.row_disabled_attribute;
that.columns = $.ordered_map();
var init = function() {
@ -605,11 +608,31 @@ IPA.table_facet = function(spec) {
that.load_records = function(records) {
that.table.empty();
for (var i=0; i<records.length; i++) {
that.table.add_record(records[i]);
that.add_record(records[i]);
}
that.table.set_values(that.selected_values);
};
that.add_record = function(record) {
var tr = that.table.add_record(record);
var attribute;
if (that.row_enabled_attribute) {
attribute = that.row_enabled_attribute;
} else if (that.row_disabled_attribute) {
attribute = that.row_disabled_attribute;
} else {
return;
}
var value = record[attribute];
var column = that.table.get_column(attribute);
if (column.format) value = column.format.parse(value);
that.table.set_row_enabled(tr, value);
};
that.get_records_command_name = function() {
return that.managed_entity.name+'_get_records';
};

View File

@ -37,12 +37,15 @@ IPA.hbac.rule_entity = function(spec) {
that.entity_init();
that.builder.search_facet({
row_enabled_attribute: 'ipaenabledflag',
search_all_attributes: true,
columns: [
'cn',
{
name: 'ipaenabledflag',
format: IPA.boolean_format()
format: IPA.boolean_format({
show_false: true
})
},
'description'
]

View File

@ -43,6 +43,7 @@ IPA.hbac.test_entity = function(spec) {
managed_entity: 'user',
disable_breadcrumb: true,
facet_group: 'default',
row_disabled_attribute: 'nsaccountlock',
columns: [
'uid',
'givenname',
@ -52,7 +53,8 @@ IPA.hbac.test_entity = function(spec) {
format: IPA.boolean_format({
true_value: IPA.messages.objects.user.active,
false_value: IPA.messages.objects.user.inactive,
invert_value: true
invert_value: true,
show_false: true
}),
label: IPA.messages.objects.user.account_status
}
@ -111,11 +113,14 @@ IPA.hbac.test_entity = function(spec) {
managed_entity: 'hbacrule',
disable_breadcrumb: true,
facet_group: 'default',
row_enabled_attribute: 'ipaenabledflag',
columns: [
'cn',
{
name: 'ipaenabledflag',
format: IPA.boolean_format()
format: IPA.boolean_format({
show_false: true
})
},
'description'
]
@ -127,6 +132,7 @@ IPA.hbac.test_entity = function(spec) {
managed_entity: 'hbacrule',
disable_breadcrumb: true,
facet_group: 'default',
row_enabled_attribute: 'ipaenabledflag',
columns: [
'cn',
{
@ -136,7 +142,9 @@ IPA.hbac.test_entity = function(spec) {
},
{
name: 'ipaenabledflag',
format: IPA.boolean_format()
format: IPA.boolean_format({
show_false: true
})
},
'description'
]

View File

@ -659,6 +659,10 @@ div[name=settings].facet-group li a {
bottom: 35px;
}
.content-table tbody tr.disabled {
color: gray;
}
.search-filter {
width: 215px;
-moz-border-radius: 15px !important;

View File

@ -35,13 +35,16 @@ IPA.selinux.selinuxusermap_entity = function(spec) {
that.entity_init();
that.builder.search_facet({
row_enabled_attribute: 'ipaenabledflag',
search_all_attributes: true,
columns: [
'cn',
'ipaselinuxuser',
{
name: 'ipaenabledflag',
format: IPA.boolean_format()
format: IPA.boolean_format({
show_false: true
})
},
'description'
]

View File

@ -36,11 +36,14 @@ IPA.sudo.rule_entity = function(spec) {
that.entity_init();
that.builder.search_facet({
row_enabled_attribute: 'ipaenabledflag',
columns: [
'cn',
{
name: 'ipaenabledflag',
format: IPA.boolean_format()
format: IPA.boolean_format({
show_false: true
})
},
'description'
]

View File

@ -52,6 +52,9 @@
"cn": [
"rule01"
],
"description": [
"Test HBAC Rule 01"
],
"dn": "ipauniqueid=ce568648-211c-11e1-8846-000c29e9f1b6,cn=hbac,dc=example,dc=com",
"hostcategory": [
"all"
@ -88,6 +91,9 @@
"cn": [
"rule02"
],
"description": [
"Test HBAC Rule 02"
],
"dn": "ipauniqueid=d0133224-211c-11e1-b881-000c29e9f1b6,cn=hbac,dc=example,dc=com",
"hostcategory": [
"all"
@ -124,6 +130,9 @@
"cn": [
"rule03"
],
"description": [
"Test HBAC Rule 03"
],
"dn": "ipauniqueid=d21db45e-211c-11e1-bef8-000c29e9f1b6,cn=hbac,dc=example,dc=com",
"hostcategory": [
"all"
@ -160,6 +169,9 @@
"cn": [
"rule04"
],
"description": [
"Test HBAC Rule 04"
],
"dn": "ipauniqueid=d4209604-211c-11e1-9192-000c29e9f1b6,cn=hbac,dc=example,dc=com",
"hostcategory": [
"all"
@ -196,6 +208,9 @@
"cn": [
"rule05"
],
"description": [
"Test HBAC Rule 05"
],
"dn": "ipauniqueid=d59dba70-211c-11e1-9ce3-000c29e9f1b6,cn=hbac,dc=example,dc=com",
"hostcategory": [
"all"

View File

@ -9,9 +9,15 @@
"karel_unconfined"
],
"dn": "ipauniqueid=dbe2ffa0-3c2c-11e1-ad81-00163e6185c4,cn=usermap,cn=selinux,dc=dev,dc=example,dc=com"
},
{
"cn": [
"test01"
],
"dn": "ipauniqueid=dbe2ffa0-3c2c-11e1-ad81-00163e6185c4,cn=usermap,cn=selinux,dc=dev,dc=example,dc=com"
}
],
"summary": "1 SELinux User Map matched",
"summary": "2 SELinux User Maps matched",
"truncated": false
}
}

View File

@ -33,6 +33,36 @@
},
"summary": null,
"value": "karel_unconfined"
},
{
"error": null,
"result": {
"cn": [
"test01"
],
"description": [
"Test SELinux User Map 01"
],
"dn": "ipauniqueid=dbe2ffa0-3c2c-11e1-ad81-00163e6185c4,cn=usermap,cn=selinux,dc=dev,dc=example,dc=com",
"ipaenabledflag": [
"FALSE"
],
"ipaselinuxuser": [
"xguest_u:s0"
],
"ipauniqueid": [
"dbe2ffa0-3c2c-11e1-ad81-00163e6185c4"
],
"memberuser_user": [
"karel"
],
"objectclass": [
"ipaassociation",
"ipaselinuxusermap"
]
},
"summary": null,
"value": "test01"
}
]
}

View File

@ -6,7 +6,13 @@
"result": [
{
"cn": [
"test"
"test01"
],
"dn": "ipauniqueid=4fc57a02-f23311df-b268e50e-a3b3ef71,cn=sudorules,cn=sudo,dc=example,dc=com"
},
{
"cn": [
"test02"
],
"dn": "ipauniqueid=4fc57a02-f23311df-b268e50e-a3b3ef71,cn=sudorules,cn=sudo,dc=example,dc=com"
}

View File

@ -33,7 +33,10 @@
"usercategory": "rscwo"
},
"cn": [
"test"
"test01"
],
"description": [
"Test Sudo Rule 01"
],
"dn": "ipauniqueid=4fc57a02-f23311df-b268e50e-a3b3ef71,cn=sudorules,cn=sudo,dc=example,dc=com",
"externalhost": [
@ -90,7 +93,98 @@
]
},
"summary": null,
"value": "test"
"value": "test01"
},
{
"error": null,
"result": {
"attributelevelrights": {
"aci": "rscwo",
"cmdcategory": "rscwo",
"cn": "rscwo",
"description": "rscwo",
"externalhost": "rscwo",
"externaluser": "rscwo",
"hostcategory": "rscwo",
"hostmask": "rscwo",
"ipaenabledflag": "rscwo",
"ipasudoopt": "rscwo",
"ipasudorunas": "rscwo",
"ipasudorunasextgroup": "rscwo",
"ipasudorunasextuser": "rscwo",
"ipasudorunasgroup": "rscwo",
"ipasudorunasgroupcategory": "rscwo",
"ipasudorunasusercategory": "rscwo",
"ipauniqueid": "rsc",
"memberallowcmd": "rscwo",
"memberdenycmd": "rscwo",
"memberhost": "rscwo",
"memberuser": "rscwo",
"nsaccountlock": "rscwo",
"usercategory": "rscwo"
},
"cn": [
"test02"
],
"description": [
"Test Sudo Rule 02"
],
"dn": "ipauniqueid=4fc57a02-f23311df-b268e50e-a3b3ef71,cn=sudorules,cn=sudo,dc=example,dc=com",
"externalhost": [
"external.example.com"
],
"externaluser": [
"external"
],
"ipaenabledflag": [
"FALSE"
],
"ipasudoopt": [
"-H",
"-b"
],
"ipasudorunas_user": [
"admin"
],
"ipasudorunasgroup_group": [
"admins"
],
"ipauniqueid": [
"4fc57a02-f23311df-b268e50e-a3b3ef71"
],
"memberallowcmd_sudocmd": [
"/usr/bin/less"
],
"memberallowcmd_sudocmdgroup": [
"group1"
],
"memberdenycmd_sudocmd": [
"/usr/bin/more"
],
"memberdenycmd_sudocmdgroup": [
"group1",
"group2"
],
"memberhost_host": [
"dev.example.com"
],
"memberhost_hostgroup": [
"production",
"staging"
],
"memberuser_group": [
"editors"
],
"memberuser_user": [
"test"
],
"objectclass": [
"ipaassociation",
"ipasudorule"
]
},
"summary": null,
"value": "test02"
}
]
}

View File

@ -610,7 +610,7 @@
"mepmanagedentry": [
"cn=aortega,cn=groups,cn=accounts,dc=example,dc=com"
],
"nsaccountlock": false,
"nsaccountlock": true,
"objectclass": [
"top",
"person",
@ -681,7 +681,7 @@
"mepmanagedentry": [
"cn=aortiz,cn=groups,cn=accounts,dc=example,dc=com"
],
"nsaccountlock": false,
"nsaccountlock": true,
"objectclass": [
"top",
"person",
@ -1107,7 +1107,7 @@
"mepmanagedentry": [
"cn=bbauer,cn=groups,cn=accounts,dc=example,dc=com"
],
"nsaccountlock": false,
"nsaccountlock": true,
"objectclass": [
"top",
"person",

View File

@ -36,6 +36,7 @@ IPA.user.entity = function(spec) {
var link = self_service ? false : undefined;
that.builder.search_facet({
row_disabled_attribute: 'nsaccountlock',
columns: [
'uid',
'givenname',
@ -45,7 +46,8 @@ IPA.user.entity = function(spec) {
format: IPA.boolean_format({
true_value: IPA.messages.objects.user.active,
false_value: IPA.messages.objects.user.inactive,
invert_value: true
invert_value: true,
show_false: true
}),
label: IPA.messages.objects.user.account_status
},

View File

@ -947,6 +947,12 @@ IPA.format = function(spec) {
var that = {};
// parse attribute value into a normalized value
that.parse = function(value) {
return value;
};
// format normalized value
that.format = function(value) {
return value;
};
@ -965,7 +971,8 @@ IPA.boolean_format = function(spec) {
that.show_false = spec.show_false;
that.invert_value = spec.invert_value;
that.format = function(value) {
// convert string boolean value into real boolean value, or keep the original value
that.parse = function(value) {
if (value === undefined || value === null) return '';
@ -985,7 +992,15 @@ IPA.boolean_format = function(spec) {
if (typeof value === 'boolean') {
if (that.invert_value) value = !value;
}
return value;
};
// convert boolean value into formatted string, or keep the original value
that.format = function(value) {
if (typeof value === 'boolean') {
if (value) {
value = that.true_value;
@ -1035,6 +1050,7 @@ IPA.column = function (spec) {
var value = record[that.name];
if (that.format) {
value = that.format.parse(value);
value = that.format.format(value);
}
value = value ? value.toString() : '';
@ -1482,6 +1498,16 @@ IPA.table_widget = function (spec) {
that.setup_column(column, div, record);
}
return tr;
};
that.set_row_enabled = function(tr, enabled) {
if (enabled) {
tr.removeClass('disabled');
} else {
tr.addClass('disabled');
}
};
that.setup_column = function(column, div, record) {