2011-01-28 15:46:19 -06:00
|
|
|
/*jsl:import ipa.js */
|
|
|
|
/* Authors:
|
|
|
|
* Endi Sukma Dewata <edewata@redhat.com>
|
2011-11-23 09:57:57 -06:00
|
|
|
* Petr Vobornik <pvoborni@redhat.com>
|
2011-01-28 15:46:19 -06:00
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Red Hat
|
|
|
|
* see file 'COPYING' for use and warranty information
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2011-11-23 09:57:57 -06:00
|
|
|
/* REQUIRES: widget.js, details.js */
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-09-28 15:56:25 -05:00
|
|
|
IPA.dialog_button = function(spec) {
|
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
|
|
|
var that = {};
|
|
|
|
|
|
|
|
that.name = spec.name;
|
|
|
|
that.label = spec.label || spec.name;
|
|
|
|
that.click = spec.click || click;
|
2012-02-27 08:31:20 -06:00
|
|
|
that.visible = spec.visible !== undefined ? spec.visible : true;
|
2011-09-28 15:56:25 -05:00
|
|
|
|
|
|
|
function click() {
|
|
|
|
}
|
|
|
|
|
|
|
|
that.set_enabled = function(enabled) {
|
|
|
|
if (enabled) {
|
|
|
|
that.element.removeClass('ui-state-disabled');
|
|
|
|
} else {
|
|
|
|
that.element.addClass('ui-state-disabled');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
that.is_enabled = function() {
|
|
|
|
return !that.element.hasClass('ui-state-disabled');
|
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
/**
|
|
|
|
* This is a base class for dialog boxes.
|
|
|
|
*/
|
|
|
|
IPA.dialog = function(spec) {
|
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
|
|
|
var that = {};
|
|
|
|
|
2011-11-07 14:21:45 -06:00
|
|
|
that.entity = IPA.get_entity(spec.entity);
|
2012-07-19 07:47:48 -05:00
|
|
|
that.name = spec.name || 'dialog';
|
2011-08-05 10:12:21 -05:00
|
|
|
that.id = spec.id;
|
2011-01-28 15:46:19 -06:00
|
|
|
that.title = spec.title;
|
2011-09-27 16:19:51 -05:00
|
|
|
that.width = spec.width || 500;
|
2011-03-07 12:35:11 -06:00
|
|
|
that.height = spec.height;
|
2012-03-01 06:58:21 -06:00
|
|
|
that.close_on_escape = spec.close_on_escape !== undefined ?
|
|
|
|
spec.close_on_escape : true;
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-11-22 10:33:09 -06:00
|
|
|
that.widgets = IPA.widget_container();
|
|
|
|
that.fields = IPA.field_container({ container: that });
|
2011-09-28 15:56:25 -05:00
|
|
|
that.buttons = $.ordered_map();
|
2011-11-23 09:57:57 -06:00
|
|
|
that.policies = IPA.facet_policies({
|
|
|
|
container: that,
|
|
|
|
policies: spec.policies
|
|
|
|
});
|
2011-05-27 10:32:17 -05:00
|
|
|
|
2011-09-28 15:56:25 -05:00
|
|
|
that.create_button = function(spec) {
|
|
|
|
var factory = spec.factory || IPA.dialog_button;
|
|
|
|
var button = factory(spec);
|
|
|
|
that.add_button(button);
|
|
|
|
return button;
|
|
|
|
};
|
|
|
|
|
|
|
|
that.add_button = function(button) {
|
|
|
|
that.buttons.put(button.name, button);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.get_button = function(name) {
|
|
|
|
return that.buttons.get(name);
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
2011-04-26 16:21:25 -05:00
|
|
|
that.field = function(field) {
|
2011-11-22 10:33:09 -06:00
|
|
|
that.fields.add_field(field);
|
2011-01-28 15:46:19 -06:00
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
2011-10-25 18:41:45 -05:00
|
|
|
that.validate = function() {
|
|
|
|
var valid = true;
|
2011-11-22 10:33:09 -06:00
|
|
|
var fields = that.fields.get_fields();
|
|
|
|
for (var i=0; i<fields.length; i++) {
|
|
|
|
var field = fields[i];
|
2011-12-05 06:39:30 -06:00
|
|
|
valid = field.validate() && field.validate_required() && valid;
|
2011-04-26 16:21:25 -05:00
|
|
|
}
|
2011-10-25 18:41:45 -05:00
|
|
|
return valid;
|
2011-04-26 16:21:25 -05:00
|
|
|
};
|
|
|
|
|
2012-07-19 07:47:48 -05:00
|
|
|
that.get_id = function() {
|
|
|
|
if (that.id) return that.id;
|
|
|
|
if (that.name) return that.name;
|
|
|
|
return null;
|
|
|
|
};
|
|
|
|
|
2011-09-10 11:54:02 -05:00
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
/**
|
|
|
|
* Create content layout
|
|
|
|
*/
|
|
|
|
that.create = function() {
|
|
|
|
|
2011-09-27 09:28:14 -05:00
|
|
|
that.message_container = $('<div/>', {
|
|
|
|
style: 'display: none',
|
|
|
|
'class': 'dialog-message ui-state-highlight ui-corner-all'
|
|
|
|
}).appendTo(that.container);
|
|
|
|
|
2011-11-22 10:33:09 -06:00
|
|
|
var widgets = that.widgets.get_widgets();
|
|
|
|
for (var i=0; i<widgets.length; i++) {
|
|
|
|
var widget = widgets[i];
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
var div = $('<div/>', {
|
2011-11-22 10:33:09 -06:00
|
|
|
name: widget.name,
|
2011-08-10 20:03:02 -05:00
|
|
|
'class': 'dialog-section'
|
2011-01-28 15:46:19 -06:00
|
|
|
}).appendTo(that.container);
|
|
|
|
|
2011-11-22 10:33:09 -06:00
|
|
|
widget.create(div);
|
2011-01-28 15:46:19 -06:00
|
|
|
}
|
|
|
|
|
2011-11-23 09:57:57 -06:00
|
|
|
that.policies.post_create();
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
2011-09-27 09:28:14 -05:00
|
|
|
that.show_message = function(message) {
|
|
|
|
that.message_container.text(message);
|
|
|
|
that.message_container.css('display', '');
|
|
|
|
};
|
|
|
|
|
|
|
|
that.hide_message = function() {
|
|
|
|
that.message_container.css('display', 'none');
|
|
|
|
};
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
/**
|
|
|
|
* Open dialog
|
|
|
|
*/
|
|
|
|
that.open = function(container) {
|
|
|
|
|
2012-07-19 07:47:48 -05:00
|
|
|
that.container = $('<div/>', {
|
|
|
|
id : that.get_id(),
|
|
|
|
'data-name': that.name
|
|
|
|
});
|
|
|
|
|
2011-03-07 12:35:11 -06:00
|
|
|
if (container) {
|
|
|
|
container.append(that.container);
|
|
|
|
}
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-07-21 02:54:07 -05:00
|
|
|
that.create();
|
2011-08-30 12:33:03 -05:00
|
|
|
that.reset();
|
2011-07-21 02:54:07 -05:00
|
|
|
|
|
|
|
that.container.dialog({
|
2011-08-02 16:48:08 -05:00
|
|
|
title: that.title,
|
|
|
|
modal: true,
|
2012-03-01 06:58:21 -06:00
|
|
|
closeOnEscape: that.close_on_escape,
|
2011-08-02 16:48:08 -05:00
|
|
|
width: that.width,
|
|
|
|
minWidth: that.width,
|
|
|
|
height: that.height,
|
|
|
|
minHeight: that.height,
|
2011-07-21 02:54:07 -05:00
|
|
|
close: function(event, ui) {
|
|
|
|
that.close();
|
|
|
|
}
|
|
|
|
});
|
2011-09-28 15:56:25 -05:00
|
|
|
|
2012-02-27 08:31:20 -06:00
|
|
|
that.set_buttons();
|
|
|
|
};
|
|
|
|
|
|
|
|
that.option = function(name, value) {
|
|
|
|
that.container.dialog('option', name, value);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.set_buttons = function() {
|
|
|
|
|
|
|
|
// create a map of button labels and handlers
|
|
|
|
var dialog_buttons = {};
|
|
|
|
for (var i=0; i<that.buttons.values.length; i++) {
|
|
|
|
var button = that.buttons.values[i];
|
|
|
|
if (!button.visible) continue;
|
|
|
|
dialog_buttons[button.label] = button.click;
|
|
|
|
}
|
|
|
|
|
|
|
|
//set buttons to dialog
|
|
|
|
that.option('buttons', dialog_buttons);
|
|
|
|
|
2011-09-28 15:56:25 -05:00
|
|
|
// find button elements
|
|
|
|
var parent = that.container.parent();
|
|
|
|
var buttons = $('.ui-dialog-buttonpane .ui-dialog-buttonset button', parent);
|
|
|
|
|
|
|
|
buttons.each(function(index) {
|
|
|
|
var button = that.buttons.values[index];
|
|
|
|
button.element = $(this);
|
|
|
|
});
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
2012-02-27 08:31:20 -06:00
|
|
|
that.display_buttons = function(names) {
|
|
|
|
|
|
|
|
for (var i=0; i<that.buttons.values.length; i++) {
|
|
|
|
var button = that.buttons.values[i];
|
|
|
|
|
|
|
|
button.visible = names.indexOf(button.name) > -1;
|
|
|
|
}
|
|
|
|
that.set_buttons();
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.save = function(record) {
|
2011-11-22 10:33:09 -06:00
|
|
|
var fields = that.fields.get_fields();
|
|
|
|
for (var i=0; i<fields.length; i++) {
|
|
|
|
var field = fields[i];
|
|
|
|
field.save(record);
|
2011-01-28 15:46:19 -06:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
that.close = function() {
|
|
|
|
that.container.dialog('destroy');
|
|
|
|
that.container.remove();
|
|
|
|
};
|
|
|
|
|
|
|
|
that.reset = function() {
|
2011-11-22 10:33:09 -06:00
|
|
|
var fields = that.fields.get_fields();
|
|
|
|
for (var i=0; i<fields.length; i++) {
|
|
|
|
fields[i].reset();
|
2011-02-07 22:02:43 -06:00
|
|
|
}
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
2011-11-22 10:33:09 -06:00
|
|
|
that.create_builder = function() {
|
|
|
|
|
|
|
|
var widget_builder = IPA.widget_builder({
|
|
|
|
widget_options: {
|
2012-06-13 10:44:36 -05:00
|
|
|
entity: that.entity,
|
|
|
|
facet: that
|
2011-11-22 10:33:09 -06:00
|
|
|
}
|
|
|
|
});
|
|
|
|
var field_builder = IPA.field_builder({
|
|
|
|
field_options: {
|
|
|
|
undo: false,
|
2012-06-13 10:44:36 -05:00
|
|
|
entity: that.entity,
|
|
|
|
facet: that
|
2011-11-22 10:33:09 -06:00
|
|
|
}
|
|
|
|
});
|
|
|
|
var section_builder = IPA.section_builder({
|
|
|
|
container: that,
|
|
|
|
section_factory: IPA.details_table_section_nc,
|
|
|
|
widget_builder: widget_builder,
|
|
|
|
field_builder: field_builder
|
|
|
|
});
|
|
|
|
|
|
|
|
that.builder = IPA.details_builder({
|
|
|
|
container: that,
|
|
|
|
widget_builder: widget_builder,
|
|
|
|
field_builder: field_builder,
|
|
|
|
section_builder: section_builder
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
that.init = function() {
|
|
|
|
|
|
|
|
that.create_builder();
|
|
|
|
that.builder.build(spec);
|
|
|
|
that.fields.widgets_created();
|
2011-11-23 09:57:57 -06:00
|
|
|
that.policies.init();
|
2011-11-22 10:33:09 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.init();
|
2011-09-10 11:54:02 -05:00
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
that.dialog_create = that.create;
|
|
|
|
that.dialog_open = that.open;
|
2011-08-05 10:12:21 -05:00
|
|
|
that.dialog_close = that.close;
|
2011-08-08 17:24:05 -05:00
|
|
|
that.dialog_save = that.save;
|
2011-08-23 20:45:06 -05:00
|
|
|
that.dialog_reset = that.reset;
|
2011-10-25 15:52:57 -05:00
|
|
|
that.dialog_validate = that.validate;
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This dialog provides an interface for searching and selecting
|
|
|
|
* values from the available results.
|
|
|
|
*/
|
2011-09-19 18:51:43 -05:00
|
|
|
IPA.adder_dialog = function(spec) {
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
2012-07-19 07:47:48 -05:00
|
|
|
spec.name = spec.name || 'adder_dialog';
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
var that = IPA.dialog(spec);
|
2011-09-28 15:56:25 -05:00
|
|
|
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
that.external = spec.external;
|
2011-07-15 12:18:59 -05:00
|
|
|
that.width = spec.width || 600;
|
|
|
|
that.height = spec.height || 360;
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-09-19 18:51:43 -05:00
|
|
|
if (!that.entity) {
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
var except = {
|
|
|
|
expected: false,
|
|
|
|
message:'Adder dialog created without entity.'
|
|
|
|
};
|
|
|
|
throw except;
|
|
|
|
}
|
|
|
|
|
2011-09-19 18:51:43 -05:00
|
|
|
var init = function() {
|
|
|
|
that.available_table = IPA.table_widget({
|
|
|
|
entity: that.entity,
|
|
|
|
name: 'available',
|
|
|
|
scrollable: true
|
|
|
|
});
|
|
|
|
|
|
|
|
that.selected_table = IPA.table_widget({
|
|
|
|
entity: that.entity,
|
|
|
|
name: 'selected',
|
|
|
|
scrollable: true
|
|
|
|
});
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-09-19 18:51:43 -05:00
|
|
|
if (spec.columns) {
|
|
|
|
for (var i=0; i<spec.columns.length; i++) {
|
|
|
|
that.create_column(spec.columns[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
that.get_column = function(name) {
|
2011-09-19 18:51:43 -05:00
|
|
|
return that.available_table.get_column(name);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.get_columns = function() {
|
|
|
|
return that.available_table.get_columns();
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.add_column = function(column) {
|
2011-09-19 18:51:43 -05:00
|
|
|
that.available_table.add_column(column);
|
|
|
|
that.selected_table.add_column(column);
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.set_columns = function(columns) {
|
|
|
|
that.clear_columns();
|
|
|
|
for (var i=0; i<columns.length; i++) {
|
|
|
|
that.add_column(columns[i]);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
that.clear_columns = function() {
|
2011-09-19 18:51:43 -05:00
|
|
|
that.available_table.clear_columns();
|
|
|
|
that.selected_table.clear_columns();
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.create_column = function(spec) {
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
spec.entity = that.entity;
|
2011-01-28 15:46:19 -06:00
|
|
|
var column = IPA.column(spec);
|
|
|
|
that.add_column(column);
|
|
|
|
return column;
|
|
|
|
};
|
|
|
|
|
|
|
|
that.create = function() {
|
|
|
|
|
|
|
|
// do not call that.dialog_create();
|
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
var container = $('<div/>', {
|
|
|
|
'class': 'adder-dialog'
|
2011-01-28 15:46:19 -06:00
|
|
|
}).appendTo(that.container);
|
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
var top_panel = $('<div/>', {
|
|
|
|
'class': 'adder-dialog-top'
|
|
|
|
}).appendTo(container);
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
$('<input/>', {
|
|
|
|
type: 'text',
|
2011-08-02 16:48:08 -05:00
|
|
|
name: 'filter'
|
|
|
|
}).appendTo(top_panel);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
top_panel.append(' ');
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-09-26 13:44:22 -05:00
|
|
|
that.find_button = IPA.button({
|
2011-01-28 15:46:19 -06:00
|
|
|
name: 'find',
|
2011-09-26 13:44:22 -05:00
|
|
|
label: IPA.messages.buttons.find,
|
|
|
|
click: function() {
|
|
|
|
that.search();
|
|
|
|
return false;
|
|
|
|
}
|
2011-08-02 16:48:08 -05:00
|
|
|
}).appendTo(top_panel);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
top_panel.append(IPA.create_network_spinner());
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
var left_panel = $('<div/>', {
|
|
|
|
'class': 'adder-dialog-left'
|
|
|
|
}).appendTo(container);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
var available_panel = $('<div/>', {
|
|
|
|
name: 'available',
|
|
|
|
'class': 'adder-dialog-available'
|
2011-08-02 16:48:08 -05:00
|
|
|
}).appendTo(left_panel);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
$('<div/>', {
|
2011-02-16 12:46:59 -06:00
|
|
|
html: IPA.messages.dialogs.available,
|
2011-08-02 16:48:08 -05:00
|
|
|
'class': 'adder-dialog-header ui-widget-header'
|
2011-01-28 15:46:19 -06:00
|
|
|
}).appendTo(available_panel);
|
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
var available_content = $('<div/>', {
|
|
|
|
'class': 'adder-dialog-content'
|
|
|
|
}).appendTo(available_panel);
|
|
|
|
|
|
|
|
that.available_table.create(available_content);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
var right_panel = $('<div/>', {
|
|
|
|
'class': 'adder-dialog-right'
|
|
|
|
}).appendTo(container);
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
var selected_panel = $('<div/>', {
|
|
|
|
name: 'selected',
|
|
|
|
'class': 'adder-dialog-selected'
|
2011-08-02 16:48:08 -05:00
|
|
|
}).appendTo(right_panel);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
$('<div/>', {
|
2011-02-16 12:46:59 -06:00
|
|
|
html: IPA.messages.dialogs.prospective,
|
2011-08-02 16:48:08 -05:00
|
|
|
'class': 'adder-dialog-header ui-widget-header'
|
|
|
|
}).appendTo(selected_panel);
|
|
|
|
|
|
|
|
var selected_content = $('<div/>', {
|
|
|
|
'class': 'adder-dialog-content'
|
2011-01-28 15:46:19 -06:00
|
|
|
}).appendTo(selected_panel);
|
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
that.selected_table.create(selected_content);
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-08-15 09:13:13 -05:00
|
|
|
var buttons_panel = $('<div/>', {
|
|
|
|
name: 'buttons',
|
|
|
|
'class': 'adder-dialog-buttons'
|
|
|
|
}).appendTo(container);
|
|
|
|
|
2011-11-21 16:43:52 -06:00
|
|
|
var div = $('<div/>').appendTo(buttons_panel);
|
2011-09-28 15:56:25 -05:00
|
|
|
IPA.button({
|
2011-09-26 10:24:14 -05:00
|
|
|
name: 'add',
|
2011-09-26 13:44:22 -05:00
|
|
|
label: '>>',
|
|
|
|
click: function() {
|
|
|
|
that.add();
|
2011-09-28 15:56:25 -05:00
|
|
|
that.update_buttons();
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
return false;
|
|
|
|
}
|
2011-11-21 16:43:52 -06:00
|
|
|
}).appendTo(div);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-11-21 16:43:52 -06:00
|
|
|
div = $('<div/>').appendTo(buttons_panel);
|
2011-09-28 15:56:25 -05:00
|
|
|
IPA.button({
|
2011-06-21 15:05:44 -05:00
|
|
|
name: 'remove',
|
2011-09-26 13:44:22 -05:00
|
|
|
label: '<<',
|
|
|
|
click: function() {
|
2011-01-28 15:46:19 -06:00
|
|
|
that.remove();
|
2011-09-28 15:56:25 -05:00
|
|
|
that.update_buttons();
|
2011-06-13 23:18:57 -05:00
|
|
|
return false;
|
2011-01-28 15:46:19 -06:00
|
|
|
}
|
2011-11-21 16:43:52 -06:00
|
|
|
}).appendTo(div);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-09-26 13:44:22 -05:00
|
|
|
that.filter_field = $('input[name=filter]', that.container);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
if (that.external) {
|
2011-08-02 16:48:08 -05:00
|
|
|
container.addClass('adder-dialog-with-external');
|
|
|
|
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
var external_panel = $('<div/>', {
|
|
|
|
name: 'external',
|
|
|
|
'class': 'adder-dialog-external'
|
2011-08-02 16:48:08 -05:00
|
|
|
}).appendTo(left_panel);
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
|
|
|
|
$('<div/>', {
|
|
|
|
html: IPA.messages.objects.sudorule.external,
|
2011-08-02 16:48:08 -05:00
|
|
|
'class': 'adder-dialog-header ui-widget-header'
|
|
|
|
}).appendTo(external_panel);
|
|
|
|
|
|
|
|
var external_content = $('<div/>', {
|
|
|
|
'class': 'adder-dialog-content'
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
}).appendTo(external_panel);
|
|
|
|
|
|
|
|
that.external_field = $('<input/>', {
|
|
|
|
type: 'text',
|
2011-08-02 16:48:08 -05:00
|
|
|
name: 'external'
|
|
|
|
}).appendTo(external_content);
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
}
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
that.search();
|
|
|
|
};
|
|
|
|
|
|
|
|
that.open = function(container) {
|
2011-02-21 18:36:42 -06:00
|
|
|
|
2011-09-28 15:56:25 -05:00
|
|
|
var add_button = that.create_button({
|
|
|
|
name: 'add',
|
2011-10-24 19:20:14 -05:00
|
|
|
label: IPA.messages.buttons.add,
|
2011-09-28 15:56:25 -05:00
|
|
|
click: function() {
|
|
|
|
if (!add_button.is_enabled()) return;
|
|
|
|
that.execute();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
that.create_button({
|
|
|
|
name: 'cancel',
|
|
|
|
label: IPA.messages.buttons.cancel,
|
|
|
|
click: function() {
|
|
|
|
that.close();
|
|
|
|
}
|
|
|
|
});
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
that.dialog_open(container);
|
2011-09-28 15:56:25 -05:00
|
|
|
|
|
|
|
that.update_buttons();
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.add = function() {
|
|
|
|
var rows = that.available_table.remove_selected_rows();
|
|
|
|
that.selected_table.add_rows(rows);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.remove = function() {
|
|
|
|
var rows = that.selected_table.remove_selected_rows();
|
|
|
|
that.available_table.add_rows(rows);
|
|
|
|
};
|
|
|
|
|
2011-09-28 15:56:25 -05:00
|
|
|
that.update_buttons = function() {
|
|
|
|
|
|
|
|
var values = that.selected_table.save();
|
|
|
|
|
|
|
|
var button = that.get_button('add');
|
|
|
|
button.set_enabled(values && values.length);
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
2011-09-28 15:56:25 -05:00
|
|
|
that.get_filter = function() {
|
|
|
|
return that.filter_field.val();
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.clear_available_values = function() {
|
|
|
|
that.available_table.empty();
|
|
|
|
};
|
|
|
|
|
|
|
|
that.clear_selected_values = function() {
|
|
|
|
that.selected_table.empty();
|
|
|
|
};
|
|
|
|
|
|
|
|
that.add_available_value = function(record) {
|
|
|
|
that.available_table.add_record(record);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.get_selected_values = function() {
|
|
|
|
return that.selected_table.save();
|
|
|
|
};
|
|
|
|
|
2011-09-28 15:56:25 -05:00
|
|
|
that.execute = function() {
|
|
|
|
};
|
|
|
|
|
2011-09-19 18:51:43 -05:00
|
|
|
init();
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
that.adder_dialog_create = that.create;
|
|
|
|
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This dialog displays the values to be deleted.
|
|
|
|
*/
|
|
|
|
IPA.deleter_dialog = function (spec) {
|
|
|
|
|
|
|
|
spec = spec || {};
|
2012-07-19 07:47:48 -05:00
|
|
|
spec.name = spec.name || 'deleter_dialog';
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
var that = IPA.dialog(spec);
|
|
|
|
|
2011-02-16 12:46:59 -06:00
|
|
|
that.title = spec.title || IPA.messages.buttons.remove;
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
that.values = spec.values || [];
|
|
|
|
|
|
|
|
that.add_value = function(value) {
|
|
|
|
that.values.push(value);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.set_values = function(values) {
|
2011-07-19 13:46:09 -05:00
|
|
|
that.values = values;
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.create = function() {
|
|
|
|
|
|
|
|
$('<p/>', {
|
|
|
|
'text': IPA.messages.search.delete_confirm
|
|
|
|
}).appendTo(that.container);
|
|
|
|
|
|
|
|
var div = $('<div/>', {
|
|
|
|
style: 'overflow:auto; max-height: 100px'
|
|
|
|
}).appendTo(that.container);
|
|
|
|
|
|
|
|
var ul = $('<ul/>');
|
|
|
|
ul.appendTo(div);
|
|
|
|
|
|
|
|
for (var i=0; i<that.values.length; i++) {
|
2011-05-27 10:32:17 -05:00
|
|
|
var value = that.values[i];
|
|
|
|
if (value instanceof Object){
|
|
|
|
var first = true;
|
|
|
|
var str_value = "";
|
|
|
|
for (var key in value){
|
|
|
|
if (value.hasOwnProperty(key)){
|
|
|
|
if (!first){
|
|
|
|
str_value += ',';
|
|
|
|
}
|
|
|
|
str_value += (key + ':' +value[key]);
|
|
|
|
first = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
value = str_value;
|
|
|
|
}
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
$('<li/>',{
|
2011-05-27 10:32:17 -05:00
|
|
|
'text': value
|
2011-01-28 15:46:19 -06:00
|
|
|
}).appendTo(ul);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
that.open = function(container) {
|
2011-02-21 18:36:42 -06:00
|
|
|
|
2011-09-28 15:56:25 -05:00
|
|
|
that.create_button({
|
|
|
|
name: 'remove',
|
|
|
|
label: IPA.messages.buttons.remove,
|
|
|
|
click: function() {
|
|
|
|
that.execute();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
that.create_button({
|
|
|
|
name: 'cancel',
|
|
|
|
label: IPA.messages.buttons.cancel,
|
|
|
|
click: function() {
|
|
|
|
that.close();
|
|
|
|
}
|
|
|
|
});
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
that.dialog_open(container);
|
|
|
|
};
|
|
|
|
|
2011-09-28 15:56:25 -05:00
|
|
|
that.execute = function() {
|
|
|
|
};
|
|
|
|
|
2011-07-19 13:46:09 -05:00
|
|
|
that.deleter_dialog_create = that.create;
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
return that;
|
|
|
|
};
|
2011-08-05 10:12:21 -05:00
|
|
|
|
|
|
|
IPA.message_dialog = function(spec) {
|
|
|
|
|
2012-07-19 07:47:48 -05:00
|
|
|
spec = spec || {};
|
2011-08-05 10:12:21 -05:00
|
|
|
|
2012-07-19 07:47:48 -05:00
|
|
|
spec.name = spec.name || 'message_dialog';
|
|
|
|
|
|
|
|
var that = IPA.dialog(spec);
|
|
|
|
that.message = spec.message || '';
|
|
|
|
that.on_ok = spec.on_ok;
|
2011-08-05 10:12:21 -05:00
|
|
|
|
|
|
|
that.create = function() {
|
|
|
|
$('<p/>', {
|
|
|
|
'text': that.message
|
|
|
|
}).appendTo(that.container);
|
|
|
|
};
|
|
|
|
|
2011-09-28 15:56:25 -05:00
|
|
|
that.create_button({
|
|
|
|
name: 'ok',
|
|
|
|
label: IPA.messages.buttons.ok,
|
|
|
|
click: function() {
|
|
|
|
that.close();
|
2012-09-03 09:43:13 -05:00
|
|
|
if (that.on_ok) {
|
2011-09-28 15:56:25 -05:00
|
|
|
that.on_ok();
|
|
|
|
}
|
2011-08-05 10:12:21 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2012-03-12 08:13:11 -05:00
|
|
|
that.message_dialog_create = that.create;
|
|
|
|
|
2011-08-05 10:12:21 -05:00
|
|
|
return that;
|
|
|
|
};
|
2012-09-03 09:43:13 -05:00
|
|
|
|
|
|
|
IPA.confirm_dialog = function(spec) {
|
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
spec.message = spec.message || IPA.messages.actions.confirm;
|
|
|
|
spec.title = spec.title || IPA.messages.dialogs.confirmation;
|
|
|
|
|
|
|
|
var that = IPA.message_dialog(spec);
|
|
|
|
that.on_cancel = spec.on_cancel;
|
|
|
|
that.ok_label = spec.ok_label || IPA.messages.buttons.ok;
|
|
|
|
that.cancel_label = spec.cancel_label || IPA.messages.buttons.cancel;
|
|
|
|
that.confirmed = false;
|
|
|
|
that.confirm_on_enter = spec.confirm_on_enter !== undefined ? spec.confirm_on_enter : true;
|
|
|
|
|
|
|
|
that.close = function() {
|
|
|
|
|
|
|
|
that.dialog_close();
|
|
|
|
$(document).unbind('keyup', that.on_key_up);
|
|
|
|
|
|
|
|
if (that.confirmed) {
|
|
|
|
if (that.on_ok) {
|
|
|
|
that.on_ok();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (that.on_cancel) {
|
|
|
|
that.on_cancel();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
that.open = function(container) {
|
|
|
|
|
|
|
|
that.confirmed = false;
|
|
|
|
that.dialog_open(container);
|
|
|
|
$(document).bind('keyup', that.on_key_up);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.on_key_up = function(event) {
|
|
|
|
|
|
|
|
if (event.keyCode === $.ui.keyCode.ENTER) {
|
|
|
|
event.preventDefault();
|
|
|
|
that.confirmed = true;
|
|
|
|
that.close();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
that.create_buttons = function() {
|
|
|
|
|
|
|
|
that.buttons.empty();
|
|
|
|
|
|
|
|
that.create_button({
|
|
|
|
name: 'ok',
|
|
|
|
label: that.ok_label,
|
|
|
|
click: function() {
|
|
|
|
that.confirmed = true;
|
|
|
|
that.close();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
that.create_button({
|
|
|
|
name: 'cancel',
|
|
|
|
label: that.cancel_label,
|
|
|
|
click: function() {
|
|
|
|
that.confirmed = false;
|
|
|
|
that.close();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
that.create_buttons();
|
|
|
|
|
|
|
|
that.confirm_dialog_close = that.close;
|
|
|
|
that.confirm_dialog_open = that.open;
|
|
|
|
|
|
|
|
return that;
|
|
|
|
};
|