Re: [Freeipa-devel] [PATCH] 0013, 0017 webui: Add ability to convert users from preserved to staged state

2016-06-03 Thread Petr Vobornik
On 06/03/2016 08:27 AM, Pavel Vomacka wrote:
> 
> 
> On 06/02/2016 06:45 PM, Petr Vobornik wrote:
>> On 04/20/2016 07:05 PM, Pavel Vomacka wrote:
>>> On 04/15/2016 06:44 PM, Petr Vobornik wrote:
 On 04/13/2016 02:56 PM, Pavel Vomacka wrote:
> Hello,
>
> This patch adds ability to convert users from preserved to staged
> state.
>
> Fixes this ticket:https://fedorahosted.org/freeipa/ticket/5371
>
> -- 
> Pavel^3 Vomacka
>
>
 The patch requires rebase.
>>> Attached rebased patches. I split this one patch into two patches.
>> Patch 13: ACK
>>
>> Maybe a nitpick, why the icon have opacity 0.5?
> I was not sure which icon I should use, so we talked about it with Honza
> and we've chosen the the user icon which will be  lighter than default. 
> It would be better to do it using text color. So, updated patch attached.
>> Patch 17: needs rebase
> Rebased patch attached.

ACK for both patches.

Rebased(due to internal.py move) and pushed.

master:
* b71d1b431d7393187de162c4c0d921a2dc4b3a49 Add ability to stage multiple
users
* 46e3245fdedbf88050fffa6039d176914c242418 Add option to stage user from
details page
-- 
Petr Vobornik

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [PATCH] 0013, 0017 webui: Add ability to convert users from preserved to staged state

2016-06-03 Thread Pavel Vomacka



On 06/02/2016 06:45 PM, Petr Vobornik wrote:

On 04/20/2016 07:05 PM, Pavel Vomacka wrote:

On 04/15/2016 06:44 PM, Petr Vobornik wrote:

On 04/13/2016 02:56 PM, Pavel Vomacka wrote:

Hello,

This patch adds ability to convert users from preserved to staged state.

Fixes this ticket:https://fedorahosted.org/freeipa/ticket/5371

--
Pavel^3 Vomacka



The patch requires rebase.

Attached rebased patches. I split this one patch into two patches.

Patch 13: ACK

Maybe a nitpick, why the icon have opacity 0.5?
I was not sure which icon I should use, so we talked about it with Honza 
and we've chosen the the user icon which will be  lighter than default.  
It would be better to do it using text color. So, updated patch attached.

Patch 17: needs rebase

Rebased patch attached.
From fe5043f2ce4989c2a4149442ff23db6679bdf642 Mon Sep 17 00:00:00 2001
From: Pavel Vomacka 
Date: Wed, 20 Apr 2016 18:43:35 +0200
Subject: [PATCH 1/2] Add ability to stage multiple users

Add 'Stage' button on  search page where preserved users are listed.

https://fedorahosted.org/freeipa/ticket/5371
---
 install/ui/ipa.css  |  4 
 install/ui/src/freeipa/stageuser.js | 29 +
 install/ui/test/data/ipa_init.json  |  3 +++
 ipalib/plugins/internal.py  |  3 +++
 4 files changed, 39 insertions(+)

diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index f419eb224252aa03eaf4b25bb03435f4c9a6de9b..2921f4360a70f143d936e39bfdd5693b4a341750 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -174,6 +174,10 @@ div[name=settings].facet-group li a {
 float: right;
 }
 
+.facet-controls-right .fa.fa-user {
+color: #aaa;
+}
+
 .control-buttons {
 display: inline-block;
 }
diff --git a/install/ui/src/freeipa/stageuser.js b/install/ui/src/freeipa/stageuser.js
index 9d26ef1fa1a86aef5835af51b7abd2369e4c7223..12debed301a3ddbc166abcb3f444dd4775b40407 100644
--- a/install/ui/src/freeipa/stageuser.js
+++ b/install/ui/src/freeipa/stageuser.js
@@ -298,6 +298,9 @@ stageuser.search_preserved_facet_spec = {
 actions: [
 {
 $type: 'batch_undel'
+},
+{
+$type: 'batch_stage'
 }
 ],
 control_buttons: [
@@ -305,6 +308,11 @@ stageuser.search_preserved_facet_spec = {
 name: 'undel',
 label: '@i18n:buttons.restore',
 icon: 'fa-heart'
+},
+{
+name: 'batch_stage',
+label: '@i18n:buttons.stage',
+icon: 'fa-user'
 }
 ],
 policies: [
@@ -323,6 +331,12 @@ mod_user.entity_spec.policies.push(
 {
 $factory: IPA.facet_update_policy,
 source_facet: 'search_preserved',
+dest_entity: 'stageuser',
+dest_facet: 'search'
+},
+{
+$factory: IPA.facet_update_policy,
+source_facet: 'search_preserved',
 dest_entity: 'user',
 dest_facet: 'search'
 },
@@ -385,6 +399,20 @@ stageuser.activate_action = function(spec) {
 return that;
 };
 
+stageuser.batch_stage_action = function(spec) {
+
+spec = spec || {};
+
+spec.name = spec.name || 'batch_stage';
+spec.method = spec.method || 'stage';
+spec.needs_confirm = spec.needs_confirm === undefined ? true : spec.needs_confirm;
+spec.enable_cond = spec.enable_cond || ['item-selected'];
+spec.success_msg = spec.success_msg || '@i18n:objects.stageuser.stage_success';
+spec.confirm_msg = spec.confirm_msg || '@i18n:objects.stageuser.stage_confirm';
+
+return IPA.batch_items_action(spec);
+};
+
 /**
  * Stage user entity specification object
  * @member stageuser
@@ -402,6 +430,7 @@ stageuser.register = function() {
 a.register('batch_activate', stageuser.batch_activate_action);
 a.register('batch_undel', stageuser.batch_undel_action);
 a.register('activate', stageuser.activate_action);
+a.register('batch_stage', stageuser.batch_stage_action);
 e.register({type: 'stageuser', spec: stageuser.stageuser_spec});
 f.register_from_spec('user_search_preserved', stageuser.search_preserved_facet_spec);
 };
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 6ed7e98246c5d46850718fb1fbfafc0e8aebef0f..da401d415358347b5bb29fdbeaecf6da83546849 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -89,6 +89,7 @@
 "save": "Save",
 "set": "Set",
 "show": "Show",
+"stage": "Stage",
 "unapply": "Un-apply",
 "update": "Update",
 "view": "View"
@@ -545,6 +546,8 @@
 "activate_success": "${count} user(s) activated",
 "label": "Stage users",
 "preserved_label": "Preserved users",
+"stage_confirm": "Are you sure you want to stage 

Re: [Freeipa-devel] [PATCH] 0013, 0017 webui: Add ability to convert users from preserved to staged state

2016-06-02 Thread Petr Vobornik
On 04/20/2016 07:05 PM, Pavel Vomacka wrote:
> 
> 
> On 04/15/2016 06:44 PM, Petr Vobornik wrote:
>> On 04/13/2016 02:56 PM, Pavel Vomacka wrote:
>>> Hello,
>>>
>>> This patch adds ability to convert users from preserved to staged state.
>>>
>>> Fixes this ticket: https://fedorahosted.org/freeipa/ticket/5371
>>>
>>> -- 
>>> Pavel^3 Vomacka
>>>
>>>
>> The patch requires rebase.
> Attached rebased patches. I split this one patch into two patches.


Patch 13: ACK

Maybe a nitpick, why the icon have opacity 0.5?

Patch 17: needs rebase
-- 
Petr Vobornik

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [PATCH] 0013, 0017 webui: Add ability to convert users from preserved to staged state

2016-04-20 Thread Pavel Vomacka



On 04/15/2016 06:44 PM, Petr Vobornik wrote:

On 04/13/2016 02:56 PM, Pavel Vomacka wrote:

Hello,

This patch adds ability to convert users from preserved to staged state.

Fixes this ticket: https://fedorahosted.org/freeipa/ticket/5371

--
Pavel^3 Vomacka



The patch requires rebase.

Attached rebased patches. I split this one patch into two patches.
>From 8fc33ad7e1dea0a2ca896dd035633580a9ef6eb4 Mon Sep 17 00:00:00 2001
From: Pavel Vomacka 
Date: Wed, 20 Apr 2016 18:43:35 +0200
Subject: [PATCH 1/2] Add ability to stage multiple users

Add 'Stage' button on  search page where preserved users are listed.

https://fedorahosted.org/freeipa/ticket/5371
---
 install/ui/ipa.css  |  4 
 install/ui/src/freeipa/stageuser.js | 29 +
 install/ui/test/data/ipa_init.json  |  3 +++
 ipalib/plugins/internal.py  |  3 +++
 4 files changed, 39 insertions(+)

diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index f419eb224252aa03eaf4b25bb03435f4c9a6de9b..7997a71d76e1f8ed7811d68b53a5f12892c49eb4 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -174,6 +174,10 @@ div[name=settings].facet-group li a {
 float: right;
 }
 
+.facet-controls-right .fa.fa-user {
+opacity: 0.5;
+}
+
 .control-buttons {
 display: inline-block;
 }
diff --git a/install/ui/src/freeipa/stageuser.js b/install/ui/src/freeipa/stageuser.js
index 9d26ef1fa1a86aef5835af51b7abd2369e4c7223..12debed301a3ddbc166abcb3f444dd4775b40407 100644
--- a/install/ui/src/freeipa/stageuser.js
+++ b/install/ui/src/freeipa/stageuser.js
@@ -298,6 +298,9 @@ stageuser.search_preserved_facet_spec = {
 actions: [
 {
 $type: 'batch_undel'
+},
+{
+$type: 'batch_stage'
 }
 ],
 control_buttons: [
@@ -305,6 +308,11 @@ stageuser.search_preserved_facet_spec = {
 name: 'undel',
 label: '@i18n:buttons.restore',
 icon: 'fa-heart'
+},
+{
+name: 'batch_stage',
+label: '@i18n:buttons.stage',
+icon: 'fa-user'
 }
 ],
 policies: [
@@ -323,6 +331,12 @@ mod_user.entity_spec.policies.push(
 {
 $factory: IPA.facet_update_policy,
 source_facet: 'search_preserved',
+dest_entity: 'stageuser',
+dest_facet: 'search'
+},
+{
+$factory: IPA.facet_update_policy,
+source_facet: 'search_preserved',
 dest_entity: 'user',
 dest_facet: 'search'
 },
@@ -385,6 +399,20 @@ stageuser.activate_action = function(spec) {
 return that;
 };
 
+stageuser.batch_stage_action = function(spec) {
+
+spec = spec || {};
+
+spec.name = spec.name || 'batch_stage';
+spec.method = spec.method || 'stage';
+spec.needs_confirm = spec.needs_confirm === undefined ? true : spec.needs_confirm;
+spec.enable_cond = spec.enable_cond || ['item-selected'];
+spec.success_msg = spec.success_msg || '@i18n:objects.stageuser.stage_success';
+spec.confirm_msg = spec.confirm_msg || '@i18n:objects.stageuser.stage_confirm';
+
+return IPA.batch_items_action(spec);
+};
+
 /**
  * Stage user entity specification object
  * @member stageuser
@@ -402,6 +430,7 @@ stageuser.register = function() {
 a.register('batch_activate', stageuser.batch_activate_action);
 a.register('batch_undel', stageuser.batch_undel_action);
 a.register('activate', stageuser.activate_action);
+a.register('batch_stage', stageuser.batch_stage_action);
 e.register({type: 'stageuser', spec: stageuser.stageuser_spec});
 f.register_from_spec('user_search_preserved', stageuser.search_preserved_facet_spec);
 };
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 7bd74dc815273e697b8dddb2b250b286410ba845..246bb380dd34097f3f6557bf71b6cffa322118fa 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -89,6 +89,7 @@
 "save": "Save",
 "set": "Set",
 "show": "Show",
+"stage": "Stage",
 "unapply": "Un-apply",
 "update": "Update",
 "view": "View"
@@ -541,6 +542,8 @@
 "activate_success": "${count} user(s) activated",
 "label": "Stage users",
 "preserved_label": "Preserved users",
+"stage_confirm": "Are you sure you want to stage selected users?",
+"stage_success": "${count} users(s) staged",
 "undel_confirm": "Are you sure you want to restore selected users?",
 "undel_success": "${count} user(s) restored",
 "user_categories": "User categories",
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index