summaryrefslogtreecommitdiffstats
path: root/install/ui/src/freeipa/plugins
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2015-06-05 19:03:46 +0200
committerTomas Babej <tbabej@redhat.com>2015-07-03 10:42:16 +0200
commit2a976334c2160c91a61fb0c477777e7adbbd3150 (patch)
treec72de1426f0eb19855c559a295ab30c13f125d76 /install/ui/src/freeipa/plugins
parent392809f9847eee21c8022f53153463033cd53966 (diff)
downloadfreeipa-2a976334c2160c91a61fb0c477777e7adbbd3150.tar.gz
freeipa-2a976334c2160c91a61fb0c477777e7adbbd3150.tar.xz
freeipa-2a976334c2160c91a61fb0c477777e7adbbd3150.zip
webui: API browser
First part of API browser - displaying metadata in more consumable way. https://fedorahosted.org/freeipa/ticket/3129 Reviewed-By: Martin Kosek <mkosek@redhat.com> Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'install/ui/src/freeipa/plugins')
-rw-r--r--install/ui/src/freeipa/plugins/api_browser.js106
1 files changed, 106 insertions, 0 deletions
diff --git a/install/ui/src/freeipa/plugins/api_browser.js b/install/ui/src/freeipa/plugins/api_browser.js
new file mode 100644
index 000000000..88dbe59c7
--- /dev/null
+++ b/install/ui/src/freeipa/plugins/api_browser.js
@@ -0,0 +1,106 @@
+//
+// Copyright (C) 2015 FreeIPA Contributors see COPYING for license
+//
+
+define(['dojo/_base/declare',
+ 'dojo/_base/lang',
+ 'dojo/on',
+ '../facets/Facet',
+ '../phases',
+ '../reg',
+ '../widget',
+ '../widgets/APIBrowserWidget',
+ '../builder'
+ ],
+
+ function(declare, lang, on, Facet, phases, reg, widget,
+ APIBrowserWidget, builder) {
+
+
+var plugins = {}; // dummy namespace object
+
+/**
+ * API browser plugin
+ *
+ * @class
+ * @singleton
+ */
+plugins.api_browser = {};
+
+plugins.api_browser.facet_spec = {
+ name: 'apibrowser',
+ 'class': 'apibrowser container-fluid',
+ widgets: [
+ {
+ $type: 'activity',
+ name: 'activity',
+ text: 'Working',
+ visible: false
+ },
+ {
+ $type: 'apibrowser',
+ name: 'apibrowser'
+ }
+ ]
+};
+
+/**
+ * API browser facet
+ * @class
+ */
+plugins.api_browser.APIBrowserFacet = declare([Facet], {
+
+ init: function(spec) {
+ this.inherited(arguments);
+ var browser = this.get_widget('apibrowser');
+
+ on(this, 'show', lang.hitch(this, function(args) {
+
+ var state = this.get_state();
+ var t = state.type;
+ var n = state.name;
+
+ if (t && n) {
+ browser.show_item(t, n);
+ return;
+ } else if (t) {
+ if (t == 'command') {
+ browser.show_default_command();
+ return;
+ } else {
+ browser.show_default_object();
+ return;
+ }
+ }
+ browser.show_default();
+ return;
+ }));
+
+ // Reflect item change in facet state and therefore URL hash
+ browser.watch('current', lang.hitch(this, function(name, old, value) {
+ var state = {};
+ if (value.type && value.name) {
+ state = { type: value.type, name: value.name };
+ }
+ this.set_state(state);
+ }));
+ }
+});
+
+phases.on('registration', function() {
+
+ var fa = reg.facet;
+ var w = reg.widget;
+
+ w.register('apibrowser', APIBrowserWidget);
+
+ fa.register({
+ type: 'apibrowser',
+ factory: plugins.api_browser.APIBrowserFacet,
+ spec: plugins.api_browser.facet_spec
+ });
+});
+
+return plugins.api_browser;
+
+}); \ No newline at end of file