KEYCLOAK-2050 KEYCLOAK-2051 Fix notifications
This commit is contained in:
parent
274838aa64
commit
dd85c125cb
5 changed files with 27 additions and 27 deletions
|
@ -53,10 +53,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="feedback-aligner" data-ng-show="notification">
|
<div class="feedback-aligner" data-ng-show="notification.display">
|
||||||
<div class="alert alert-{{notification.type}} alert-dismissable">
|
<div class="alert alert-{{notification.type}} alert-dismissable">
|
||||||
<button type="button" class="close">
|
<button type="button" class="close" data-ng-click="notification.remove()" id="notification-close">
|
||||||
<span class="pficon pficon-close" data-ng-click="notification = null"/>
|
<span class="pficon pficon-close"/>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<span class="pficon pficon-ok" ng-show="notification.type == 'success'"></span>
|
<span class="pficon pficon-ok" ng-show="notification.type == 'success'"></span>
|
||||||
|
|
|
@ -142,31 +142,32 @@ module.factory('Notifications', function($rootScope, $timeout) {
|
||||||
var delay = 5000;
|
var delay = 5000;
|
||||||
|
|
||||||
var notifications = {};
|
var notifications = {};
|
||||||
|
notifications.current = { display: false };
|
||||||
|
notifications.current.remove = function() {
|
||||||
|
if (notifications.scheduled) {
|
||||||
|
$timeout.cancel(notifications.scheduled);
|
||||||
|
delete notifications.scheduled;
|
||||||
|
}
|
||||||
|
delete notifications.current.type;
|
||||||
|
delete notifications.current.header;
|
||||||
|
delete notifications.current.message;
|
||||||
|
notifications.current.display = false;
|
||||||
|
console.debug("Remove message");
|
||||||
|
}
|
||||||
|
|
||||||
var scheduled = null;
|
$rootScope.notification = notifications.current;
|
||||||
var schedulePop = function() {
|
|
||||||
if (scheduled) {
|
|
||||||
$timeout.cancel(scheduled);
|
|
||||||
}
|
|
||||||
|
|
||||||
scheduled = $timeout(function() {
|
|
||||||
$rootScope.notification = null;
|
|
||||||
scheduled = null;
|
|
||||||
}, delay);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!$rootScope.notifications) {
|
|
||||||
$rootScope.notifications = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
notifications.message = function(type, header, message) {
|
notifications.message = function(type, header, message) {
|
||||||
$rootScope.notification = {
|
notifications.current.type = type;
|
||||||
type : type,
|
notifications.current.header = header;
|
||||||
header: header,
|
notifications.current.message = message;
|
||||||
message : message
|
notifications.current.display = true;
|
||||||
};
|
|
||||||
|
|
||||||
schedulePop();
|
notifications.scheduled = $timeout(function() {
|
||||||
|
notifications.current.remove();
|
||||||
|
}, delay);
|
||||||
|
|
||||||
|
console.debug("Added message");
|
||||||
}
|
}
|
||||||
|
|
||||||
notifications.info = function(message) {
|
notifications.info = function(message) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class Authentication extends AdminConsoleRealm {
|
||||||
@FindBy(xpath = "//div[contains(@class, 'alert-success')]")
|
@FindBy(xpath = "//div[contains(@class, 'alert-success')]")
|
||||||
private WebElement success;
|
private WebElement success;
|
||||||
|
|
||||||
@FindBy(xpath = "//button[@class='close']/span")
|
@FindBy(id = "notification-close")
|
||||||
private WebElement close;
|
private WebElement close;
|
||||||
|
|
||||||
public String getSuccessMessage() {
|
public String getSuccessMessage() {
|
||||||
|
|
|
@ -67,7 +67,6 @@ public class OTPPolicyTest extends AbstractConsoleTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore //KEYCLOAK-2051 when you close notification, it is not displayed again
|
|
||||||
public void invalidValuesTest() {
|
public void invalidValuesTest() {
|
||||||
otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, "", "30");
|
otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, "", "30");
|
||||||
assertEquals("Error! Missing or invalid field(s). Please verify the fields in red.", otpPolicyPage.getErrorMessage());
|
assertEquals("Error! Missing or invalid field(s). Please verify the fields in red.", otpPolicyPage.getErrorMessage());
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class URLAssert {
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
// wait.until(urlStartsWith);
|
// wait.until(urlStartsWith);
|
||||||
assertTrue(startsWithNormalized(driver.getCurrentUrl(), url));
|
assertTrue("'" + driver.getCurrentUrl() + " does not start with '" + url + "'", startsWithNormalized(driver.getCurrentUrl(), url));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void assertCurrentUrlDoesntStartWith(AbstractPage page) {
|
public static void assertCurrentUrlDoesntStartWith(AbstractPage page) {
|
||||||
|
|
Loading…
Reference in a new issue