diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-11-09 18:48:04 -0600 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-11-14 16:47:10 -0500 |
commit | 20ad8fe1ba9b4a0f8ca9e365ac782895f6698c71 (patch) | |
tree | 1b55c708fbb6cdee93f9e194586a8dbe9633ff3d /install/ui | |
parent | d6d24be28953f2ec3cf1f2400619fd61459cf45f (diff) | |
download | freeipa-20ad8fe1ba9b4a0f8ca9e365ac782895f6698c71.tar.gz freeipa-20ad8fe1ba9b4a0f8ca9e365ac782895f6698c71.tar.xz freeipa-20ad8fe1ba9b4a0f8ca9e365ac782895f6698c71.zip |
Removed develop.js.
The develop.js is no longer necessary because the code in it has
been merged into the main code.
An empty extension.js has been added to provide a place for UI
customization.
Ticket #2099
Diffstat (limited to 'install/ui')
-rw-r--r-- | install/ui/Makefile.am | 1 | ||||
-rw-r--r-- | install/ui/aci.js | 12 | ||||
-rw-r--r-- | install/ui/details.js | 9 | ||||
-rw-r--r-- | install/ui/develop.js | 13 | ||||
-rw-r--r-- | install/ui/extension.js | 0 | ||||
-rw-r--r-- | install/ui/host.js | 12 | ||||
-rw-r--r-- | install/ui/index.html | 1 | ||||
-rw-r--r-- | install/ui/ipa.js | 44 | ||||
-rw-r--r-- | install/ui/jsl.conf | 1 | ||||
-rw-r--r-- | install/ui/test/aci_tests.js | 11 | ||||
-rw-r--r-- | install/ui/test/details_tests.js | 11 | ||||
-rw-r--r-- | install/ui/test/entity_tests.js | 11 | ||||
-rw-r--r-- | install/ui/test/ipa_tests.js | 11 | ||||
-rw-r--r-- | install/ui/test/navigation_tests.js | 11 | ||||
-rw-r--r-- | install/ui/test/widget_tests.js | 11 | ||||
-rw-r--r-- | install/ui/webui.js | 8 |
16 files changed, 76 insertions, 91 deletions
diff --git a/install/ui/Makefile.am b/install/ui/Makefile.am index 8e1ec46fb..2ec047c34 100644 --- a/install/ui/Makefile.am +++ b/install/ui/Makefile.am @@ -18,6 +18,7 @@ app_DATA = \ dns.js \ entitle.js \ entity.js \ + extension.js \ facet.js \ favicon.ico \ group.js \ diff --git a/install/ui/aci.js b/install/ui/aci.js index cae067040..b63660da3 100644 --- a/install/ui/aci.js +++ b/install/ui/aci.js @@ -36,6 +36,7 @@ IPA.aci.permission_entity = function(spec) { columns: [ 'cn' ] }). details_facet({ + factory: IPA.aci.permission_details_facet, sections: [ { name: 'identity', @@ -90,6 +91,17 @@ IPA.aci.permission_entity = function(spec) { return that; }; +IPA.aci.permission_details_facet = function(spec) { + + var that = IPA.details_facet(spec); + + that.get_refresh_command_name = function() { + return that.entity.name+'_show_'+that.pkey; + }; + + return that; +}; + IPA.aci.privilege_entity = function(spec) { var that = IPA.entity(spec); diff --git a/install/ui/details.js b/install/ui/details.js index fd3570e1c..440a9b7d9 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -800,20 +800,21 @@ IPA.details_facet = function(spec) { command.execute(); }; + that.get_refresh_command_name = function() { + return that.entity.name+'_show'; + }; + that.refresh = function() { that.pkey = IPA.nav.get_state(that.entity.name+'-pkey'); var command = IPA.command({ + name: that.get_refresh_command_name(), entity: that.entity.name, method: 'show', options: { all: true, rights: true } }); - if (IPA.details_refresh_devel_hook) { - IPA.details_refresh_devel_hook(that.entity.name, command, that.pkey); - } - if (that.pkey) { command.args = that.get_primary_key(true); diff --git a/install/ui/develop.js b/install/ui/develop.js index 9f0c8dd5a..e69de29bb 100644 --- a/install/ui/develop.js +++ b/install/ui/develop.js @@ -1,13 +0,0 @@ -/*jsl:import ipa.js */ - -if (window.location.protocol == 'file:') { - IPA.json_url = "test/data"; - IPA.use_static_files = true; - - IPA.details_refresh_devel_hook = function(entity_name,command,pkey){ - if ((entity_name === 'host')||(entity_name === 'permission')){ - command.name = entity_name+'_show_'+pkey; - command.method = entity_name+'_show'; - } - }; -} diff --git a/install/ui/extension.js b/install/ui/extension.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/install/ui/extension.js diff --git a/install/ui/host.js b/install/ui/host.js index 857f85434..ab33892c6 100644 --- a/install/ui/host.js +++ b/install/ui/host.js @@ -43,6 +43,7 @@ IPA.host.entity = function(spec) { ] }). details_facet({ + factory: IPA.host.details_facet, sections: [ { name: 'details', @@ -176,6 +177,17 @@ IPA.host.entity = function(spec) { return that; }; +IPA.host.details_facet = function(spec) { + + var that = IPA.details_facet(spec); + + that.get_refresh_command_name = function() { + return that.entity.name+'_show_'+that.pkey; + }; + + return that; +}; + IPA.host_fqdn_section = function(spec) { spec = spec || {}; diff --git a/install/ui/index.html b/install/ui/index.html index cb014815b..25e910ed0 100644 --- a/install/ui/index.html +++ b/install/ui/index.html @@ -39,7 +39,6 @@ <script type="text/javascript" src="entitle.js"></script> <script type="text/javascript" src="extension.js"></script> - <script type="text/javascript" src="develop.js"></script> <script type="text/javascript" src="webui.js"></script> <link rel="stylesheet" type="text/css" href="jquery-ui.css" /> diff --git a/install/ui/ipa.js b/install/ui/ipa.js index 4dd627ff2..c6d39478a 100644 --- a/install/ui/ipa.js +++ b/install/ui/ipa.js @@ -31,11 +31,8 @@ var IPA = function() { jsonrpc_id: 0 }; - that.use_static_files = false; - that.json_url = '/ipa/json'; - if (that.use_static_files){ - that.json_url = 'test/data'; - } + // live server path + that.url = '/ipa/ui/'; that.ajax_options = { type: 'POST', @@ -54,16 +51,15 @@ var IPA = function() { that.network_call_count = 0; - /* initialize the IPA JSON-RPC helper - * arguments: - * url - JSON-RPC URL to use (optional) */ - that.init = function (url, use_static_files, on_success, on_error) { - if (url) { - that.json_url = url; - } + /* initialize the IPA JSON-RPC helper */ + that.init = function(params) { - if (use_static_files) { - that.use_static_files = use_static_files; + // if current path matches live server path, use live data + if (that.url && window.location.pathname.substring(0, that.url.length) === that.url) { + that.json_url = params.url || '/ipa/json'; + + } else { // otherwise use fixtures + that.json_path = params.url || "test/data"; } $.ajaxSetup(that.ajax_options); @@ -75,7 +71,6 @@ var IPA = function() { methodname: 'all' }, on_success: function(data, text_status, xhr) { - if(!that.metadata) that.metadata = {}; that.metadata.methods = data.result.methods; } }); @@ -87,7 +82,6 @@ var IPA = function() { objname: 'all' }, on_success: function(data, text_status, xhr) { - if(!that.metadata) that.metadata = {}; that.metadata.objects = data.result.objects; } }); @@ -97,7 +91,7 @@ var IPA = function() { methods, objects ], - on_success: on_success + on_success: params.on_success }); var batch = IPA.batch_command({ @@ -125,8 +119,8 @@ var IPA = function() { dialog.on_cancel = function() { dialog.close(); - if (on_error) { - on_error.call(ajax, xhr, text_status, error_thrown); + if (params.on_error) { + params.on_error.call(ajax, xhr, text_status, error_thrown); } }; @@ -446,21 +440,13 @@ IPA.command = function(spec) { } } - var url = IPA.json_url; - - var command = that.get_command(); - - if (IPA.use_static_files) { - url += '/' + (that.name ? that.name : command) + '.json'; - } - var data = { - method: command, + method: that.get_command(), params: [that.args, that.options] }; var request = { - url: url, + url: IPA.json_url || IPA.json_path + '/' + (that.name || data.method) + '.json', data: JSON.stringify(data), success: success_handler, error: error_handler diff --git a/install/ui/jsl.conf b/install/ui/jsl.conf index 675e4b6c1..a49279263 100644 --- a/install/ui/jsl.conf +++ b/install/ui/jsl.conf @@ -150,7 +150,6 @@ +process sudo.js +process policy.js +process aci.js -+process develop.js +process dns.js +process automount.js +process webui.js diff --git a/install/ui/test/aci_tests.js b/install/ui/test/aci_tests.js index 2ff1acddd..b050b7476 100644 --- a/install/ui/test/aci_tests.js +++ b/install/ui/test/aci_tests.js @@ -26,15 +26,12 @@ var entity = {name:'bogus'}; module('aci',{ setup: function() { IPA.ajax_options.async = false; - IPA.init( - "data", - true, - function(data, text_status, xhr) { - }, - function(xhr, text_status, error_thrown) { + IPA.init({ + url: 'data', + on_error: function(xhr, text_status, error_thrown) { ok(false, "ipa_init() failed: "+error_thrown); } - ); + }); target_container = $('<div id="target"/>').appendTo(document.body); target_section = IPA.permission_target_section({ diff --git a/install/ui/test/details_tests.js b/install/ui/test/details_tests.js index 122234e78..c6a55cda9 100644 --- a/install/ui/test/details_tests.js +++ b/install/ui/test/details_tests.js @@ -25,15 +25,12 @@ module('details', { setup: function() { IPA.ajax_options.async = false; - IPA.init( - "data", - true, - function(data, text_status, xhr) { - }, - function(xhr, text_status, error_thrown) { + IPA.init({ + url: 'data', + on_error: function(xhr, text_status, error_thrown) { ok(false, "ipa_init() failed: "+error_thrown); } - ); + }); IPA.nav = {}; diff --git a/install/ui/test/entity_tests.js b/install/ui/test/entity_tests.js index 12a1fcae2..84a5e28fe 100644 --- a/install/ui/test/entity_tests.js +++ b/install/ui/test/entity_tests.js @@ -27,10 +27,9 @@ module('entity',{ IPA.ajax_options.async = false; - IPA.init( - "data", - true, - function(data, text_status, xhr) { + IPA.init({ + url: 'data', + on_success: function(data, text_status, xhr) { IPA.entity_factories.user = function(){ return IPA. @@ -41,10 +40,10 @@ module('entity',{ build(); }; }, - function(xhr, text_status, error_thrown) { + on_error: function(xhr, text_status, error_thrown) { ok(false, "ipa_init() failed: "+error_thrown); } - ); + }); entities_container = $('<div id="entities"/>').appendTo(document.body); diff --git a/install/ui/test/ipa_tests.js b/install/ui/test/ipa_tests.js index 8b3efc708..372f76879 100644 --- a/install/ui/test/ipa_tests.js +++ b/install/ui/test/ipa_tests.js @@ -26,16 +26,15 @@ test("Testing ipa_init().", function() { IPA.ajax_options.async = false; - IPA.init( - "data", - true, - function(data, text_status, xhr) { + IPA.init({ + url: 'data', + on_success: function(data, text_status, xhr) { ok(true, "ipa_init() succeeded."); }, - function(xhr, text_status, error_thrown) { + on_error: function(xhr, text_status, error_thrown) { ok(false, "ipa_init() failed: "+error_thrown); } - ); + }); }); test("Testing IPA.get_entity_param().", function() { diff --git a/install/ui/test/navigation_tests.js b/install/ui/test/navigation_tests.js index 6df1926c3..92a23eebe 100644 --- a/install/ui/test/navigation_tests.js +++ b/install/ui/test/navigation_tests.js @@ -23,15 +23,12 @@ module('navigation', { setup: function() { IPA.ajax_options.async = false; - IPA.init( - 'data', - true, - function(data, text_status, xhr) { - }, - function(xhr, text_status, error_thrown) { + IPA.init({ + url: 'data', + on_error: function(xhr, text_status, error_thrown) { ok(false, 'ipa_init() failed: '+error_thrown); } - ); + }); } }); diff --git a/install/ui/test/widget_tests.js b/install/ui/test/widget_tests.js index 50a5f7d6f..4549d5a94 100644 --- a/install/ui/test/widget_tests.js +++ b/install/ui/test/widget_tests.js @@ -28,15 +28,12 @@ var spec; module('widget',{ setup: function() { IPA.ajax_options.async = false; - IPA.init( - "data", - true, - function(data, text_status, xhr) { - }, - function(xhr, text_status, error_thrown) { + IPA.init({ + url: 'data', + on_error: function(xhr, text_status, error_thrown) { ok(false, "ipa_init() failed: "+error_thrown); } - ); + }); widget_container = $('<div id="widget"/>').appendTo(document.body); widget = null; diff --git a/install/ui/webui.js b/install/ui/webui.js index daa22b22a..6490a446f 100644 --- a/install/ui/webui.js +++ b/install/ui/webui.js @@ -153,7 +153,7 @@ $(function() { } - function init_on_win(data, text_status, xhr) { + function init_on_success(data, text_status, xhr) { $(window).bind('hashchange', window_hashchange); var whoami = IPA.whoami; @@ -176,6 +176,8 @@ $(function() { container.append('<p>'+error_thrown.message+'</p>'); } - IPA.init(null, null, init_on_win, init_on_error); - + IPA.init({ + on_success: init_on_success, + on_error: init_on_error + }); }); |