Re: [Freeipa-users] Setting "preserve" as default action when deleting in webUI

2016-11-11 Thread Pavel Vomacka

Hello Sebastien,

It's really weird, I tried it again using exactly the same code as you 
sent earlier and it works. Just for information which version of FreeIPA 
do you use? It should not be a problem, but I really can't find anything 
bad in your solution.


On 11/09/2016 05:12 PM, Sébastien Julliot wrote:

Hello Pavel,


Yes I did. "PRESERVE.JS WAS EXECUTED" is printed in my browser's
console, and yet "delete" ("supprimer", in French)  is still the
default. (as you can see in linked image)


Le 31/10/2016 à 16:18, Pavel Vomacka a écrit :

Hello Sebastien,

I tried your plugin and it works correctly. Default value is Preserve
with your plugin. Did you copy your plugin into
/var/share/ipa/ui/js/plugins/plugin_name/plugin_name.js ? That should
be enough.


On 10/28/2016 12:14 AM, Sebastien Julliot wrote:

Hello guys,


Thank you for your answers. First, I was able to modify the minified js
to change the default. Ugly solution, but it works for now.

I am trying to write a plugin but it seems that I missed something here
since, despite being executed, the default is not changed ..

Here is my code, freely inspired of what I think I understood of your
'association_search_fix.js' example:

define([

  'freeipa/ipa',

  'freeipa/user',

],

  function(IPA, user) {

exp = {};

  
exp.orig_create_active_user_del_dialog =

IPA.user.create_active_user_del_dialog;

IPA.user.create_active_user_del_dialog = function(dialog) {

  dialog.deleter_dialog_create_content();

  dialog.option_layout = IPA.fluid_layout({

  label_cls: 'col-sm-3',

  widget_cls: 'col-sm-9'

  });

  dialog.option_radio = IPA.radio_widget({

  name: 'preserve',

  label: '@i18n:objects.user.delete_mode',

  options: [

  { label: '@i18n:objects.user.mode_delete', value:
'false' },

  { label: '@i18n:objects.user.mode_preserve', value:
'true' }

  ],

  default_value: 'true'

  });

  var html = dialog.option_layout.create([dialog.option_radio]);

  dialog.container.append(html);

  dialog.option_radio.set_value(['']);

  return dialog;

};

//exp.orig_create_active_user_del_dialog =
IPA.user.create_active_user_del_dialog;

console.log('PRESERVE.JS WAS EXECUTED');

return exp;

});

I checked that disabling the comment or not does not change anything.


Can you see what I missed here ?


Thanks a lot,

Sebastien Julliot.




--
Pavel^3 Vomacka

--
Manage your subscription for the Freeipa-users mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-users
Go to http://freeipa.org for more info on the project

Re: [Freeipa-users] Setting "preserve" as default action when deleting in webUI

2016-11-09 Thread Sébastien Julliot
Hello Pavel,


Yes I did. "PRESERVE.JS WAS EXECUTED" is printed in my browser's
console, and yet "delete" ("supprimer", in French)  is still the
default. (as you can see in linked image)


Le 31/10/2016 à 16:18, Pavel Vomacka a écrit :
> Hello Sebastien,
>
> I tried your plugin and it works correctly. Default value is Preserve
> with your plugin. Did you copy your plugin into
> /var/share/ipa/ui/js/plugins/plugin_name/plugin_name.js ? That should
> be enough.
>
>
> On 10/28/2016 12:14 AM, Sebastien Julliot wrote:
>> Hello guys,
>>
>>
>> Thank you for your answers. First, I was able to modify the minified js
>> to change the default. Ugly solution, but it works for now.
>>
>> I am trying to write a plugin but it seems that I missed something here
>> since, despite being executed, the default is not changed ..
>>
>> Here is my code, freely inspired of what I think I understood of your
>> 'association_search_fix.js' example:
>>
>> define([
>>
>>  'freeipa/ipa',
>>
>>  'freeipa/user',
>>
>> ],
>>
>>  function(IPA, user) {
>>
>> exp = {};
>>
>>  
>> exp.orig_create_active_user_del_dialog =
>> IPA.user.create_active_user_del_dialog;
>>
>> IPA.user.create_active_user_del_dialog = function(dialog) {
>>
>>  dialog.deleter_dialog_create_content();
>>
>>  dialog.option_layout = IPA.fluid_layout({
>>
>>  label_cls: 'col-sm-3',
>>
>>  widget_cls: 'col-sm-9'
>>
>>  });
>>
>>  dialog.option_radio = IPA.radio_widget({
>>
>>  name: 'preserve',
>>
>>  label: '@i18n:objects.user.delete_mode',
>>
>>  options: [
>>
>>  { label: '@i18n:objects.user.mode_delete', value:
>> 'false' },
>>
>>  { label: '@i18n:objects.user.mode_preserve', value:
>> 'true' }
>>
>>  ],
>>
>>  default_value: 'true'
>>
>>  });
>>
>>  var html = dialog.option_layout.create([dialog.option_radio]);
>>
>>  dialog.container.append(html);
>>
>>  dialog.option_radio.set_value(['']);
>>
>>  return dialog;
>>
>> };
>>
>> //exp.orig_create_active_user_del_dialog =
>> IPA.user.create_active_user_del_dialog;
>>
>> console.log('PRESERVE.JS WAS EXECUTED');
>>
>> return exp;
>>
>> });
>>
>> I checked that disabling the comment or not does not change anything.
>>
>>
>> Can you see what I missed here ?
>>
>>
>> Thanks a lot,
>>
>> Sebastien Julliot.
>>
>>
>

-- 
Manage your subscription for the Freeipa-users mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-users
Go to http://freeipa.org for more info on the project

Re: [Freeipa-users] Setting "preserve" as default action when deleting in webUI

2016-10-31 Thread Pavel Vomacka

Hello Sebastien,

I tried your plugin and it works correctly. Default value is Preserve 
with your plugin. Did you copy your plugin into 
/var/share/ipa/ui/js/plugins/plugin_name/plugin_name.js ? That should be 
enough.



On 10/28/2016 12:14 AM, Sebastien Julliot wrote:

Hello guys,


Thank you for your answers. First, I was able to modify the minified js
to change the default. Ugly solution, but it works for now.

I am trying to write a plugin but it seems that I missed something here
since, despite being executed, the default is not changed ..

Here is my code, freely inspired of what I think I understood of your
'association_search_fix.js' example:

define([

 'freeipa/ipa',

 'freeipa/user',

],

 function(IPA, user) {

exp = {};

  


exp.orig_create_active_user_del_dialog = IPA.user.create_active_user_del_dialog;

IPA.user.create_active_user_del_dialog = function(dialog) {

 dialog.deleter_dialog_create_content();

 dialog.option_layout = IPA.fluid_layout({

 label_cls: 'col-sm-3',

 widget_cls: 'col-sm-9'

 });

 dialog.option_radio = IPA.radio_widget({

 name: 'preserve',

 label: '@i18n:objects.user.delete_mode',

 options: [

 { label: '@i18n:objects.user.mode_delete', value: 'false' },

 { label: '@i18n:objects.user.mode_preserve', value: 'true' }

 ],

 default_value: 'true'

 });

 var html = dialog.option_layout.create([dialog.option_radio]);

 dialog.container.append(html);

 dialog.option_radio.set_value(['']);

 return dialog;

};

//exp.orig_create_active_user_del_dialog = 
IPA.user.create_active_user_del_dialog;

console.log('PRESERVE.JS WAS EXECUTED');

return exp;

});

I checked that disabling the comment or not does not change anything.


Can you see what I missed here ?


Thanks a lot,

Sebastien Julliot.




--
Pavel^3 Vomacka

--
Manage your subscription for the Freeipa-users mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-users
Go to http://freeipa.org for more info on the project


Re: [Freeipa-users] Setting "preserve" as default action when deleting in webUI

2016-10-30 Thread Petr Vobornik
On 10/21/2016 02:13 PM, Sébastien Julliot wrote:
> Hi everyone,
> 
> 
> In order to prevent administrators to make mistakes that could have
> 
> silly consequences, I would like to set "preserve" as the default selected
> 
> action in freeipa's webui.
> 
> What do you think would be the best way to achieve this ?

1. Quick, more work:

Create Web UI plugin which would change the hardcoded default to the
other value:
  related code:
https://git.fedorahosted.org/cgit/freeipa.git/tree/install/ui/src/freeipa/user.js#n989
  example plugins: https://pvoborni.fedorapeople.org/plugins/
  plugin info: https://pvoborni.fedorapeople.org/doc/#!/guide/Plugins

2. Uncertain delivery:
File a ticket to change default or make it configurable(IMO better). Let
core team to implement it. But note that there is quite a big number of
other tickets which we prioritize.

https://fedorahosted.org/freeipa/newticket

3. Do #2 and contribute patch for it. When reviewed, it would then go to
currently developed version(4.5). This might be more work then #1.

4. dirty: change the default directly in Web UI code. Doesn't work well
with upgrades, not supported, hard to find it in minimized code.

> 
> 
> Thank you in advance,
> 
> Sebastien Julliot.
> 
-- 
Petr Vobornik

-- 
Manage your subscription for the Freeipa-users mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-users
Go to http://freeipa.org for more info on the project


Re: [Freeipa-users] Setting "preserve" as default action when deleting in webUI

2016-10-27 Thread Sebastien Julliot
Hello guys,


Thank you for your answers. First, I was able to modify the minified js
to change the default. Ugly solution, but it works for now.

I am trying to write a plugin but it seems that I missed something here
since, despite being executed, the default is not changed ..

Here is my code, freely inspired of what I think I understood of your
'association_search_fix.js' example:

define([

'freeipa/ipa',

'freeipa/user',

],

function(IPA, user) {

exp = {};

 

exp.orig_create_active_user_del_dialog = IPA.user.create_active_user_del_dialog;

IPA.user.create_active_user_del_dialog = function(dialog) {

dialog.deleter_dialog_create_content();

dialog.option_layout = IPA.fluid_layout({

label_cls: 'col-sm-3',

widget_cls: 'col-sm-9'

});

dialog.option_radio = IPA.radio_widget({

name: 'preserve',

label: '@i18n:objects.user.delete_mode',

options: [

{ label: '@i18n:objects.user.mode_delete', value: 'false' },

{ label: '@i18n:objects.user.mode_preserve', value: 'true' }

],

default_value: 'true'

});

var html = dialog.option_layout.create([dialog.option_radio]);

dialog.container.append(html);

dialog.option_radio.set_value(['']);

return dialog;

};

//exp.orig_create_active_user_del_dialog = 
IPA.user.create_active_user_del_dialog;

console.log('PRESERVE.JS WAS EXECUTED');

return exp;

});

I checked that disabling the comment or not does not change anything.


Can you see what I missed here ?


Thanks a lot,

Sebastien Julliot.



-- 
Manage your subscription for the Freeipa-users mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-users
Go to http://freeipa.org for more info on the project


Re: [Freeipa-users] Setting "preserve" as default action when deleting in webUI

2016-10-24 Thread Pavel Vomacka

Hello Sebastien,

the safest way is to create a WebUI plugin which rewrite definition of 
radiobutton in deleter dialog. You can find radiobutton code in user.js, 
line 989 (method IPA.user.create_active_user_del_dialog), where you need 
to set default_value to true.


Several examples of plugins can be found here: 
https://pvoborni.fedorapeople.org/plugins/ . I recommend to look at 
employeenumber or association_search_fix. And here is documentation 
about plugins: https://pvoborni.fedorapeople.org/doc/#!/guide/Plugins


On 10/20/2016 11:43 AM, Sébastien Julliot wrote:

Hi everyone,


In order to prevent administrators to make mistakes that could have

silly consequences, I would like to set "preserve" as the default selected

action in freeipa's webui.

What do you think would be the best way to achieve this ?


Thank you in advance,

Sebastien Julliot.





--
Pavel^3 Vomacka

--
Manage your subscription for the Freeipa-users mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-users
Go to http://freeipa.org for more info on the project