Re: [Freeipa-devel] [PATCH] 695 webui: display messages contained in API responses

2014-07-07 Thread Petr Viktorin

On 07/04/2014 04:18 PM, Petr Spacek wrote:

On 4.7.2014 16:14, Martin Basti wrote:

On Fri, 2014-07-04 at 16:12 +0200, Petr Spacek wrote:

On 3.7.2014 15:30, Petr Vobornik wrote:

API responses can contain warnings in messages array. This patch
also adds support for displaying multiple notifications at the same
time in order to show the message and a status of finished operation.

Notes:
- was implemented because of
https://git.fedorahosted.org/cgit/freeipa.git/commit/?id=33cf958b98dc2d80d17b3de1c145d403df4a3ba3

-- test by modifying Master DNS Zone which has a Zone forwarder set.
- I'd like to move the notification code to separate module in a
future and
then extend it according to PatternFly pattern which is currently under
developemnt (should contain history, ...).


ACK from functional perspective. It properly displays warnings about
DNS zones
and DNSSEC.

It can be pushed if there is no problem in the code, I can't really
check that.



Was there any problem with hardcoded '/n' in warning message text?


It works for me - the text is wrapped, I don't see any glitch.



Pushed to master: d0c12fb0c0a892f61a5a6127069737fdab2c107d

--
PetrĀ³

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 695 webui: display messages contained in API responses

2014-07-04 Thread Petr Spacek

On 3.7.2014 15:30, Petr Vobornik wrote:

API responses can contain warnings in messages array. This patch
also adds support for displaying multiple notifications at the same
time in order to show the message and a status of finished operation.

Notes:
- was implemented because of
https://git.fedorahosted.org/cgit/freeipa.git/commit/?id=33cf958b98dc2d80d17b3de1c145d403df4a3ba3
-- test by modifying Master DNS Zone which has a Zone forwarder set.
- I'd like to move the notification code to separate module in a future and
then extend it according to PatternFly pattern which is currently under
developemnt (should contain history, ...).


ACK from functional perspective. It properly displays warnings about DNS zones 
and DNSSEC.


It can be pushed if there is no problem in the code, I can't really check that.

--
Petr^2 Spacek

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 695 webui: display messages contained in API responses

2014-07-04 Thread Martin Basti
On Fri, 2014-07-04 at 16:12 +0200, Petr Spacek wrote:
 On 3.7.2014 15:30, Petr Vobornik wrote:
  API responses can contain warnings in messages array. This patch
  also adds support for displaying multiple notifications at the same
  time in order to show the message and a status of finished operation.
 
  Notes:
  - was implemented because of
  https://git.fedorahosted.org/cgit/freeipa.git/commit/?id=33cf958b98dc2d80d17b3de1c145d403df4a3ba3
  -- test by modifying Master DNS Zone which has a Zone forwarder set.
  - I'd like to move the notification code to separate module in a future and
  then extend it according to PatternFly pattern which is currently under
  developemnt (should contain history, ...).
 
 ACK from functional perspective. It properly displays warnings about DNS 
 zones 
 and DNSSEC.
 
 It can be pushed if there is no problem in the code, I can't really check 
 that.
 

Was there any problem with hardcoded '/n' in warning message text?
-- 
Martin^2 Basti

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 695 webui: display messages contained in API responses

2014-07-04 Thread Petr Spacek

On 4.7.2014 16:14, Martin Basti wrote:

On Fri, 2014-07-04 at 16:12 +0200, Petr Spacek wrote:

On 3.7.2014 15:30, Petr Vobornik wrote:

API responses can contain warnings in messages array. This patch
also adds support for displaying multiple notifications at the same
time in order to show the message and a status of finished operation.

Notes:
- was implemented because of
https://git.fedorahosted.org/cgit/freeipa.git/commit/?id=33cf958b98dc2d80d17b3de1c145d403df4a3ba3
-- test by modifying Master DNS Zone which has a Zone forwarder set.
- I'd like to move the notification code to separate module in a future and
then extend it according to PatternFly pattern which is currently under
developemnt (should contain history, ...).


ACK from functional perspective. It properly displays warnings about DNS zones
and DNSSEC.

It can be pushed if there is no problem in the code, I can't really check that.



Was there any problem with hardcoded '/n' in warning message text?


It works for me - the text is wrapped, I don't see any glitch.

--
Petr^2 Spacek

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


[Freeipa-devel] [PATCH] 695 webui: display messages contained in API responses

2014-07-03 Thread Petr Vobornik

API responses can contain warnings in messages array. This patch
also adds support for displaying multiple notifications at the same
time in order to show the message and a status of finished operation.

Notes:
- was implemented because of 
https://git.fedorahosted.org/cgit/freeipa.git/commit/?id=33cf958b98dc2d80d17b3de1c145d403df4a3ba3 
-- test by modifying Master DNS Zone which has a Zone forwarder set.
- I'd like to move the notification code to separate module in a future 
and then extend it according to PatternFly pattern which is currently 
under developemnt (should contain history, ...).

--
Petr Vobornik
From da9375212307e5a746e253a3d163e1eb8f3dbd75 Mon Sep 17 00:00:00 2001
From: Petr Vobornik pvobo...@redhat.com
Date: Thu, 3 Jul 2014 10:31:54 +0200
Subject: [PATCH] webui: display messages contained in API responses

API responses can contain warnings in messages array. This patch
also adds support for displaying multiple notifications at the same
time in order to show the message and a status of finished operation.
---
 install/ui/src/freeipa/ipa.js| 80 ++--
 install/ui/src/freeipa/rpc.js| 21 ++-
 install/ui/src/freeipa/util.js   | 36 +-
 install/ui/src/freeipa/widget.js | 10 -
 4 files changed, 91 insertions(+), 56 deletions(-)

diff --git a/install/ui/src/freeipa/ipa.js b/install/ui/src/freeipa/ipa.js
index be202ecdc9882638fc072c1a11452c8e1bcfccc6..0fb35632e9147c901f1a961c978d6ed8ff84aa2e 100644
--- a/install/ui/src/freeipa/ipa.js
+++ b/install/ui/src/freeipa/ipa.js
@@ -36,9 +36,10 @@ define([
 './reg',
 './rpc',
 './text',
+'./util',
 'exports'
 ], function(Deferred, keys, topic, $, JSON, i18n, auth, datetime,
-metadata_provider, builder, reg, rpc, text, exports) {
+metadata_provider, builder, reg, rpc, text, util, exports) {
 
 /**
  * @class
@@ -830,32 +831,6 @@ IPA.error_dialog = function(spec) {
 /** @property {string[]} visible_buttons=['retry', 'cancel'] Visible button names */
 that.visible_buttons = spec.visible_buttons || ['retry', 'cancel'];
 
-/**
- * Beautify error message
- *
- * Multi-lined text may contain TAB character as first char of the line
- * to hint at marking the whole line differently.
- * @param {jQuery} container Container to add the beautified message.
- * @param {string} message
- */
-that.beautify_message = function(container, message) {
-var lines = message.split(/\n/g);
-var line_span;
-for(var i=0; ilines.length; i++) {
-
-if (lines[i].charAt(0) == '\t') {
-line_span = $('p /', {
-'class': 'error-message-hinted',
-text: lines[i].substr(1)
-}).appendTo(container);
-} else {
-line_span = $('p /', {
-text: lines[i]
-}).appendTo(container);
-}
-}
-};
-
 /** @inheritDoc */
 that.create_content = function() {
 if (that.error_thrown.url) {
@@ -865,7 +840,7 @@ IPA.error_dialog = function(spec) {
 }
 
 var error_message = $('div /', {});
-that.beautify_message(error_message, that.error_thrown.message);
+error_message.append(util.beautify_message(that.error_thrown.message));
 error_message.appendTo(that.container);
 
 if(that.errors  that.errors.length  0) {
@@ -896,7 +871,7 @@ IPA.error_dialog = function(spec) {
 var error = that.errors[i];
 if(error.message) {
 var error_div = $('li /', {});
-that.beautify_message(error_div, error.message);
+error_div.append(util.beautify_message(error.message));
 error_div.appendTo(errors_container);
 }
 }
@@ -1161,36 +1136,38 @@ IPA.notify = function(message, type, timeout) {
 
 if (!message) return; // don't show undefined, null and such
 
-message = text.get(message);
-
-function destroy_timeout() {
-if (IPA.notify_success.timeout) window.clearTimeout(IPA.notify_success.timeout);
+if (typeof message === 'string') {
+message = text.get(message);
 }
 
-var notification_area = $('.notification-area');
+var notification_area = $('#notification .notification-area');
 if (notification_area.length === 0) {
 notification_area =  $('div/', {
-'class': 'notification-area',
-click: function() {
-destroy_timeout();
-notification_area.fadeOut(100);
-}
+'class': 'notification-area'
 });
-
 notification_area.appendTo('#notification');
 }
-notification_area.empty();
-
 var alert = IPA.alert_helper.create_alert('msg', message, type);
-var el = IPA.alert_helper.render_alert(alert);
+var el =