webui: support standalone facets in navigation module

One can access standard standalone facets with:
  `navigation.show('facet_name')`
and completely custom facets with low level call:
  `navigation.show_generic('/custom/hash', facet)``

Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
This commit is contained in:
Petr Vobornik 2014-05-16 18:19:19 +02:00
parent c6c7dfeefb
commit 27836cba9d

View File

@ -77,7 +77,7 @@ define([
* type. * type.
* *
* When facet is defined as a string it has to be registered in * When facet is defined as a string it has to be registered in
* facet register. //FIXME: not yet implemented * facet register.
* *
* When it's an object (Facet) and has an entity set it will be * When it's an object (Facet) and has an entity set it will be
* dealt as entity facet. * dealt as entity facet.
@ -98,9 +98,7 @@ define([
var facet = params.facet; var facet = params.facet;
if (typeof facet === 'string') { if (typeof facet === 'string') {
// FIXME: doesn't work at the moment nav.navigate_to_facet(facet, params.args);
throw 'Not yet supported';
//facet = IPA.get_facet(facet);
} }
if (!facet) throw 'Argument exception: missing facet'; if (!facet) throw 'Argument exception: missing facet';
@ -140,6 +138,22 @@ define([
params.pkeys, params.args); params.pkeys, params.args);
}, },
/**
* Uses lower level access
*
* `experimental`
*
* Navigates to generic page by changing hash.
*
* @param {string} hash Hash of the change
* @param {Object} [facet] Facet we are navigating to. Usually used for
* notification purposes
*/
show_generic: function(hash, facet) {
var nav = get_router();
nav.navigate_to_hash(hash, facet);
},
/** /**
* Show default facet * Show default facet
* @method show_default * @method show_default