From d3700275c1b63aeeab13c7dd9e09249bc2c8e4d7 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mar 08 2017 09:14:21 +0000 Subject: WebUI: Add Custom command multivalued adder dialog Adder dialog which is used along with custom_command_multivalued_widget. It behaivor of confirm dialog and adds fields which are necessary. Part of: https://fedorahosted.org/freeipa/ticket/6601 Reviewed-By: Florence Blanc-Renaud Reviewed-By: Petr Vobornik --- diff --git a/install/ui/src/freeipa/dialog.js b/install/ui/src/freeipa/dialog.js index 8552e76..5150527 100644 --- a/install/ui/src/freeipa/dialog.js +++ b/install/ui/src/freeipa/dialog.js @@ -1451,6 +1451,40 @@ IPA.confirm_dialog = function(spec) { return that; }; +/** + * Custom command multivalued dialog + * + * Combines confirmation dialog which could be reopen after unsucessful command + * call. It also allows to define fields and widgets in the dialog. + * + * Acceptation is done by clicking on 'Add' button or hitting 'ENTER' key, + * refusal by clicking on 'Cancel' button or hitting 'ESCAPE' key. + * + * @class + * @extends IPA.form_dialog + */ +IPA.custom_command_multivalued_dialog = function(spec) { + spec = spec || {}; + + /** + * Name of confirmation button, by default set to 'Add'. + * @param {String} ok_label + */ + spec.ok_label = spec.ok_label || '@i18n:buttons.add'; + + var that = IPA.form_dialog(spec); + + that.close = function() { + that.dialog_close(); + }; + + that.on_confirm = function() { + if (that.on_ok) that.on_ok(); + }; + + return that; +}; + /** *