webui: hide applied to hosts tab for Default Trust View

because applying Default Trust view on hosts is not allowed

https://fedorahosted.org/freeipa/ticket/4615

Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
This commit is contained in:
Petr Vobornik 2014-10-10 10:49:43 +02:00
parent 2e27f1ee69
commit d3f46d4e78
2 changed files with 29 additions and 2 deletions

View File

@ -211,7 +211,8 @@ exp.facet = IPA.facet = function(spec, no_init) {
* Facet header
* @property {facet.facet_header}
*/
that.header = spec.header || IPA.facet_header({ facet: that });
that.header = builder.build('', spec.header || {}, {},
{ $pre_ops: [{ facet: that }], $factory: IPA.facet_header });
/**
* Hard override for `needs_update()` logic. When set, `needs_update`
@ -1400,6 +1401,8 @@ exp.facet_header = IPA.facet_header = function(spec) {
that.load();
};
that.facet_header_set_pkey = that.set_pkey;
return that;
};

View File

@ -37,7 +37,9 @@ define([
* @class
* @singleton
*/
var idviews = IPA.idviews = {};
var idviews = IPA.idviews = {
DEFAULT_TRUST_VIEW: 'Default Trust View'
};
var make_spec = function() {
return {
@ -82,6 +84,7 @@ return {
},
{
$type: 'details',
header: idviews.idview_facet_header,
actions: [
'delete'
],
@ -104,6 +107,7 @@ return {
{
$type: 'nested_search',
facet_group: 'overrides',
header: idviews.idview_facet_header,
nested_entity: 'idoverrideuser',
search_all_entries: true,
label: '@mo:idoverrideuser.label',
@ -123,6 +127,7 @@ return {
{
$type: 'nested_search',
facet_group: 'overrides',
header: idviews.idview_facet_header,
nested_entity: 'idoverridegroup',
search_all_entries: true,
label: '@mo:idoverridegroup.label',
@ -371,6 +376,25 @@ idviews.appliedtohosts_facet = function(spec, no_init) {
return that;
};
idviews.idview_facet_header = function(spec) {
var that = mod_facet.facet_header(spec);
/**
* Set pkeys and hides 'appliedtohosts' facet for 'Default Trust View'
* @param {string} value pkey
*/
that.set_pkey = function(value) {
that.facet_header_set_pkey(value);
var display = value === idviews.DEFAULT_TRUST_VIEW ? 'none' : '';
$('.facet-group[name="appliedto"]', that.facet_tabs).
css('display', display);
};
return that;
};
/**
* Apply Id view on hosts on hostgroup action base class
*