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
This commit is contained in:
Endi S. Dewata 2011-11-09 18:48:04 -06:00 committed by Adam Young
parent d6d24be289
commit 20ad8fe1ba
17 changed files with 80 additions and 91 deletions

View File

@ -516,6 +516,7 @@ fi
%{_usr}/share/ipa/ui/*.svg
%{_usr}/share/ipa/ui/*.ttf
%{_usr}/share/ipa/ui/*.woff
%config(noreplace) %{_usr}/share/ipa/ui/extension.js
%dir %{_usr}/share/ipa/ui/images
%{_usr}/share/ipa/ui/images/*.png
%{_usr}/share/ipa/ui/images/*.gif
@ -617,6 +618,9 @@ fi
%ghost %attr(0644,root,apache) %config(noreplace) %{_sysconfdir}/ipa/default.conf
%changelog
* Wed Nov 14 2011 Endi S. Dewata <edewata@redhat.com> - 2.99.0-11
- Make sure changes to extension.js are not removed.
* Wed Oct 26 2011 Endi S. Dewata <edewata@redhat.com> - 2.99.0-10
- Moved UI images into install/ui/images

View File

@ -18,6 +18,7 @@ app_DATA = \
dns.js \
entitle.js \
entity.js \
extension.js \
facet.js \
favicon.ico \
group.js \

View File

@ -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);

View File

@ -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);

View File

@ -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';
}
};
}

0
install/ui/extension.js Normal file
View File

View File

@ -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 || {};

View File

@ -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" />

View File

@ -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

View File

@ -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

View File

@ -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({

View File

@ -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 = {};

View File

@ -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);

View File

@ -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() {

View File

@ -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);
}
);
});
}
});

View File

@ -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;

View File

@ -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
});
});